31 #ifndef _ASTERISK_ASTMM_H
32 #define _ASTERISK_ASTMM_H
36 #define __AST_DEBUG_MALLOC
41 #include <sys/types.h>
63 void *
__ast_calloc(
size_t nmemb,
size_t size,
const char *file,
int lineno,
const char *func);
64 void *
__ast_calloc_cache(
size_t nmemb,
size_t size,
const char *file,
int lineno,
const char *func);
65 void *
__ast_malloc(
size_t size,
const char *file,
int lineno,
const char *func);
66 void __ast_free(
void *ptr,
const char *file,
int lineno,
const char *func);
67 void *
__ast_realloc(
void *ptr,
size_t size,
const char *file,
int lineno,
const char *func);
68 char *
__ast_strdup(
const char *s,
const char *file,
int lineno,
const char *func);
69 char *
__ast_strndup(
const char *s,
size_t n,
const char *file,
int lineno,
const char *func);
70 int __ast_asprintf(
const char *file,
int lineno,
const char *func,
char **strp,
const char *
format, ...)
71 __attribute__((format(printf, 5, 6)));
72 int __ast_vasprintf(
char **strp, const
char *format, va_list ap, const
char *file,
int lineno, const
char *func)
73 __attribute__((format(printf, 2, 0)));
80 __ast_calloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
82 #define ast_calloc(a,b) \
83 __ast_calloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
85 #define ast_calloc_cache(a,b) \
86 __ast_calloc_cache(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
89 __ast_malloc(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
91 #define ast_malloc(a) \
92 __ast_malloc(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
95 __ast_free(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
98 __ast_free(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
100 #define realloc(a,b) \
101 __ast_realloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
103 #define ast_realloc(a,b) \
104 __ast_realloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
107 __ast_strdup(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
109 #define ast_strdup(a) \
110 __ast_strdup(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
112 #define strndup(a,b) \
113 __ast_strndup(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
115 #define ast_strndup(a,b) \
116 __ast_strndup(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
118 #define asprintf(a, b, c...) \
119 __ast_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, b, c)
121 #define ast_asprintf(a, b, c...) \
122 __ast_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, b, c)
124 #define vasprintf(a,b,c) \
125 __ast_vasprintf(a,b,c,__FILE__, __LINE__, __PRETTY_FUNCTION__)
127 #define ast_vasprintf(a,b,c) \
128 __ast_vasprintf(a,b,c,__FILE__, __LINE__, __PRETTY_FUNCTION__)
133 #error "NEVER INCLUDE astmm.h DIRECTLY!!"
void ast_std_free(void *ptr)
Asterisk main include file. File version handling, generic pbx functions.
void * __ast_malloc(size_t size, const char *file, int lineno, const char *func)
char * __ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func)
void __ast_free(void *ptr, const char *file, int lineno, const char *func)
void * ast_std_realloc(void *ptr, size_t size)
void * __ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
void * ast_std_malloc(size_t size)
void ast_free_ptr(void *ptr)
int __ast_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func)
void __ast_mm_init_phase_1(void)
char * __ast_strdup(const char *s, const char *file, int lineno, const char *func)
void * __ast_calloc_cache(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
void * __ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func)
void * ast_std_calloc(size_t nmemb, size_t size)
void __ast_mm_init_phase_2(void)
static snd_pcm_format_t format
int __ast_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format,...)