]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
malloc: Remove redundant NULL check
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Thu, 10 Jul 2025 15:49:14 +0000 (15:49 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Tue, 29 Jul 2025 14:11:58 +0000 (14:11 +0000)
Remove a redundant NULL check from tcache_get_n.

Reviewed-by: Cupertino Miranda <cupertino.miranda@oracle.com>
malloc/malloc.c

index 5ca390cc225c6513cd106a974e8c6ef1baea3130..cf5c02ff642e1049a46cad2837e0a0dcbcb5277f 100644 (file)
@@ -3208,11 +3208,10 @@ tcache_get_n (size_t tc_idx, tcache_entry **ep, bool mangled)
   if (__glibc_unlikely (misaligned_mem (e)))
     malloc_printerr ("malloc(): unaligned tcache chunk detected");
 
-  void *ne = e == NULL ? NULL : REVEAL_PTR (e->next);
   if (!mangled)
-    *ep = ne;
+    *ep = REVEAL_PTR (e->next);
   else
-    *ep = PROTECT_PTR (ep, ne);
+    *ep = PROTECT_PTR (ep, REVEAL_PTR (e->next));
 
   ++(tcache->num_slots[tc_idx]);
   e->key = 0;
@@ -3229,7 +3228,7 @@ tcache_put (mchunkptr chunk, size_t tc_idx)
 static __always_inline void *
 tcache_get (size_t tc_idx)
 {
-  return tcache_get_n (tc_idx, & tcache->entries[tc_idx], false);
+  return tcache_get_n (tc_idx, &tcache->entries[tc_idx], false);
 }
 
 static __always_inline tcache_entry **