00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef NO_AST_MM
00015 #ifndef _ASTMM_H
00016 #define _ASTMM_H
00017
00018 #define __AST_DEBUG_MALLOC
00019
00020
00021 #include <sys/types.h>
00022 #include <stdlib.h>
00023 #include <string.h>
00024
00025
00026 #undef malloc
00027 #undef calloc
00028 #undef realloc
00029 #undef strdup
00030 #undef strndup
00031
00032 void *__ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func);
00033 void *__ast_malloc(size_t size, const char *file, int lineno, const char *func);
00034 void __ast_free(void *ptr, const char *file, int lineno, const char *func);
00035 void *__ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func);
00036 char *__ast_strdup(const char *s, const char *file, int lineno, const char *func);
00037 char *__ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func);
00038
00039 void __ast_mm_init(void);
00040
00041
00042
00043 #define calloc(a,b) \
00044 __ast_calloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
00045
00046 #define malloc(a) \
00047 __ast_malloc(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
00048
00049 #define free(a) \
00050 __ast_free(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
00051
00052 #define realloc(a,b) \
00053 __ast_realloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
00054
00055 #define strdup(a) \
00056 __ast_strdup(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
00057
00058 #define strndup(a,b) \
00059 __ast_strndup(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
00060
00061 #else
00062 #error "NEVER INCLUDE astmm.h DIRECTLY!!"
00063 #endif
00064 #endif