[svn-commits] tilghman: branch 1.6.0 r123718 - in /branches/1.6.0: ./ pbx/pbx_spool.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 18 15:24:57 CDT 2008


Author: tilghman
Date: Wed Jun 18 15:24:57 2008
New Revision: 123718

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

................
r123715 | tilghman | 2008-06-18 15:23:58 -0500 (Wed, 18 Jun 2008) | 15 lines

Merged revisions 123710 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r123710 | tilghman | 2008-06-18 15:22:42 -0500 (Wed, 18 Jun 2008) | 7 lines

Set the variables top-down, so that if a script sets a variable more than once,
the last one will take precedence.
(closes issue #12673)
 Reported by: phber
 Patches: 
       20080519__bug12673.diff.txt uploaded by Corydon76 (license 14)

........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/pbx/pbx_spool.c

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

Modified: branches/1.6.0/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/pbx/pbx_spool.c?view=diff&rev=123718&r1=123717&r2=123718
==============================================================================
--- branches/1.6.0/pbx/pbx_spool.c (original)
+++ branches/1.6.0/pbx/pbx_spool.c Wed Jun 18 15:24:57 2008
@@ -120,7 +120,11 @@
 	char buf[256];
 	char *c, *c2;
 	int lineno = 0;
-	struct ast_variable *var;
+	struct ast_variable *var, *last = o->vars;
+
+	while (last && last->next) {
+		last = last->next;
+	}
 
 	while(fgets(buf, sizeof(buf), f)) {
 		lineno++;
@@ -214,8 +218,13 @@
 					if (c2) {
 						var = ast_variable_new(c, c2, fn);
 						if (var) {
-							var->next = o->vars;
-							o->vars = var;
+							/* Always insert at the end, because some people want to treat the spool file as a script */
+							if (last) {
+								last->next = var;
+							} else {
+								o->vars = var;
+							}
+							last = var;
 						}
 					} else
 						ast_log(LOG_WARNING, "Malformed \"%s\" argument.  Should be \"%s: variable=value\"\n", buf, buf);




More information about the svn-commits mailing list