Skip to content
Snippets Groups Projects
Commit ad479517 authored by Luigi Rizzo's avatar Luigi Rizzo
Browse files

minor code simplifications - no need to use temporary

variables.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@16639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 5880a7f5
No related branches found
No related tags found
No related merge requests found
......@@ -90,18 +90,14 @@ static char *loopback_helper(char *buf, int buflen, const char *exten, const cha
snprintf(tmp, sizeof(tmp), "%d", priority);
memset(buf, 0, buflen);
AST_LIST_HEAD_INIT_NOLOCK(&headp);
newvariable = ast_var_assign("EXTEN", exten);
AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
newvariable = ast_var_assign("CONTEXT", context);
AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
newvariable = ast_var_assign("PRIORITY", tmp);
AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
pbx_substitute_variables_varshead(&headp, data, buf, buflen);
AST_LIST_INSERT_HEAD(&headp, ast_var_assign("EXTEN", exten), entries);
AST_LIST_INSERT_HEAD(&headp, ast_var_assign("CONTEXT", context), entries);
AST_LIST_INSERT_HEAD(&headp, ast_var_assign("PRIORITY", tmp), entries);
/* Substitute variables */
while (!AST_LIST_EMPTY(&headp)) { /* List Deletion. */
newvariable = AST_LIST_REMOVE_HEAD(&headp, entries);
ast_var_delete(newvariable);
}
pbx_substitute_variables_varshead(&headp, data, buf, buflen);
/* free the list */
while ((newvariable = AST_LIST_REMOVE_HEAD(&headp, entries)))
ast_var_delete(newvariable);
return buf;
}
......@@ -110,14 +106,11 @@ static void loopback_subst(char **newexten, char **newcontext, int *priority, ch
char *con;
char *pri;
*newpattern = strchr(buf, '/');
if (*newpattern) {
*(*newpattern) = '\0';
(*newpattern)++;
}
if (*newpattern)
*(*newpattern)++ = '\0';
con = strchr(buf, '@');
if (con) {
*con = '\0';
con++;
*con++ = '\0';
pri = strchr(con, ':');
} else
pri = strchr(buf, ':');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment