i noticed that in sr master version, return is not terminating switch statement.
i have
route [foo] { switch ($var(test)) { case "e1": xlog("L_INFO", "We are at e1\n"); return(1); case "lo": xlog("L_INFO", "... and at lo\n"); return(2); default: xlog("L_INFO", "... and at default\n"); }; return(-1); }
and when the switch statement is executed, i get to syslog
Sep 28 18:09:12 sip /usr/sbin/sip-proxy[3802]: INFO: We are at e1 Sep 28 18:09:12 sip /usr/sbin/sip-proxy[3802]: INFO: ... and at default
why is that? is it a bug or strange "feature".
-- juha
On Sep 28, 2010 at 18:12, Juha Heinanen jh@tutpro.com wrote:
i noticed that in sr master version, return is not terminating switch statement.
i have
route [foo] { switch ($var(test)) { case "e1": xlog("L_INFO", "We are at e1\n"); return(1); case "lo": xlog("L_INFO", "... and at lo\n"); return(2); default: xlog("L_INFO", "... and at default\n"); }; return(-1); }
and when the switch statement is executed, i get to syslog
Sep 28 18:09:12 sip /usr/sbin/sip-proxy[3802]: INFO: We are at e1 Sep 28 18:09:12 sip /usr/sbin/sip-proxy[3802]: INFO: ... and at default
why is that? is it a bug or strange "feature".
It's a bug introduced by my latest commit: 6ab93de core: switch(string) memleak fix
I'll fix it shortly.
Andrei