]> git.ipfire.org Git - thirdparty/glibc.git/commit
malloc: replace instances of __builtin_expect with __glibc_unlikely
authorWilliam Hunt <William.Hunt@arm.com>
Thu, 26 Jun 2025 15:07:14 +0000 (15:07 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Thu, 26 Jun 2025 15:07:53 +0000 (15:07 +0000)
commit9a5a7613acd7641ca4dd3c405922b7c8fbc2ec03
treece062171225d3e7cbf6f1f806620cfd91b2b29de
parentd1ad959b003bae1eb2a5a5fe1acb7c889600e506
malloc: replace instances of __builtin_expect with __glibc_unlikely

Replaced all instances of __builtin_expect to __glibc_unlikely
within malloc.c and malloc-debug.c.  This improves the portability
of glibc by avoiding calls to GNU C built-in functions.  Since all
the expected results from calls to __builtin_expect were 0,
__glibc_likely was never used as a replacement.  Multiple
calls to __builtin_expect within a single if statement have
been replaced with one call to __glibc_unlikely, which wraps
every condition.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
malloc/malloc-debug.c
malloc/malloc.c