[PATCH v2 07/10] malloc: Remove do_check_remalloced_chunk
Dev Jain
dev.jain@arm.com
Mon Dec 8 10:59:54 GMT 2025
do_check_remalloced_chunk checks properties of fastbin chunks. But, it is also
used to check properties of other chunks. Hence, remove this and merge the body
of the function in do_check_malloced_chunk.
---
malloc/malloc.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index a8cb67bb93..07087ee642 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2058,7 +2058,6 @@ madvise_thp (void *p, INTERNAL_SIZE_T size)
# define check_chunk(A, P)
# define check_free_chunk(A, P)
# define check_inuse_chunk(A, P)
-# define check_remalloced_chunk(A, P, N)
# define check_malloced_chunk(A, P, N)
# define check_malloc_state(A)
@@ -2067,7 +2066,6 @@ madvise_thp (void *p, INTERNAL_SIZE_T size)
# define check_chunk(A, P) do_check_chunk (A, P)
# define check_free_chunk(A, P) do_check_free_chunk (A, P)
# define check_inuse_chunk(A, P) do_check_inuse_chunk (A, P)
-# define check_remalloced_chunk(A, P, N) do_check_remalloced_chunk (A, P, N)
# define check_malloced_chunk(A, P, N) do_check_malloced_chunk (A, P, N)
# define check_malloc_state(A) do_check_malloc_state (A)
@@ -2188,11 +2186,11 @@ do_check_inuse_chunk (mstate av, mchunkptr p)
}
/*
- Properties of chunks recycled from fastbins
+ Properties of chunks at the point they are malloced
*/
static void
-do_check_remalloced_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T s)
+do_check_malloced_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T s)
{
INTERNAL_SIZE_T sz = chunksize_nomask (p) & ~(PREV_INUSE | NON_MAIN_ARENA);
@@ -2215,17 +2213,6 @@ do_check_remalloced_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T s)
/* chunk is less than MINSIZE more than request */
assert ((long) (sz) - (long) (s) >= 0);
assert ((long) (sz) - (long) (s + MINSIZE) < 0);
-}
-
-/*
- Properties of nonrecycled chunks at the point they are malloced
- */
-
-static void
-do_check_malloced_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T s)
-{
- /* same as recycled case ... */
- do_check_remalloced_chunk (av, p, s);
/*
... plus, must obey implementation invariant that prev_inuse is
--
2.43.0
More information about the Libc-alpha
mailing list