]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
malloc: Remove use of __curbrk
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Fri, 8 Aug 2025 13:59:31 +0000 (13:59 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Fri, 8 Aug 2025 13:59:31 +0000 (13:59 +0000)
Remove an odd use of __curbrk and use MORECORE (0) instead.
This fixes Hurd build since it doesn't define this symbol.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
malloc/malloc.c

index 9d646abae9a74106c81e3b78dd3ebd4cdcdd4808..5257ee24fdff9320333368c11439a38d08904752 100644 (file)
@@ -2642,13 +2642,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));