mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
Merged revisions 41269 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r41269 | russell | 2006-08-29 09:33:34 -0400 (Tue, 29 Aug 2006) | 3 lines clean up last commit ... most notably, there is no reason to do heap allocations here, and it also included a potential memory leak ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41270 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -851,36 +851,31 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
|
|||||||
ast_get_extension_app(p));
|
ast_get_extension_app(p));
|
||||||
} else { /* copy and replace '|' with ',' */
|
} else { /* copy and replace '|' with ',' */
|
||||||
const char *sep, *cid;
|
const char *sep, *cid;
|
||||||
char *tempdata = strdup(ast_get_extension_app_data(p));
|
char *tempdata;
|
||||||
char *s;
|
char *s;
|
||||||
const char *el = ast_get_extension_label(p);
|
const char *el = ast_get_extension_label(p);
|
||||||
char *label = calloc(1, 128);
|
char label[128];
|
||||||
|
|
||||||
if (!tempdata) { /* XXX error duplicating string ? */
|
tempdata = ast_strdupa(ast_get_extension_app_data(p));
|
||||||
incomplete = 1;
|
|
||||||
continue;
|
for (s = tempdata; *s; s++) {
|
||||||
}
|
|
||||||
for (s = tempdata; *s; s++)
|
|
||||||
if (*s == '|')
|
if (*s == '|')
|
||||||
*s = ',';
|
*s = ',';
|
||||||
|
}
|
||||||
|
|
||||||
if (ast_get_extension_matchcid(p)) {
|
if (ast_get_extension_matchcid(p)) {
|
||||||
sep = "/";
|
sep = "/";
|
||||||
cid = ast_get_extension_cidmatch(p);
|
cid = ast_get_extension_cidmatch(p);
|
||||||
} else {
|
} else
|
||||||
sep = cid = "";
|
sep = cid = "";
|
||||||
}
|
|
||||||
if (el) {
|
if (el && (snprintf(label, 127, "(%s)", el) != (strlen(el) + 2)))
|
||||||
if (snprintf(label, 127, "(%s)", el) != (strlen(el)+2)) {
|
|
||||||
incomplete = 1; /* error encountered or label > 125 chars */
|
incomplete = 1; /* error encountered or label > 125 chars */
|
||||||
label = NULL;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
fprintf(output, "exten => %s%s%s,%d%s,%s(%s)\n",
|
fprintf(output, "exten => %s%s%s,%d%s,%s(%s)\n",
|
||||||
ast_get_extension_name(p), sep, cid,
|
ast_get_extension_name(p), sep, cid,
|
||||||
ast_get_extension_priority(p), (label)?label:"",
|
ast_get_extension_priority(p), label,
|
||||||
ast_get_extension_app(p), tempdata);
|
ast_get_extension_app(p), tempdata);
|
||||||
free(tempdata);
|
|
||||||
if (label) free(label);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user