memory.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef INCLUDE_ROARING_MEMORY_H_
  2. #define INCLUDE_ROARING_MEMORY_H_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <stddef.h> // for size_t
  7. typedef void* (*roaring_malloc_p)(size_t);
  8. typedef void* (*roaring_realloc_p)(void*, size_t);
  9. typedef void* (*roaring_calloc_p)(size_t, size_t);
  10. typedef void (*roaring_free_p)(void*);
  11. typedef void* (*roaring_aligned_malloc_p)(size_t, size_t);
  12. typedef void (*roaring_aligned_free_p)(void*);
  13. typedef struct roaring_memory_s {
  14. roaring_malloc_p malloc;
  15. roaring_realloc_p realloc;
  16. roaring_calloc_p calloc;
  17. roaring_free_p free;
  18. roaring_aligned_malloc_p aligned_malloc;
  19. roaring_aligned_free_p aligned_free;
  20. } roaring_memory_t;
  21. void roaring_init_memory_hook(roaring_memory_t memory_hook);
  22. void* roaring_malloc(size_t);
  23. void* roaring_realloc(void*, size_t);
  24. void* roaring_calloc(size_t, size_t);
  25. void roaring_free(void*);
  26. void* roaring_aligned_malloc(size_t, size_t);
  27. void roaring_aligned_free(void*);
  28. #ifdef __cplusplus
  29. }
  30. #endif
  31. #endif // INCLUDE_ROARING_MEMORY_H_