diff options
author | Corey Farrell <git@cfware.com> | 2016-08-19 15:09:45 -0400 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2016-08-19 20:16:36 -0400 |
commit | 8061d9f66f636ada714f719be9809ea58cd5c871 (patch) | |
tree | 09bb8e63ebce00f7023ef54008a75af1caa50b61 /main | |
parent | c6ed91a9c89de71b44045a53cfc73e1b12744cf8 (diff) |
Fix naming mismatch of allocator functions.
Allocator functions that take file/line/func parameters are prefixed
with single-underscore when MALLOC_DEBUG is not defined,
double-underscore when it is defined. This change updates all
allocators that accept file/line/func to have the same prototype in
either ABI mode. The parameter order of __ast_vasprintf and
__ast_asprintf in utils.h have been changed to match that of astmm.h.
End-use allocator macro's have been removed from astmm.h and moved to an
unconditional part of utils.h.
Change-Id: I823bb6ce2b5675b3a4735948f10a3b420e9a023a
Diffstat (limited to 'main')
-rw-r--r-- | main/astobj2.c | 12 | ||||
-rw-r--r-- | main/ccss.c | 4 | ||||
-rw-r--r-- | main/datastore.c | 6 | ||||
-rw-r--r-- | main/stringfields.c | 4 | ||||
-rw-r--r-- | main/utils.c | 2 |
5 files changed, 1 insertions, 27 deletions
diff --git a/main/astobj2.c b/main/astobj2.c index ed91577be..5c92f263f 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -591,11 +591,7 @@ void *__ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned in switch (options & AO2_ALLOC_OPT_LOCK_MASK) { case AO2_ALLOC_OPT_LOCK_MUTEX: -#if defined(__AST_DEBUG_MALLOC) obj_mutex = __ast_calloc(1, sizeof(*obj_mutex) + data_size, file, line, func); -#else - obj_mutex = ast_calloc(1, sizeof(*obj_mutex) + data_size); -#endif if (obj_mutex == NULL) { return NULL; } @@ -604,11 +600,7 @@ void *__ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned in obj = (struct astobj2 *) &obj_mutex->priv_data; break; case AO2_ALLOC_OPT_LOCK_RWLOCK: -#if defined(__AST_DEBUG_MALLOC) obj_rwlock = __ast_calloc(1, sizeof(*obj_rwlock) + data_size, file, line, func); -#else - obj_rwlock = ast_calloc(1, sizeof(*obj_rwlock) + data_size); -#endif if (obj_rwlock == NULL) { return NULL; } @@ -617,11 +609,7 @@ void *__ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned in obj = (struct astobj2 *) &obj_rwlock->priv_data; break; case AO2_ALLOC_OPT_LOCK_NOLOCK: -#if defined(__AST_DEBUG_MALLOC) obj = __ast_calloc(1, sizeof(*obj) + data_size, file, line, func); -#else - obj = ast_calloc(1, sizeof(*obj) + data_size); -#endif if (obj == NULL) { return NULL; } diff --git a/main/ccss.c b/main/ccss.c index 307f71b96..13831b719 100644 --- a/main/ccss.c +++ b/main/ccss.c @@ -682,11 +682,7 @@ void ast_cc_default_config_params(struct ast_cc_config_params *params) struct ast_cc_config_params *__ast_cc_config_params_init(const char *file, int line, const char *function) { -#if defined(__AST_DEBUG_MALLOC) struct ast_cc_config_params *params = __ast_malloc(sizeof(*params), file, line, function); -#else - struct ast_cc_config_params *params = ast_malloc(sizeof(*params)); -#endif if (!params) { return NULL; diff --git a/main/datastore.c b/main/datastore.c index c2bba4190..e536d601b 100644 --- a/main/datastore.c +++ b/main/datastore.c @@ -47,15 +47,9 @@ struct ast_datastore *__ast_datastore_alloc(const struct ast_datastore_info *inf return NULL; } -#if defined(__AST_DEBUG_MALLOC) if (!(datastore = __ast_calloc(1, sizeof(*datastore), file, line, function))) { return NULL; } -#else - if (!(datastore = ast_calloc(1, sizeof(*datastore)))) { - return NULL; - } -#endif datastore->info = info; diff --git a/main/stringfields.c b/main/stringfields.c index e82b49b98..25c584462 100644 --- a/main/stringfields.c +++ b/main/stringfields.c @@ -60,11 +60,7 @@ static size_t optimal_alloc_size(size_t size) static void *calloc_wrapper(unsigned int num_structs, size_t struct_size, const char *file, int lineno, const char *func) { -#if defined(__AST_DEBUG_MALLOC) return __ast_calloc(num_structs, struct_size, file, lineno, func); -#else - return ast_calloc(num_structs, struct_size); -#endif } /*! \brief add a new block to the pool. diff --git a/main/utils.c b/main/utils.c index 1d2aa0b27..73b1c8703 100644 --- a/main/utils.c +++ b/main/utils.c @@ -2369,7 +2369,7 @@ int ast_parse_digest(const char *digest, struct ast_http_digest *d, int request, } #ifndef __AST_DEBUG_MALLOC -int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...) +int __ast_asprintf(const char *file, int lineno, const char *func, char **ret, const char *fmt, ...) { int res; va_list ap; |