enet_malloc.h 615 B

123456789101112131415161718
  1. #ifndef ENET_ALLOC_H
  2. #define ENET_ALLOC_H
  3. #include <stdlib.h>
  4. #ifndef ENET_MIMALLOC
  5. static const char* enet_malloc_name_str = "malloc";
  6. static inline void* enet_malloc(size_t size_in_bytes) { return malloc(size_in_bytes); }
  7. static inline void enet_free(void* alloc) { free(alloc); }
  8. #else
  9. #include "mimalloc.h"
  10. static const char* enet_malloc_name_str = "mi_malloc";
  11. static inline void* enet_malloc(size_t size_in_bytes) { return mi_malloc(size_in_bytes); }
  12. static inline void enet_free(void* alloc) { mi_free(alloc); }
  13. #endif
  14. static inline const char* enet_malloc_name() { return enet_malloc_name_str; }
  15. #endif