[OpenSIPS-Devel] [ opensips-Bugs-2907864 ] Early return from while() loop fails

SourceForge.net noreply at sourceforge.net
Thu Dec 3 04:05:01 CET 2009


Bugs item #2907864, was opened at 2009-12-03 01:41
Message generated for change (Comment added) made by norm_brandinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2907864&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: trunk
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Norm Brandinger (norm_brandinger)
Assigned to: Nobody/Anonymous (nobody)
Summary: Early return from while() loop fails

Initial Comment:
The simple example below reproduces the problem:

route {
    xlog("L_INFO", "Entering Route TEST\n");
    route(R_TEST);
    xlog("L_INFO", "Returning from Route TEST\n");
}

route[R_TEST] {
    $var(x) = 0;
    while ($var(x) < 5) {
        $var(x) = $var(x) + 1;
        xlog("L_INFO", "Route Test: x=$var(x)\n");
        if ($var(x) == 3) {
            return;
        }
    }
    return;
}

The logs produces are:

Entering Route TEST
Route Test: x=1
Route Test: x=2
Route Test: x=3

Note the the log message indicating a return from R_TEST is NOT produced.
If the while() condition is changed so that the loop completes all of its iterations, then the message indicating a return from R_TEST IS produced.


----------------------------------------------------------------------

>Comment By: Norm Brandinger (norm_brandinger)
Date: 2009-12-03 03:05

Message:
I've uploaded a patch that appears to correct this problem.  Independent
review should be done to confirm that this patch performs as expected.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2907864&group_id=232389



More information about the Devel mailing list