Fixes segfault when using ParkAndAnnounce. Also, loop made more efficient as announce template only needs to be checked until the number of colon separated arguments run out, not the entire pointer storage array. Was done in a similiar fashion in 1.4, but here we're using less variables.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121131 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jeff Peeler
2008-06-08 01:16:25 +00:00
parent 96233af5dc
commit c1b88b3cf4

View File

@@ -144,9 +144,12 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data)
ast_verb(4, "Announce Template:%s\n", args.template); ast_verb(4, "Announce Template:%s\n", args.template);
for (looptemp = 0, tmp[looptemp++] = strsep(&args.template, ":"); for (looptemp = 0; looptemp < sizeof(tmp) / sizeof(tmp[0]); looptemp++) {
looptemp < sizeof(tmp) / sizeof(tmp[0]); if ((tmp[looptemp] = strsep(&args.template, ":")) != NULL)
tmp[looptemp++] = strsep(&args.template, ":")); continue;
else
break;
}
for (i = 0; i < looptemp; i++) { for (i = 0; i < looptemp; i++) {
ast_verb(4, "Announce:%s\n", tmp[i]); ast_verb(4, "Announce:%s\n", tmp[i]);