diff options
Diffstat (limited to 'utils/extconf.c')
-rw-r--r-- | utils/extconf.c | 228 |
1 files changed, 1 insertions, 227 deletions
diff --git a/utils/extconf.c b/utils/extconf.c index 5b3a95be9..541cbf800 100644 --- a/utils/extconf.c +++ b/utils/extconf.c @@ -43,7 +43,7 @@ <support_level>extended</support_level> ***/ -#define ASTMM_LIBC ASTMM_REDIRECT +#define ASTMM_LIBC ASTMM_IGNORE #include "asterisk.h" #undef DEBUG_THREADS @@ -681,9 +681,6 @@ int ast_channel_trylock(struct ast_channel *chan); /* from utils.h */ -#define ast_free free -#define ast_free_ptr free - struct ast_flags { /* stolen from utils.h */ unsigned int flags; }; @@ -704,222 +701,6 @@ struct ast_flags { /* stolen from utils.h */ (p)->flags &= ~(flag); \ } while (0) - - -#define MALLOC_FAILURE_MSG \ - ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file); - -/*! - * \brief A wrapper for malloc() - * - * ast_malloc() is a wrapper for malloc() that will generate an Asterisk log - * message in the case that the allocation fails. - * - * The argument and return value are the same as malloc() - */ -#define ast_malloc(len) \ - __ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__) - -AST_INLINE_API( -void * attribute_malloc __ast_malloc(size_t len, const char *file, int lineno, const char *func), -{ - void *p; - - if (!(p = malloc(len))) - MALLOC_FAILURE_MSG; - - return p; -} -) - -/*! - * \brief A wrapper for calloc() - * - * ast_calloc() is a wrapper for calloc() that will generate an Asterisk log - * message in the case that the allocation fails. - * - * The arguments and return value are the same as calloc() - */ -#define ast_calloc(num, len) \ - __ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__) - -AST_INLINE_API( -void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func), -{ - void *p; - - if (!(p = calloc(num, len))) - MALLOC_FAILURE_MSG; - - return p; -} -) - -/*! - * \brief A wrapper for calloc() for use in cache pools - * - * ast_calloc_cache() is a wrapper for calloc() that will generate an Asterisk log - * message in the case that the allocation fails. When memory debugging is in use, - * the memory allocated by this function will be marked as 'cache' so it can be - * distinguished from normal memory allocations. - * - * The arguments and return value are the same as calloc() - */ -#define ast_calloc_cache(num, len) \ - __ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__) - -/*! - * \brief A wrapper for realloc() - * - * ast_realloc() is a wrapper for realloc() that will generate an Asterisk log - * message in the case that the allocation fails. - * - * The arguments and return value are the same as realloc() - */ -#define ast_realloc(p, len) \ - __ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__) - -AST_INLINE_API( -void *__ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func), -{ - void *newp; - - if (!(newp = realloc(p, len))) - MALLOC_FAILURE_MSG; - - return newp; -} -) - -/*! - * \brief A wrapper for strdup() - * - * ast_strdup() is a wrapper for strdup() that will generate an Asterisk log - * message in the case that the allocation fails. - * - * ast_strdup(), unlike strdup(), can safely accept a NULL argument. If a NULL - * argument is provided, ast_strdup will return NULL without generating any - * kind of error log message. - * - * The argument and return value are the same as strdup() - */ -#define ast_strdup(str) \ - __ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__) - -AST_INLINE_API( -char * attribute_malloc __ast_strdup(const char *str, const char *file, int lineno, const char *func), -{ - char *newstr = NULL; - - if (str) { - if (!(newstr = strdup(str))) - MALLOC_FAILURE_MSG; - } - - return newstr; -} -) - -/*! - * \brief A wrapper for strndup() - * - * ast_strndup() is a wrapper for strndup() that will generate an Asterisk log - * message in the case that the allocation fails. - * - * ast_strndup(), unlike strndup(), can safely accept a NULL argument for the - * string to duplicate. If a NULL argument is provided, ast_strdup will return - * NULL without generating any kind of error log message. - * - * The arguments and return value are the same as strndup() - */ -#define ast_strndup(str, len) \ - __ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__) - -AST_INLINE_API( -char * attribute_malloc __ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func), -{ - char *newstr = NULL; - - if (str) { - if (!(newstr = strndup(str, len))) - MALLOC_FAILURE_MSG; - } - - return newstr; -} -) - -/*! - * \brief A wrapper for asprintf() - * - * ast_asprintf() is a wrapper for asprintf() that will generate an Asterisk log - * message in the case that the allocation fails. - * - * The arguments and return value are the same as asprintf() - */ -#define ast_asprintf(ret, fmt, ...) \ - __ast_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, (ret), (fmt), __VA_ARGS__) - -AST_INLINE_API( -__attribute__((format(printf, 5, 6))) -int __ast_asprintf(const char *file, int lineno, const char *func, char **ret, const char *fmt, ...), -{ - int res; - va_list ap; - - va_start(ap, fmt); - if ((res = vasprintf(ret, fmt, ap)) == -1) - MALLOC_FAILURE_MSG; - va_end(ap); - - return res; -} -) - -/*! - * \brief A wrapper for vasprintf() - * - * ast_vasprintf() is a wrapper for vasprintf() that will generate an Asterisk log - * message in the case that the allocation fails. - * - * The arguments and return value are the same as vasprintf() - */ -#define ast_vasprintf(ret, fmt, ap) \ - __ast_vasprintf((ret), (fmt), (ap), __FILE__, __LINE__, __PRETTY_FUNCTION__) - -AST_INLINE_API( -__attribute__((format(printf, 2, 0))) -int __ast_vasprintf(char **ret, const char *fmt, va_list ap, const char *file, int lineno, const char *func), -{ - int res; - - if ((res = vasprintf(ret, fmt, ap)) == -1) - MALLOC_FAILURE_MSG; - - return res; -} -) - -#if !defined(ast_strdupa) && defined(__GNUC__) -/*! - \brief duplicate a string in memory from the stack - \param s The string to duplicate - - This macro will duplicate the given string. It returns a pointer to the stack - allocatted memory for the new string. -*/ -#define ast_strdupa(s) \ - (__extension__ \ - ({ \ - const char *__old = (s); \ - size_t __len = strlen(__old) + 1; \ - char *__new = __builtin_alloca(__len); \ - memcpy (__new, __old, __len); \ - __new; \ - })) -#endif - - /* from config.c */ #define MAX_NESTED_COMMENTS 128 @@ -1570,20 +1351,14 @@ enum ast_option_flags { AST_OPT_FLAG_TRANSMIT_SILENCE = (1 << 17), /*! Suppress some warnings */ AST_OPT_FLAG_DONT_WARN = (1 << 18), - /*! End CDRs before the 'h' extension */ - AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN = (1 << 19), /*! Always fork, even if verbose or debug settings are non-zero */ AST_OPT_FLAG_ALWAYS_FORK = (1 << 21), /*! Disable log/verbose output to remote consoles */ AST_OPT_FLAG_MUTE = (1 << 22), /*! There is a per-file debug setting */ AST_OPT_FLAG_DEBUG_FILE = (1 << 23), - /*! There is a per-file verbose setting */ - AST_OPT_FLAG_VERBOSE_FILE = (1 << 24), /*! Terminal colors should be adjusted for a light-colored background */ AST_OPT_FLAG_LIGHT_BACKGROUND = (1 << 25), - /*! Count Initiated seconds in CDR's */ - AST_OPT_FLAG_INITIATED_SECONDS = (1 << 26), /*! Force black background */ AST_OPT_FLAG_FORCE_BLACK_BACKGROUND = (1 << 27), }; @@ -1616,7 +1391,6 @@ struct ast_flags ast_options = { AST_DEFAULT_OPTIONS }; #define ast_opt_reconnect ast_test_flag(&ast_options, AST_OPT_FLAG_RECONNECT) #define ast_opt_transmit_silence ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) #define ast_opt_dont_warn ast_test_flag(&ast_options, AST_OPT_FLAG_DONT_WARN) -#define ast_opt_end_cdr_before_h_exten ast_test_flag(&ast_options, AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN) #define ast_opt_always_fork ast_test_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK) #define ast_opt_mute ast_test_flag(&ast_options, AST_OPT_FLAG_MUTE) |