mem_alloc.h 676 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef __MEM_ALLOC_H
  6. #define __MEM_ALLOC_H
  7. #include <inttypes.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. typedef void *mem_allocator_t;
  12. mem_allocator_t
  13. mem_allocator_create(void *mem, uint32_t size);
  14. void
  15. mem_allocator_destroy(mem_allocator_t allocator);
  16. void *
  17. mem_allocator_malloc(mem_allocator_t allocator, uint32_t size);
  18. void *
  19. mem_allocator_realloc(mem_allocator_t allocator, void *ptr, uint32_t size);
  20. void
  21. mem_allocator_free(mem_allocator_t allocator, void *ptr);
  22. #ifdef __cplusplus
  23. }
  24. #endif
  25. #endif /* #ifndef __MEM_ALLOC_H */