Loading...
--- libmalloc/libmalloc-715.140.5/src/base.h
+++ libmalloc/libmalloc-409.81.2/src/base.h
@@ -23,12 +23,6 @@
 
 #ifndef __BASE_H
 #define __BASE_H
-
-#include <stddef.h>
-#include "platform.h"
-
-#include <malloc/_ptrcheck.h>
-__ptrcheck_abi_assume_single()
 
 #ifndef __has_extension
 #define __has_extension(x) 0
@@ -58,7 +52,7 @@
 		MALLOC_FATAL_ERROR((cause), message); \
 })
 
-#if __has_include(<machine/cpu_capabilities.h>) && (defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__))
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__)
 #   define __APPLE_API_PRIVATE
 #   include <machine/cpu_capabilities.h>
 #   if defined(__i386__) || defined(__x86_64__)
@@ -67,7 +61,7 @@
 #      define _COMM_PAGE_VERSION_REQD 3
 #   endif
 #   undef __APPLE_API_PRIVATE
-#elif __has_include(<sys/sysctl.h>)
+#else
 #   include <sys/sysctl.h>
 #endif
 
@@ -96,29 +90,11 @@
 #define MALLOC_UNUSED __attribute__((unused))
 #define MALLOC_NORETURN __attribute__((noreturn))
 #define MALLOC_COLD __attribute__((cold))
-#define MALLOC_NOESCAPE __attribute__((noescape))
-#define MALLOC_PRESERVE_MOST __attribute__((preserve_most))
-#define MALLOC_FALLTHROUGH __attribute__((fallthrough))
 #define CHECK_MAGAZINE_PTR_LOCKED(szone, mag_ptr, fun) {}
-
-#if __has_feature(bounds_safety)
-#define __malloc_bidi_indexable __bidi_indexable
-#else
-#define __malloc_bidi_indexable
-#endif
 
 #define SCRIBBLE_BYTE 0xaa /* allocated scribble */
 #define SCRABBLE_BYTE 0x55 /* free()'d scribble */
 #define SCRUBBLE_BYTE 0xdd /* madvise(..., MADV_FREE) scriblle */
-
-#undef KiB
-#undef MiB
-#undef GiB
-#undef TiB
-#define KiB(x) ((uint64_t)(x) << 10)
-#define MiB(x) ((uint64_t)(x) << 20)
-#define GiB(x) ((uint64_t)(x) << 30)
-#define TiB(x) ((uint64_t)(x) << 40)
 
 #define NDEBUG 1
 #define trunc_page_quanta(x) trunc_page((x))
@@ -140,37 +116,6 @@
 #define trunc_large_page_quanta(x) ((x) & (~large_vm_page_quanta_mask))
 #define round_large_page_quanta(x) (trunc_large_page_quanta((x) + large_vm_page_quanta_mask))
 
-/*
- * MALLOC_ABSOLUTE_MAX_SIZE - There are many instances of addition to a
- * user-specified size_t, which can cause overflow (and subsequent crashes)
- * for values near SIZE_T_MAX.  Rather than add extra "if" checks everywhere
- * this occurs, it is easier to just set an absolute maximum request size,
- * and immediately return an error if the requested size exceeds this maximum.
- * Of course, values less than this absolute max can fail later if the value
- * is still too large for the available memory.  The largest value added
- * seems to be large_vm_page_quanta_size (in the macro round_large_page_quanta()), so to be safe, we set
- * the maximum to be 2 * PAGE_SIZE less than SIZE_T_MAX.
- *
- * This value needs to be calculated at runtime, so we'll cache it rather than
- * recalculate on each use.
- */
-#define _MALLOC_ABSOLUTE_MAX_SIZE (SIZE_T_MAX - (2 * large_vm_page_quanta_size))
-
-#if defined(MALLOC_BUILDING_XCTESTS)
-#define malloc_absolute_max_size _MALLOC_ABSOLUTE_MAX_SIZE
-#else
-extern size_t malloc_absolute_max_size; // caches the definition above
-#endif
-
-#if !MALLOC_TARGET_EXCLAVES
-#define malloc_too_large(n) ((n) > malloc_absolute_max_size)
-#else
-#define malloc_too_large(n) (0)
-#endif // !MALLOC_TARGET_EXCLAVES
-
-#if MALLOC_TARGET_EXCLAVES && !defined(MAX)
-#define MAX(a, b) (((a)>(b))?(a):(b))
-#endif // MALLOC_TARGET_EXCLAVES && !defined(MAX)
 
 // add a guard page before each VM region to help debug
 #define MALLOC_ADD_PRELUDE_GUARD_PAGE (1 << 0)
@@ -194,26 +139,6 @@
 #define MALLOC_PURGEABLE (1 << 7)
 // call abort() on malloc errors, but not on out of memory.
 #define MALLOC_ABORT_ON_CORRUPTION (1 << 8)
-// don't populate the mapping for this allocation
-#define MALLOC_NO_POPULATE (1 << 9)
-// enable faulting anywhere within this allocation
-#define MALLOC_CAN_FAULT (1 << 12)
-
-// See malloc_implementation.h
-// MALLOC_MSL_LITE_WRAPPED_ZONE_FLAGS == (1 << 10)
-
-
-/*
- * These commpage routines provide fast access to the logical cpu number
- * of the calling processor assuming no pre-emption occurs.
- */
-
-extern unsigned int hyper_shift;
-extern unsigned int logical_ncpus;
-extern unsigned int phys_ncpus;
-#if CONFIG_CLUSTER_AWARE
-extern unsigned int ncpuclusters;
-#endif // CONFIG_CLUSTER_AWARE
 
 /*
  * msize - a type to refer to the number of quanta of a tiny or small
@@ -228,6 +153,6 @@
 typedef struct rack_s rack_t;
 typedef struct magazine_s magazine_t;
 typedef int mag_index_t;
-typedef void * __single region_t;
+typedef void *region_t;
 
 #endif // __BASE_H