tcc-stupidos/libtcc/include/tcc/memory.h
2025-02-11 13:07:04 +01:00

27 lines
No EOL
1,014 B
C

#ifndef TCC_MEMORY_H
# define TCC_MEMORY_H 1
# include <stddef.h>
void tcc_free(void *ptr);
void *tcc_malloc(size_t size);
void *tcc_mallocz(size_t size);
void *tcc_realloc(void *ptr, size_t size);
char *tcc_strdup(const char *str);
# ifdef TCC_MEMORY_DEBUG
# define tcc_free(ptr) tcc_free_debug(ptr);
# define tcc_malloc(size) tcc_malloc_debug(size, __FILE__, __LINE__)
# define tcc_mallocz(size) tcc_mallocz_debug(size, __FILE__, __LINE__)
# define tcc_realloc(ptr, size) tcc_realloc_debug(ptr, size, __FILE__, __LINE__)
# define tcc_strdup(str) tcc_strdup_debug(str, __FILE__, __LINE__)
void tcc_free_debug(void *ptr);
void *tcc_malloc_debug(size_t size, const char *file, int line);
void *tcc_mallocz_debug(size_t size, const char *file, int line);
void *tcc_realloc_debug(void *ptr, size_t size, const char *file, int line);
void *tcc_strdup_debug(const char *str, const char *file, int line);
void tcc_memcheck(int d);
# endif /* TCC_MEMORY_DEBUG */
#endif /* !TCC_MEMORY_H */