mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 19:08:14 +00:00
(closes issue #13197)
Reported by: pj (closes issue #13051) Reported by: pj This patch substitutes commas in the expr supplied to the if () statement, as in if ( expr ) ... This solves both the bugs above, and makes the source symmetric with switch statements, which were earlier reported to need this sort of treatment. I tested this using the examples, both for the compiler and at run time. Looks good. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@134652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3641,8 +3641,13 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
|
|||||||
if_end->type = AEL_APPCALL;
|
if_end->type = AEL_APPCALL;
|
||||||
if ( p->type == PV_RANDOM )
|
if ( p->type == PV_RANDOM )
|
||||||
snprintf(buf1,sizeof(buf1),"$[${RAND(0|99)} < (%s)]",p->u1.str);
|
snprintf(buf1,sizeof(buf1),"$[${RAND(0|99)} < (%s)]",p->u1.str);
|
||||||
else
|
else {
|
||||||
snprintf(buf1,sizeof(buf1),"$[%s]",p->u1.str);
|
char buf[8000];
|
||||||
|
strcpy(buf,p->u1.str);
|
||||||
|
substitute_commas(buf);
|
||||||
|
snprintf(buf1,sizeof(buf1),"$[%s]",buf);
|
||||||
|
}
|
||||||
|
|
||||||
if_test->app = 0;
|
if_test->app = 0;
|
||||||
if_test->appargs = strdup(buf1);
|
if_test->appargs = strdup(buf1);
|
||||||
snprintf(buf1,sizeof(buf1),"Finish if-%s-%d", label, control_statement_count);
|
snprintf(buf1,sizeof(buf1),"Finish if-%s-%d", label, control_statement_count);
|
||||||
|
|||||||
Reference in New Issue
Block a user