custom_memory.h 588 B

123456789101112131415161718192021222324252627
  1. #ifndef OSQP_CUSTOM_MEMORY_H
  2. #define OSQP_CUSTOM_MEMORY_H
  3. # ifdef __cplusplus
  4. extern "C" {
  5. # endif /* ifdef __cplusplus */
  6. # include <stdio.h> //for size_t
  7. # define c_malloc my_malloc
  8. # define c_calloc my_calloc
  9. # define c_free my_free
  10. # define c_realloc my_realloc
  11. /* functions should have the same
  12. signatures as the standard ones */
  13. void* my_malloc(size_t size);
  14. void* my_calloc(size_t num, size_t size);
  15. void* my_realloc(void *ptr, size_t size);
  16. void my_free(void *ptr);
  17. # ifdef __cplusplus
  18. }
  19. # endif /* ifdef __cplusplus */
  20. #endif /* ifndef OSQP_CUSTOM_MEMORY_H */