mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 22:41:10 +01:00
Add hb_memcpy() that does len=0 check
This commit is contained in:
1 parent
5f801da945
commit
bf2c87bfe6
2 files changed
+10
-6
No files matched your search
@@ -760,6 +760,14 @@ static inline unsigned int ARRAY_LENGTH (const Type (&)[n]) { return n; }
|
||||
#define ARRAY_LENGTH_CONST(__array) ((signed int) (sizeof (__array) / sizeof (__array[0])))
|
||||
|
||||
|
||||
static inline void *
|
||||
hb_memcpy (void *__restrict dst, const void *__restrict src, size_t len)
|
||||
{
|
||||
/* It's illegal to pass 0 as size to memcpy. */
|
||||
if (unlikely (!len)) return dst;
|
||||
return memcpy (dst, src, len);
|
||||
}
|
||||
|
||||
static inline int
|
||||
hb_memcmp (const void *a, const void *b, unsigned int len)
|
||||
{
|
||||
|
||||
+2
-6
@@ -489,12 +489,8 @@ struct hb_set_t
|
||||
return;
|
||||
population = other.population;
|
||||
|
||||
if (!count)
|
||||
// memcpy is not necessary if the vectors are zero length. This avoids possibly
|
||||
// passing nullptr to memcpy.
|
||||
return;
|
||||
memcpy ((void *) pages, (const void *) other.pages, count * pages.item_size);
|
||||
memcpy ((void *) page_map, (const void *) other.page_map, count * page_map.item_size);
|
||||
hb_memcpy ((void *) pages, (const void *) other.pages, count * pages.item_size);
|
||||
hb_memcpy ((void *) page_map, (const void *) other.page_map, count * page_map.item_size);
|
||||
}
|
||||
|
||||
bool is_equal (const hb_set_t &other) const
|
||||
|
||||
Reference in new issue
Block a user