diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2021-02-16 14:12:25 +0000 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2021-03-26 11:03:06 +0000 |
commit | 0c719cf42c982ce627179cde4fd583bcca6417bd (patch) | |
tree | 19c2b524aa08657b12827ada7edf9a7d72abd620 /malloc/hooks.c | |
parent | e865dcbb7b3319fc6b03939edae0769154051d84 (diff) | |
download | glibc-0c719cf42c982ce627179cde4fd583bcca6417bd.tar.gz glibc-0c719cf42c982ce627179cde4fd583bcca6417bd.tar.xz glibc-0c719cf42c982ce627179cde4fd583bcca6417bd.zip |
malloc: Refactor TAG_ macros to avoid indirection
This does not change behaviour, just removes one layer of indirection in the internal memory tagging logic. Use tag_ and mtag_ prefixes instead of __tag_ and __mtag_ since these are all symbols with internal linkage, private to malloc.c, so there is no user namespace pollution issue. Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'malloc/hooks.c')
-rw-r--r-- | malloc/hooks.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/malloc/hooks.c b/malloc/hooks.c index efec05f0a8..d8e304c31c 100644 --- a/malloc/hooks.c +++ b/malloc/hooks.c @@ -68,7 +68,7 @@ __malloc_check_init (void) tags, so fetch the tag at each location before dereferencing it. */ #define SAFE_CHAR_OFFSET(p,offset) \ - ((unsigned char *) TAG_AT (((unsigned char *) p) + offset)) + ((unsigned char *) tag_at (((unsigned char *) p) + offset)) /* A simple, standard set of debugging hooks. Overhead is `only' one byte per chunk; still this will catch most cases of double frees or @@ -249,7 +249,7 @@ malloc_check (size_t sz, const void *caller) top_check (); victim = _int_malloc (&main_arena, nb); __libc_lock_unlock (main_arena.mutex); - return mem2mem_check (TAG_NEW_USABLE (victim), sz); + return mem2mem_check (tag_new_usable (victim), sz); } static void @@ -280,7 +280,7 @@ free_check (void *mem, const void *caller) else { /* Mark the chunk as belonging to the library again. */ - (void)TAG_REGION (chunk2rawmem (p), CHUNK_AVAILABLE_SIZE (p) + (void)tag_region (chunk2rawmem (p), CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ); _int_free (&main_arena, p, 1); __libc_lock_unlock (main_arena.mutex); @@ -375,7 +375,7 @@ invert: __libc_lock_unlock (main_arena.mutex); - return mem2mem_check (TAG_NEW_USABLE (newmem), bytes); + return mem2mem_check (tag_new_usable (newmem), bytes); } static void * @@ -417,7 +417,7 @@ memalign_check (size_t alignment, size_t bytes, const void *caller) top_check (); mem = _int_memalign (&main_arena, alignment, bytes + 1); __libc_lock_unlock (main_arena.mutex); - return mem2mem_check (TAG_NEW_USABLE (mem), bytes); + return mem2mem_check (tag_new_usable (mem), bytes); } #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_25) |