almalloc.h 619 B

123456789101112131415161718192021222324252627282930
  1. #ifndef AL_MALLOC_H
  2. #define AL_MALLOC_H
  3. #include <stddef.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /* Minimum alignment required by posix_memalign. */
  8. #define DEF_ALIGN sizeof(void*)
  9. void *al_malloc(size_t alignment, size_t size);
  10. void *al_calloc(size_t alignment, size_t size);
  11. void al_free(void *ptr);
  12. size_t al_get_page_size(void);
  13. /**
  14. * Returns non-0 if the allocation function has direct alignment handling.
  15. * Otherwise, the standard malloc is used with an over-allocation and pointer
  16. * offset strategy.
  17. */
  18. int al_is_sane_alignment_allocator(void);
  19. #ifdef __cplusplus
  20. }
  21. #endif
  22. #endif /* AL_MALLOC_H */