[svn-commits] tilghman: branch 1.6.2 r252978 - in /branches/1.6.2: ./ apps/app_stack.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 16 18:54:34 CDT 2010


Author: tilghman
Date: Tue Mar 16 18:54:30 2010
New Revision: 252978

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=252978
Log:
Merged revisions 252976 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r252976 | tilghman | 2010-03-16 18:49:35 -0500 (Tue, 16 Mar 2010) | 8 lines
  
  Mask out previous arguments on each nested invocation of Gosub.
  (closes issue #16758)
   Reported by: wdoekes
   Patches: 
         20100316__issue16758.diff.txt uploaded by tilghman (license 14)
   
  Review: https://reviewboard.asterisk.org/r/561/
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/apps/app_stack.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/apps/app_stack.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/apps/app_stack.c?view=diff&rev=252978&r1=252977&r2=252978
==============================================================================
--- branches/1.6.2/apps/app_stack.c (original)
+++ branches/1.6.2/apps/app_stack.c Tue Mar 16 18:54:30 2010
@@ -329,9 +329,9 @@
 {
 	struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
 	AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
-	struct gosub_stack_frame *newframe;
+	struct gosub_stack_frame *newframe, *lastframe;
 	char argname[15], *tmp = ast_strdupa(data), *label, *endparen;
-	int i;
+	int i, max_argc = 0;
 	AST_DECLARE_APP_ARGS(args2,
 		AST_APP_ARG(argval)[100];
 	);
@@ -359,6 +359,12 @@
 		stack_store->data = oldlist;
 		AST_LIST_HEAD_INIT(oldlist);
 		ast_channel_datastore_add(chan, stack_store);
+	} else {
+		oldlist = stack_store->data;
+	}
+
+	if ((lastframe = AST_LIST_FIRST(oldlist))) {
+		max_argc = lastframe->arguments;
 	}
 
 	/* Separate the arguments from the label */
@@ -374,8 +380,13 @@
 	} else
 		args2.argc = 0;
 
+	/* Mask out previous arguments in this invocation */
+	if (args2.argc > max_argc) {
+		max_argc = args2.argc;
+	}
+
 	/* Create the return address, but don't save it until we know that the Gosub destination exists */
-	newframe = gosub_allocate_frame(chan->context, chan->exten, chan->priority + 1, args2.argc);
+	newframe = gosub_allocate_frame(chan->context, chan->exten, chan->priority + 1, max_argc);
 
 	if (!newframe) {
 		return -1;
@@ -398,10 +409,10 @@
 	}
 
 	/* Now that we know for certain that we're going to a new location, set our arguments */
-	for (i = 0; i < args2.argc; i++) {
+	for (i = 0; i < max_argc; i++) {
 		snprintf(argname, sizeof(argname), "ARG%d", i + 1);
-		frame_set_var(chan, newframe, argname, args2.argval[i]);
-		ast_debug(1, "Setting '%s' to '%s'\n", argname, args2.argval[i]);
+		frame_set_var(chan, newframe, argname, i < args2.argc ? args2.argval[i] : "");
+		ast_debug(1, "Setting '%s' to '%s'\n", argname, i < args2.argc ? args2.argval[i] : "");
 	}
 	snprintf(argname, sizeof(argname), "%d", args2.argc);
 	frame_set_var(chan, newframe, "ARGC", argname);




More information about the svn-commits mailing list