Module: kamailio
Branch: master
Commit: e46dcd2930c97855b9d87061ec4e4167b119d232
URL:
https://github.com/kamailio/kamailio/commit/e46dcd2930c97855b9d87061ec4e416…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-05-03T11:38:59+02:00
core: kemi - option to return 0 instead of null for xval
---
Modified: src/core/kemi.c
Modified: src/core/kemi.h
---
Diff:
https://github.com/kamailio/kamailio/commit/e46dcd2930c97855b9d87061ec4e416…
Patch:
https://github.com/kamailio/kamailio/commit/e46dcd2930c97855b9d87061ec4e416…
---
diff --git a/src/core/kemi.c b/src/core/kemi.c
index d389c4b4e0..8a77c227b7 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -2377,16 +2377,24 @@ static sr_kemi_t _sr_kemi_hdr[] = {
*/
void sr_kemi_xval_null(sr_kemi_xval_t *xval, int rmode)
{
- if(rmode==SR_KEMI_XVAL_NULL_PRINT) {
- xval->vtype = SR_KEMIP_STR;
- xval->v.s = *pv_get_null_str();
- } else if(rmode==SR_KEMI_XVAL_NULL_EMPTY) {
- xval->vtype = SR_KEMIP_STR;
- xval->v.s = *pv_get_empty_str();
- } else {
- xval->vtype = SR_KEMIP_NULL;
- xval->v.s.s = NULL;
- xval->v.s.len = 0;
+ switch(rmode) {
+ case SR_KEMI_XVAL_NULL_PRINT:
+ xval->vtype = SR_KEMIP_STR;
+ xval->v.s = *pv_get_null_str();
+ return;
+ case SR_KEMI_XVAL_NULL_EMPTY:
+ xval->vtype = SR_KEMIP_STR;
+ xval->v.s = *pv_get_empty_str();
+ return;
+ case SR_KEMI_XVAL_NULL_ZERO:
+ xval->vtype = SR_KEMIP_INT;
+ xval->v.n = 0;
+ return;
+ default:
+ xval->vtype = SR_KEMIP_NULL;
+ xval->v.s.s = NULL;
+ xval->v.s.len = 0;
+ return;
}
}
diff --git a/src/core/kemi.h b/src/core/kemi.h
index 85cd521512..dd7d4bf50b 100644
--- a/src/core/kemi.h
+++ b/src/core/kemi.h
@@ -222,6 +222,7 @@ sr_kemi_t* sr_kemi_exports_get_pv(void);
#define SR_KEMI_XVAL_NULL_NONE 0
#define SR_KEMI_XVAL_NULL_PRINT 1
#define SR_KEMI_XVAL_NULL_EMPTY 2
+#define SR_KEMI_XVAL_NULL_ZERO 3
void sr_kemi_xval_null(sr_kemi_xval_t *xval, int rmode);
void sr_kemi_xval_free(sr_kemi_xval_t *xval);
#endif