LOCAL_USER_DECL;
-static char *safe_strdup(const char *s)
-{
- return s ? strdup(s) : NULL;
-}
-
static int macro_exec(struct ast_channel *chan, void *data)
{
const char *s;
}
argc = 1;
/* Save old macro variables */
- save_macro_exten = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_EXTEN"));
+ save_macro_exten = ast_strdup(pbx_builtin_getvar_helper(chan, "MACRO_EXTEN"));
pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", oldexten);
- save_macro_context = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"));
+ save_macro_context = ast_strdup(pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"));
pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", oldcontext);
- save_macro_priority = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY"));
+ save_macro_priority = ast_strdup(pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY"));
snprintf(pc, sizeof(pc), "%d", oldpriority);
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", pc);
- save_macro_offset = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"));
+ save_macro_offset = ast_strdup(pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"));
pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", NULL);
/* Setup environment for new run */
The argument and return value are the same as malloc()
*/
#define ast_malloc(len) \
- ({ \
- (_ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
void *_ast_malloc(size_t len, const char *file, int lineno, const char *func),
The arguments and return value are the same as calloc()
*/
#define ast_calloc(num, len) \
- ({ \
- (_ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
void *_ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func),
The arguments and return value are the same as realloc()
*/
#define ast_realloc(p, len) \
- ({ \
- (_ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _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),
The argument and return value are the same as strdup()
*/
#define ast_strdup(str) \
- ({ \
- (_ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-void *_ast_strdup(const char *str, const char *file, int lineno, const char *func),
+char *_ast_strdup(const char *str, const char *file, int lineno, const char *func),
{
char *newstr = NULL;
The arguments and return value are the same as strndup()
*/
#define ast_strndup(str, len) \
- ({ \
- (_ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-void *_ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func),
+char *_ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func),
{
char *newstr = NULL;