Hi,

Is one of these methods specifically preferred over another? The first
seems more explicit, but seems to me that OpenSIPS would have to parse
the param list twice - once to check whether the param exists and then
again to get the value. Is the second method acceptable?


Method 1:

if ($(var(pstring){param.exists,customparam})) {
    $var(pval) = $(var(pstring){param.value,customparam});
    # do other stuff
}


Method 2:

$var(pval) = $(var(pstring){param.value,customparam});
if ($var(pval) != NULL {
    # do other stuff
}


There is a functional difference between them that in method 1, if the
param doesn't exist then $var(pval) doesn't get set (it might already
exist with a different value), but if this didn't matter in the context
of the code, is one way preferred over the other?

Cheers,
Kingsley.


_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to