alloc.c 468 B

12345678910111213141516171819202122232425262728293031
  1. #include <stdint.h>
  2. #include <stddef.h>
  3. #include <stdbool.h>
  4. #include "alloc.h"
  5. #ifdef ZV_ALLOC_USE_STDLIB
  6. #include <stdlib.h>
  7. #include <malloc.h>
  8. #endif
  9. void * zv_alloc(size_t count) {
  10. #ifdef ZV_ALLOC_USE_STDLIB
  11. return malloc(count);
  12. #endif
  13. }
  14. void * zv_alloc_zero(size_t count) {
  15. #ifdef ZV_ALLOC_USE_STDLIB
  16. return calloc(count, 0);
  17. #endif
  18. }
  19. void zv_free(void *target) {
  20. #ifdef ZV_ALLOC_USE_STDLIB
  21. free(target);
  22. #endif
  23. }