Modify malloc common function pointers.
Instead of every function being its own atomic, have a single
pointer that can be used to flip all pointers at once. This avoid cases
where the set of pointers can be in an partial switched state.
Also fix a few inconsistent naming of functions in the file.
Test: Ran unit tests (malloc debug, malloc hooks, perfetto).
Change-Id: I3f66da395414586a3fa87874d80dcdf5f702ed39
Merged-In: I3f66da395414586a3fa87874d80dcdf5f702ed39
(cherry picked from commit 77184aedaf973c6e81accfc737f4fc362dad31ac)
diff --git a/libc/private/bionic_malloc_dispatch.h b/libc/private/bionic_malloc_dispatch.h
index f15b72c..0dce03d 100644
--- a/libc/private/bionic_malloc_dispatch.h
+++ b/libc/private/bionic_malloc_dispatch.h
@@ -31,7 +31,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <stdatomic.h>
#include <private/bionic_config.h>
// Entry in malloc dispatch table.
@@ -55,25 +54,25 @@
#endif
struct MallocDispatch {
- _Atomic MallocCalloc calloc;
- _Atomic MallocFree free;
- _Atomic MallocMallinfo mallinfo;
- _Atomic MallocMalloc malloc;
- _Atomic MallocMallocUsableSize malloc_usable_size;
- _Atomic MallocMemalign memalign;
- _Atomic MallocPosixMemalign posix_memalign;
+ MallocCalloc calloc;
+ MallocFree free;
+ MallocMallinfo mallinfo;
+ MallocMalloc malloc;
+ MallocMallocUsableSize malloc_usable_size;
+ MallocMemalign memalign;
+ MallocPosixMemalign posix_memalign;
#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
- _Atomic MallocPvalloc pvalloc;
+ MallocPvalloc pvalloc;
#endif
- _Atomic MallocRealloc realloc;
+ MallocRealloc realloc;
#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
- _Atomic MallocValloc valloc;
+ MallocValloc valloc;
#endif
- _Atomic MallocIterate iterate;
- _Atomic MallocMallocDisable malloc_disable;
- _Atomic MallocMallocEnable malloc_enable;
- _Atomic MallocMallopt mallopt;
- _Atomic MallocAlignedAlloc aligned_alloc;
+ MallocIterate iterate;
+ MallocMallocDisable malloc_disable;
+ MallocMallocEnable malloc_enable;
+ MallocMallopt mallopt;
+ MallocAlignedAlloc aligned_alloc;
} __attribute__((aligned(32)));
#endif