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

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


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

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; Approved for Submit



diff --git a/res/ael/pval.c b/res/ael/pval.c
index f927077..4e9a525 100644
--- a/res/ael/pval.c
+++ b/res/ael/pval.c
@@ -3540,18 +3540,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);
@@ -3598,7 +3594,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/+/11269
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I3d73716033b8e3e42e0209d355bf5f10c97045fc
Gerrit-Change-Number: 11269
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/521f7129/attachment.html>


More information about the asterisk-code-review mailing list