diff options
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/astmm.h | 6 | ||||
-rw-r--r-- | include/asterisk/backtrace.h | 2 | ||||
-rw-r--r-- | include/asterisk/lock.h | 16 | ||||
-rw-r--r-- | include/asterisk/utils.h | 16 |
4 files changed, 13 insertions, 27 deletions
diff --git a/include/asterisk/astmm.h b/include/asterisk/astmm.h index c2a717550..1b008120a 100644 --- a/include/asterisk/astmm.h +++ b/include/asterisk/astmm.h @@ -54,6 +54,12 @@ extern "C" { #undef vasprintf #undef free +void *ast_std_malloc(size_t size); +void *ast_std_calloc(size_t nmemb, size_t size); +void *ast_std_realloc(void *ptr, size_t size); +void ast_std_free(void *ptr); +void ast_free_ptr(void *ptr); + void *__ast_calloc(size_t nmemb, size_t size, 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_malloc(size_t size, const char *file, int lineno, const char *func); diff --git a/include/asterisk/backtrace.h b/include/asterisk/backtrace.h index fef1d86fa..95358bfd2 100644 --- a/include/asterisk/backtrace.h +++ b/include/asterisk/backtrace.h @@ -87,7 +87,7 @@ void *__ast_bt_destroy(struct ast_bt *bt); * \param addresses A list of addresses, such as the ->addresses structure element of struct ast_bt. * \param num_frames Number of addresses in the addresses list * \retval NULL Unable to allocate memory - * \return List of strings. This should be freed with a single call to free. + * \return List of strings. Free the entire list with a single ast_std_free call. * \since 1.6.2.16 */ char **__ast_bt_get_symbols(void **addresses, size_t num_frames); diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 34e944476..aee084f32 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -290,22 +290,6 @@ void ast_remove_lock_info(void *lock_addr); #endif /* HAVE_BKTR */ #endif /* !defined(LOW_MEMORY) */ -#ifdef HAVE_BKTR -static inline void __dump_backtrace(struct ast_bt *bt, int canlog) -{ - char **strings; - - ssize_t i; - - strings = backtrace_symbols(bt->addresses, bt->num_frames); - - for (i = 0; i < bt->num_frames; i++) - __ast_mutex_logger("%s\n", strings[i]); - - free(strings); -} -#endif - /*! * \brief log info for the current lock with ast_log(). * diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index 1623775b9..e24dc02d8 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -465,24 +465,20 @@ long int ast_random(void); */ #define ast_random_double() (((double)ast_random()) / RAND_MAX) +#ifndef __AST_DEBUG_MALLOC +#define ast_std_malloc malloc +#define ast_std_calloc calloc +#define ast_std_realloc realloc +#define ast_std_free free + /*! * \brief free() wrapper * * ast_free_ptr should be used when a function pointer for free() needs to be passed * as the argument to a function. Otherwise, astmm will cause seg faults. */ -#ifdef __AST_DEBUG_MALLOC -static void ast_free_ptr(void *ptr) attribute_unused; -static void ast_free_ptr(void *ptr) -{ - ast_free(ptr); -} -#else #define ast_free free #define ast_free_ptr ast_free -#endif - -#ifndef __AST_DEBUG_MALLOC /* * This buffer is in static memory. We never intend to read it, |