diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-19 01:39:14 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-19 01:39:14 +0000 |
commit | d328c2ea16345797f774231ab1a9c187af850a5e (patch) | |
tree | a9ad01ca57546de53f45ae621678001de1350927 /include | |
parent | 90c2670eb0d939aab851f4a56a062e57ef244719 (diff) |
When astmm is in use, define ast_malloc and friends to malloc, etc., so that
it doesn't report that all allocations are coming from utils.h. Also, add some
more information to the error message astmm reports when a memory allocation
failure occurs.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@13513 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/utils.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index 416f362f6..c702fa6fb 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -246,6 +246,8 @@ int getloadavg(double *list, int nelem); long int ast_random(void); #endif +#ifndef __AST_DEBUG_MALLOC + /*! \brief A wrapper for malloc() @@ -383,6 +385,19 @@ char *_ast_strndup(const char *str, size_t len, const char *file, int lineno, co } ) +#else + +/* If astmm is in use, let it handle these. Otherwise, it will report that + all allocations are coming from this header file */ + +#define ast_malloc(a) malloc(a) +#define ast_calloc(a,b) calloc(a,b) +#define ast_realloc(a,b) realloc(a,b) +#define ast_strdup(a) strdup(a) +#define ast_strndup(a,b) strndup(a,b) + +#endif /* AST_DEBUG_MALLOC */ + #if !defined(ast_strdupa) && defined(__GNUC__) /*! \brief duplicate a string in memory from the stack |