mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	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:
		
							
								
								
									
										14
									
								
								main/heap.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								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 | ||||
| 		)) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user