Fix checks for allocation debugging.

MALLOC_DEBUG should not be used to check if debugging is actually
enabled, __AST_DEBUG_MALLOC should be used instead.  MALLOC_DEBUG only
indicates that debugging is requested, __AST_DEBUG_MALLOC indicates it
is active.

Change-Id: I3ce9cdb6ec91b74ee1302941328462231be1ea53
This commit is contained in:
Corey Farrell
2016-08-19 19:19:28 -04:00
parent b8b5d52b5e
commit cb8fd610e2
10 changed files with 47 additions and 47 deletions

View File

@@ -35,7 +35,7 @@ AST_LIST_HEAD_NOLOCK(varshead, ast_var_t);
struct varshead *ast_var_list_create(void);
void ast_var_list_destroy(struct varshead *head);
#ifdef MALLOC_DEBUG
#ifdef __AST_DEBUG_MALLOC
struct ast_var_t *_ast_var_assign(const char *name, const char *value, const char *file, int lineno, const char *function);
#define ast_var_assign(a,b) _ast_var_assign(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else

View File

@@ -907,7 +907,7 @@ void ast_category_destroy(struct ast_category *cat);
struct ast_variable *ast_category_detach_variables(struct ast_category *cat);
void ast_category_rename(struct ast_category *cat, const char *name);
#ifdef MALLOC_DEBUG
#ifdef __AST_DEBUG_MALLOC
struct ast_variable *_ast_variable_new(const char *name, const char *value, const char *filename, const char *file, const char *function, int lineno);
#define ast_variable_new(a, b, c) _ast_variable_new(a, b, c, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#else

View File

@@ -251,7 +251,7 @@ unsigned int ast_hashtab_hash_short(const short num);
* \param hash a func ptr to do the hashing
* \param do_locking use locks to guarantee safety of iterators/insertion/deletion -- real simpleminded right now
*/
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab * _ast_hashtab_create(int initial_buckets,
int (*compare)(const void *a, const void *b),
int (*resize)(struct ast_hashtab *),
@@ -294,7 +294,7 @@ void ast_hashtab_destroy( struct ast_hashtab *tab, void (*objdestroyfunc)(void *
* \retval 1 on success
* \retval 0 if there's a problem
*/
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj, const char *file, int lineno, const char *func);
#define ast_hashtab_insert_immediate(a,b) _ast_hashtab_insert_immediate(a, b, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
@@ -311,7 +311,7 @@ int ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj);
* \retval 1 on success
* \retval 0 if there's a problem
*/
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, unsigned int h, const char *file, int lineno, const char *func);
#define ast_hashtab_insert_immediate_bucket(a,b,c) _ast_hashtab_insert_immediate_bucket(a, b, c, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
@@ -324,7 +324,7 @@ int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj
* \retval 1 on success
* \retval 0 if there's a problem, or it's already there.
*/
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_safe(struct ast_hashtab *tab, const void *obj, const char *file, int lineno, const char *func);
#define ast_hashtab_insert_safe(a,b) _ast_hashtab_insert_safe(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
@@ -362,7 +362,7 @@ int ast_hashtab_size( struct ast_hashtab *tab);
int ast_hashtab_capacity( struct ast_hashtab *tab);
/*! \brief Return a copy of the hash table */
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab *_ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_func)(const void *obj), const char *file, int lineno, const char *func);
#define ast_hashtab_dup(a,b) _ast_hashtab_dup(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else
@@ -370,7 +370,7 @@ struct ast_hashtab *ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_fun
#endif
/*! \brief Gives an iterator to hastable */
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab_iter *_ast_hashtab_start_traversal(struct ast_hashtab *tab, const char *file, int lineno, const char *func);
#define ast_hashtab_start_traversal(a) _ast_hashtab_start_traversal(a,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else
@@ -395,7 +395,7 @@ void *ast_hashtab_remove_this_object(struct ast_hashtab *tab, void *obj);
/* ------------------ */
/*! \brief Gives an iterator to hastable */
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab_iter *_ast_hashtab_start_write_traversal(struct ast_hashtab *tab, const char *file, int lineno, const char *func);
#define ast_hashtab_start_write_traversal(a) _ast_hashtab_start_write_traversal(a,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else

View File

@@ -97,7 +97,7 @@ typedef int (*ast_heap_cmp_fn)(void *elm1, void *elm2);
* \return An instance of a max heap
* \since 1.6.1
*/
#ifdef MALLOC_DEBUG
#ifdef __AST_DEBUG_MALLOC
struct ast_heap *_ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_fn,
ssize_t index_offset, const char *file, int lineno, const char *func);
#define ast_heap_create(a,b,c) _ast_heap_create(a,b,c,__FILE__,__LINE__,__PRETTY_FUNCTION__)
@@ -126,7 +126,7 @@ struct ast_heap *ast_heap_destroy(struct ast_heap *h);
* \retval non-zero failure
* \since 1.6.1
*/
#ifdef MALLOC_DEBUG
#ifdef __AST_DEBUG_MALLOC
int _ast_heap_push(struct ast_heap *h, void *elm, const char *file, int lineno, const char *func);
#define ast_heap_push(a,b) _ast_heap_push(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else

View File

@@ -616,7 +616,7 @@ int ast_regex_string_to_regex_pattern(const char *regex_string, struct ast_str *
* \note The result of this function is dynamically allocated memory, and must
* be free()'d after it is no longer needed.
*/
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
#define ast_str_create(a) _ast_str_create(a,__FILE__,__LINE__,__PRETTY_FUNCTION__)
AST_INLINE_API(
struct ast_str * attribute_malloc _ast_str_create(size_t init_len,
@@ -771,7 +771,7 @@ char *ast_str_truncate(struct ast_str *buf, ssize_t len),
/*!
* Make space in a new string (e.g. to read in data from a file)
*/
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
AST_INLINE_API(
int _ast_str_make_space(struct ast_str **buf, size_t new_len, const char *file, int lineno, const char *function),
{
@@ -964,7 +964,7 @@ enum {
* through calling one of the other functions or macros defined in this
* file.
*/
#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
#ifdef __AST_DEBUG_MALLOC
int __attribute__((format(printf, 4, 0))) __ast_debug_str_helper(struct ast_str **buf, ssize_t max_len,
int append, const char *fmt, va_list ap, const char *file, int lineno, const char *func);
#define __ast_str_helper(a,b,c,d,e) __ast_debug_str_helper(a,b,c,d,e,__FILE__,__LINE__,__PRETTY_FUNCTION__)