[Asterisk-code-review] res_ael: Use Gosub in for loop expressions (...asterisk[13])

Joshua Colp asteriskteam at digium.com
Tue Apr 16 08:08:52 CDT 2019


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11267 )

Change subject: res_ael: Use Gosub in for loop expressions
......................................................................

res_ael: Use Gosub in for loop expressions

In AEL2, if a 'for' statement contains macro* calls, like:

    for (&iterator(${TRY},A); "${A}" != ""; &iterate(A)) {

The AEL2 parser will translate these into calls to the deprecated Macro
dialplan application and use the antiquated pipe delimiter.

Instead, convert these into calls to the Gosub dialplan application and
use commas as argument separators.

ASTERISK-18593 #close
Reported by: Luke-Jr

* 'macro' in this context means AEL2 macros, not the 'Macro' application

Change-Id: I3d73716033b8e3e42e0209d355bf5f10c97045fc
---
M res/ael/pval.c
1 file changed, 3 insertions(+), 7 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/ael/pval.c b/res/ael/pval.c
index bbfeb2d..03e9061 100644
--- a/res/ael/pval.c
+++ b/res/ael/pval.c
@@ -3541,18 +3541,14 @@
 					strcpy(buf2, strp3);
 					strp3 = strchr(buf2,'(');
 					if (strp3) {
-						*strp3 = '|';
-					}
-					while ((strp3=strchr(buf2,','))) {
-						*strp3 = '|';
+						*strp3 = ',';
 					}
 					strp3 = strrchr(buf2, ')');
 					if (strp3)
 						*strp3 = 0; /* remove the closing paren */
-
 					for_init->appargs = strdup(buf2);
 					free(for_init->app);
-					for_init->app = strdup("Macro");
+					for_init->app = strdup("Gosub");
 				} else {  /* must be a regular app call */
 					char *strp3;
 					strcpy(buf2, strp2);
@@ -3599,7 +3595,7 @@
 
 					for_inc->appargs = strdup(buf2);
 
-					for_inc->app = strdup("Macro");
+					for_inc->app = strdup("Gosub");
 				} else {  /* must be a regular app call */
 					char *strp3;
 					strcpy(buf2, strp2);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11267
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I3d73716033b8e3e42e0209d355bf5f10c97045fc
Gerrit-Change-Number: 11267
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190416/a678438a/attachment-0001.html>


More information about the asterisk-code-review mailing list