[sr-dev] git:master:d11a1250: core: added selval(evalexpr, valexp1, valexpr2)

Daniel-Constantin Mierla miconda at gmail.com
Mon Feb 8 11:24:03 CET 2021


Module: kamailio
Branch: master
Commit: d11a12502299bf7e6f85505c4b48a4486a647e31
URL: https://github.com/kamailio/kamailio/commit/d11a12502299bf7e6f85505c4b48a4486a647e31

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-02-08T11:23:46+01:00

core: added selval(evalexpr, valexp1, valexpr2)

- this is a core statement that return the 2nd parameter if the 1st
parameter is evaluated to true, or 3rd parameter if the 1st parameter is
evaluated to false
- it can be considered a core function that is equivalent of ternary
condition/operator
- example:
  $var(x) = selval($Ts mod 2, "true/" + $ru, "false/" + $rd);
- the first parameter is a conditional expression, like those used for
IF, the 2nd and 3rd parameters can be expressions like those used in the
right side of assignments

---

Modified: src/core/cfg.lex
Modified: src/core/cfg.y
Modified: src/core/rvalue.c
Modified: src/core/rvalue.h

---

Diff:  https://github.com/kamailio/kamailio/commit/d11a12502299bf7e6f85505c4b48a4486a647e31.diff
Patch: https://github.com/kamailio/kamailio/commit/d11a12502299bf7e6f85505c4b48a4486a647e31.patch




More information about the sr-dev mailing list