diff options
author | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-17 05:04:56 +0000 |
---|---|---|
committer | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-17 05:04:56 +0000 |
commit | af3763f18f6c9f007a521711eb45901295fecbbc (patch) | |
tree | 50d7b3c60da36fd4a23c51144e0e693f83ee9c06 /utils/check_expr.c | |
parent | 6ef32ddee1222ada3c5db1edf0c5f8f18f0ff7eb (diff) |
A possibly "horrible fix" for a "horribly broken"
situation.
As stuff shifts around in the asterisk code, the
miscellaneous inclusions from the standalone stuff
gets broken. There's no easy fix for this situation.
I made sure that everything in utils builds without
problem ***AND*** that aelparse runs the regressions
correctly with the following make menuselect options
both on and off:
DONT_OPTIMIZE
DEBUG_THREADS
DEBUG_CHANNEL_LOCKS
MALLOC_DEBUG
MTX_PROFILE
DEBUG_SCHEDULER
DEBUG_THREADLOCALS
DETECT_DEADLOCKS
CHANNEL_TRACE
I think from now on, I'm going to #undef
all these features in the various utils native
files; I guess I could do the same for the
copied-in files, surrounded by STANDALONE ifdef.
A standalone isn't going to care about threads,
mutexes, etc.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@165071 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils/check_expr.c')
-rw-r--r-- | utils/check_expr.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/utils/check_expr.c b/utils/check_expr.c index 1d3fcfd0e..a8d2e6525 100644 --- a/utils/check_expr.c +++ b/utils/check_expr.c @@ -34,6 +34,23 @@ enum ast_lock_type { AST_WRLOCK, }; #endif +#ifdef DEBUG_THREADLOCALS +#define MALLOC_FAILURE_MSG \ + ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file); + +void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func); + +void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func) +{ + void *p; + + if (!(p = calloc(num, len))) + MALLOC_FAILURE_MSG; + + return p; +} +#endif + #if !defined(LOW_MEMORY) #ifdef HAVE_BKTR void ast_store_lock_info(enum ast_lock_type type, const char *filename, |