core: Remove ABI effects of MALLOC_DEBUG.

This allows asterisk to be compiled with MALLOC_DEBUG to load modules
built without MALLOC_DEBUG.  Now pre-compiled third-party modules will
still work regardless of MALLOC_DEBUG being enabled or not.

Change-Id: Ic07ad80b2c2df894db984cf27b16a69383ce0e10
This commit is contained in:
Richard Mudgett
2018-02-19 19:55:50 -06:00
parent e58ae393b1
commit c711e4076a
29 changed files with 390 additions and 485 deletions

View File

@@ -281,11 +281,7 @@ struct ast_config_include {
static void ast_variable_destroy(struct ast_variable *doomed);
static void ast_includes_destroy(struct ast_config_include *incls);
#ifdef __AST_DEBUG_MALLOC
struct ast_variable *_ast_variable_new(const char *name, const char *value, const char *filename, const char *file, const char *func, int lineno)
#else
struct ast_variable *ast_variable_new(const char *name, const char *value, const char *filename)
#endif
{
struct ast_variable *variable;
int name_len = strlen(name) + 1;
@@ -297,13 +293,9 @@ struct ast_variable *ast_variable_new(const char *name, const char *value, const
fn_len = MIN_VARIABLE_FNAME_SPACE;
}
if (
#ifdef __AST_DEBUG_MALLOC
(variable = __ast_calloc(1, fn_len + name_len + val_len + sizeof(*variable), file, lineno, func))
#else
(variable = ast_calloc(1, fn_len + name_len + val_len + sizeof(*variable)))
#endif
) {
variable = __ast_calloc(1, fn_len + name_len + val_len + sizeof(*variable),
file, lineno, func);
if (variable) {
char *dst = variable->stuff; /* writable space starts here */
/* Put file first so ast_include_rename() can calculate space available. */