[svn-commits] tilghman: branch 1.6.0 r107232 - in /branches/1.6.0: ./ main/pbx.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 10 17:02:34 CDT 2008


Author: tilghman
Date: Mon Mar 10 17:02:33 2008
New Revision: 107232

URL: http://svn.digium.com/view/asterisk?view=rev&rev=107232
Log:
Blocked revisions 107231 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r107231 | tilghman | 2008-03-10 16:48:20 -0500 (Mon, 10 Mar 2008) | 6 lines

(closes issue #6019)
 Reported by: ssokol
 Patches: 
       20080304__bug6019.diff.txt uploaded by Corydon76 (license 14)
 Tested by: putnopvut

........

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

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
--- trunk-blocked (original)
+++ trunk-blocked Mon Mar 10 17:02:33 2008
@@ -1,1 +1,1 @@
-/trunk:105597,105984,106072,106110,106179,106236,106240,106250
+/trunk:105597,105984,106072,106110,106179,106236,106240,106250,107231

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

Modified: branches/1.6.0/main/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/pbx.c?view=diff&rev=107232&r1=107231&r2=107232
==============================================================================
--- branches/1.6.0/main/pbx.c (original)
+++ branches/1.6.0/main/pbx.c Mon Mar 10 17:02:33 2008
@@ -122,6 +122,8 @@
 struct ast_context;
 struct ast_app;
 
+AST_THREADSTORAGE(switch_data);
+
 /*!
    \brief ast_exten: An extension
 	The dialplan is saved as a linked list with each context
@@ -165,7 +167,6 @@
 	char *data;				/*!< Data load */
 	int eval;
 	AST_LIST_ENTRY(ast_sw) list;
-	char *tmpdata;
 	char stuff[0];
 };
 
@@ -1640,6 +1641,7 @@
 	struct ast_sw *sw = NULL;
 	struct ast_exten pattern = {NULL, };
 	struct scoreboard score = {0, };
+	struct ast_str *tmpdata = NULL;
 
 	pattern.label = label;
 	pattern.priority = priority;
@@ -1824,8 +1826,13 @@
 		}
 		/* Substitute variables now */
 		
-		if (sw->eval)
-			pbx_substitute_variables_helper(chan, sw->data, sw->tmpdata, SWITCH_DATA_LENGTH - 1);
+		if (sw->eval) {
+			if (!(tmpdata = ast_str_thread_get(&switch_data, 512))) {
+				ast_log(LOG_WARNING, "Can't evaluate switch?!");
+				continue;
+			}
+			pbx_substitute_variables_helper(chan, sw->data, tmpdata->str, tmpdata->len);
+		}
 
 		/* equivalent of extension_match_core() at the switch level */
 		if (action == E_CANMATCH)
@@ -1834,7 +1841,7 @@
 			aswf = asw->matchmore;
 		else /* action == E_MATCH */
 			aswf = asw->exists;
-		datap = sw->eval ? sw->tmpdata : sw->data;
+		datap = sw->eval ? tmpdata->str : sw->data;
 		if (!aswf)
 			res = 0;
 		else {
@@ -5681,11 +5688,6 @@
 	if (data)
 		length += strlen(data);
 	length++;
-	if (eval) {
-		/* Create buffer for evaluation of variables */
-		length += SWITCH_DATA_LENGTH;
-		length++;
-	}
 
 	/* allocate new sw structure ... */
 	if (!(new_sw = ast_calloc(1, length)))
@@ -5703,8 +5705,6 @@
 		strcpy(new_sw->data, "");
 		p++;
 	}
-	if (eval)
-		new_sw->tmpdata = p;
 	new_sw->eval	  = eval;
 	new_sw->registrar = registrar;
 




More information about the svn-commits mailing list