summaryrefslogtreecommitdiff
path: root/main/heap.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2016-08-19 19:19:28 -0400
committerCorey Farrell <git@cfware.com>2016-08-24 11:02:18 -0500
commita8b3d8d7f9dfd1967110da9d9131d3d8a1cb8ccf (patch)
treed17b5dac260e44e407d08c2a75459b1b5bbf48ab /main/heap.c
parent415f95ed00569c8d4c31e46951cdf6aa531742ee (diff)
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
Diffstat (limited to 'main/heap.c')
-rw-r--r--main/heap.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/main/heap.c b/main/heap.c
index 29f069b30..73280fedc 100644
--- a/main/heap.c
+++ b/main/heap.c
@@ -111,7 +111,7 @@ int ast_heap_verify(struct ast_heap *h)
return 0;
}
-#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)
#else
@@ -131,7 +131,7 @@ struct ast_heap *ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_f
}
if (!(h =
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
__ast_calloc(1, sizeof(*h), file, lineno, func)
#else
ast_calloc(1, sizeof(*h))
@@ -145,7 +145,7 @@ struct ast_heap *ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_f
h->avail_len = (1 << init_height) - 1;
if (!(h->heap =
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
__ast_calloc(1, h->avail_len * sizeof(void *), file, lineno, func)
#else
ast_calloc(1, h->avail_len * sizeof(void *))
@@ -176,7 +176,7 @@ struct ast_heap *ast_heap_destroy(struct ast_heap *h)
* \brief Add a row of additional storage for the heap.
*/
static int grow_heap(struct ast_heap *h
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
, const char *file, int lineno, const char *func
#endif
)
@@ -184,7 +184,7 @@ static int grow_heap(struct ast_heap *h
void **new_heap;
size_t new_len = h->avail_len * 2 + 1;
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
new_heap = __ast_realloc(h->heap, new_len * sizeof(void *), file, lineno, func);
#else
new_heap = ast_realloc(h->heap, new_len * sizeof(void *));
@@ -244,14 +244,14 @@ static int bubble_up(struct ast_heap *h, int i)
return i;
}
-#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)
#else
int ast_heap_push(struct ast_heap *h, void *elm)
#endif
{
if (h->cur_len == h->avail_len && grow_heap(h
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
, file, lineno, func
#endif
)) {