aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_macro.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-13 18:38:55 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-13 18:38:55 +0000
commitc68a2d2d8eeae4700c5d8aca778baebd63261010 (patch)
tree5a94467aed03520611a253029bd57ee366f338e5 /apps/app_macro.c
parentf94feca2c56f917573ddbfe2138f3cc6bb6e30fa (diff)
Various cleanups from comments in an email from Luigi Rizzo. Thank you!
- Use a cleaner syntax for declaring the allocation macros - Fix return value for ast_strdup/ast_strndup - remove safe_strdup from app_macro, since ast_strup does the same thing - fix a place in app_queue where ast_calloc+strncpy was used instead of ast_strdup. If you are helping out with these conversions, please watch out for other places where this is done. - add a note to the coding guidelines about the fix to app_queue git-svn-id: http://svn.digium.com/svn/asterisk/trunk@8065 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_macro.c')
-rw-r--r--apps/app_macro.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 4b88e1594..63cf46474 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -89,11 +89,6 @@ STANDARD_LOCAL_USER;
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;
@@ -169,17 +164,17 @@ static int macro_exec(struct ast_channel *chan, void *data)
}
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 */