[asterisk-commits] mmichelson: branch 1.6.0 r195317 - in /branches/1.6.0: ./ apps/app_externalivr.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 18 14:00:28 CDT 2009
Author: mmichelson
Date: Mon May 18 14:00:24 2009
New Revision: 195317
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=195317
Log:
Merged revisions 195316 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r195316 | mmichelson | 2009-05-18 13:58:26 -0500 (Mon, 18 May 2009) | 18 lines
Fix externalivr's setvariable command so that it properly sets multiple variables.
The command had a for loop that was guaranteed to only execute once since
the continuation operation of the loop would set the input buffer NULL. I rewrote
the loop so that its operation was more obvious, and it would set multiple variables
correctly.
I also reduced stack space required for the function, constified the input string,
and modified the function so that it would not modify the input string while I was
at it.
(closes issue #15114)
Reported by: chris-mac
Patches:
15114.patch uploaded by mmichelson (license 60)
Tested by: chris-mac
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/apps/app_externalivr.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/apps/app_externalivr.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.0/apps/app_externalivr.c?view=diff&rev=195317&r1=195316&r2=195317
==============================================================================
--- branches/1.6.0/apps/app_externalivr.c (original)
+++ branches/1.6.0/apps/app_externalivr.c Mon May 18 14:00:24 2009
@@ -265,28 +265,20 @@
static void ast_eivr_setvariable(struct ast_channel *chan, char *data)
{
- char buf[1024];
char *value;
- char *inbuf, *variable;
-
- int j;
-
- for (j = 1, inbuf = data; ; j++, inbuf = NULL) {
- variable = strsep(&inbuf, ",");
- ast_chan_log(LOG_DEBUG, chan, "Setting up a variable: %s\n", variable);
- if(variable) {
- /* variable contains "varname=value" */
- ast_copy_string(buf, variable, sizeof(buf));
- value = strchr(buf, '=');
- if(!value)
- value="";
- else
- *value++ = '\0';
- pbx_builtin_setvar_helper(chan, buf, value);
+ char *inbuf = ast_strdupa(data), *variable;
+
+ for (variable = strsep(&inbuf, ","); variable; variable = strsep(&inbuf, ",")) {
+ ast_debug(1, "Setting up a variable: %s\n", variable);
+ /* variable contains "varname=value" */
+ value = strchr(variable, '=');
+ if (!value) {
+ value = "";
+ } else {
+ *value++ = '\0';
}
- else
- break;
+ pbx_builtin_setvar_helper(chan, variable, value);
}
};
More information about the asterisk-commits
mailing list