]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Remove use of __curbrk.
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Mon, 4 Aug 2025 12:45:56 +0000 (12:45 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Mon, 4 Aug 2025 17:13:55 +0000 (17:13 +0000)
malloc/malloc.c

index 415c59a8753a57e053ded9e4a0dff6c242bff9f4..83df260ed38d927b4170a407cbe1f4d747527bd1 100644 (file)
@@ -2646,13 +2646,11 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
          previous calls. Otherwise, we correct to page-align below.
        */
 
-      /* Defined in brk.c.  */
-      extern void *__curbrk;
       if (__glibc_unlikely (mp_.thp_pagesize != 0))
        {
-         uintptr_t top = ALIGN_UP ((uintptr_t) __curbrk + size,
-                                   mp_.thp_pagesize);
-         size = top - (uintptr_t) __curbrk;
+         uintptr_t lastbrk = (uintptr_t) MORECORE (0);
+         uintptr_t top = ALIGN_UP (lastbrk + size, mp_.thp_pagesize);
+         size = top - lastbrk;
        }
       else
        size = ALIGN_UP (size, GLRO(dl_pagesize));