mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-25 00:41:09 +01:00
Minor, add a zero length tolerant memset, hb_memset
This commit is contained in:
1 parent
e17e744300
commit
670fec231d
2 files changed
+10
-3
No files matched your search
+9
-1
@@ -588,10 +588,18 @@ hb_memcmp (const void *a, const void *b, unsigned int len)
|
||||
/* It's illegal to pass NULL to memcmp(), even if len is zero.
|
||||
* So, wrap it.
|
||||
* https://sourceware.org/bugzilla/show_bug.cgi?id=23878 */
|
||||
if (!len) return 0;
|
||||
if (unlikely (!len)) return 0;
|
||||
return memcmp (a, b, len);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
hb_memset (void *s, int c, unsigned int n)
|
||||
{
|
||||
/* It's illegal to pass NULL to memset(), even if n is zero. */
|
||||
if (unlikely (!n)) return 0;
|
||||
return memset (s, c, n);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
hb_unsigned_mul_overflows (unsigned int count, unsigned int size)
|
||||
{
|
||||
|
||||
+1
-2
@@ -324,8 +324,7 @@ hb_buffer_t::clear_positions ()
|
||||
out_len = 0;
|
||||
out_info = info;
|
||||
|
||||
if (likely (len))
|
||||
memset (pos, 0, sizeof (pos[0]) * len);
|
||||
hb_memset (pos, 0, sizeof (pos[0]) * len);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in new issue
Block a user