Commit: 65ceedf4ddda8575a943d9e3aa8b767520fcb6c7
Parent: fd7b64ba4fdc4eb9f71d7eb5c5a21dae7be88084
Author: Randy Palamar
Date: Tue, 3 Sep 2024 22:42:02 -0600
stb_truetype: replace memset with mem_clear
Diffstat:
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/extern/stb_truetype.h b/extern/stb_truetype.h
@@ -331,7 +331,7 @@
#ifndef STBTT_memcpy
#include <string.h>
#define STBTT_memcpy memcpy
- #define STBTT_memset memset
+ #define STBTT_memset mem_clear
#endif
#endif
diff --git a/font.c b/font.c
@@ -195,8 +195,8 @@ static void
font_atlas_update(FontAtlas *fa)
{
GlyphCache *gc = &fa->glyph_cache;
- mem_clear((u8 *)gc->glyphs, 0, sizeof(*gc->glyphs) * gc->cache_len);
- mem_clear((u8 *)gc->hash_table, 0, sizeof(*gc->hash_table) * gc->cache_len);
+ mem_clear(gc->glyphs, 0, sizeof(*gc->glyphs) * gc->cache_len);
+ mem_clear(gc->hash_table, 0, sizeof(*gc->hash_table) * gc->cache_len);
for(u32 i = 0; i < gc->cache_len - 1; i++)
gc->glyphs[i].next_with_same_hash = i + 1;
get_and_clear_glyph_cache_stats(gc);
diff --git a/util.c b/util.c
@@ -62,8 +62,9 @@ mem_copy(s8 src, s8 dest)
}
static void *
-mem_clear(u8 *p, u8 c, size len)
+mem_clear(void *p_, u8 c, size len)
{
+ u8 *p = p_;
while (len) p[--len] = c;
return p;
}