[sr-dev] git:master:6b5959bc: core: pv api - use buffers for empty and null values
Daniel-Constantin Mierla
miconda at gmail.com
Thu Jul 16 12:22:57 CEST 2015
Module: kamailio
Branch: master
Commit: 6b5959bc4aa760930ac176b8761af2004260705a
URL: https://github.com/kamailio/kamailio/commit/6b5959bc4aa760930ac176b8761af2004260705a
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-07-16T12:21:34+02:00
core: pv api - use buffers for empty and null values
- safer if any transformation wants to temporary update the value for
some operations
---
Modified: pvapi.c
---
Diff: https://github.com/kamailio/kamailio/commit/6b5959bc4aa760930ac176b8761af2004260705a.diff
Patch: https://github.com/kamailio/kamailio/commit/6b5959bc4aa760930ac176b8761af2004260705a.patch
---
diff --git a/pvapi.c b/pvapi.c
index d60aebc..3918895 100644
--- a/pvapi.c
+++ b/pvapi.c
@@ -592,6 +592,9 @@ static int pv_get_marker(struct sip_msg *msg, pv_param_t *param,
(int)pv_str_marker.s[0]);
}
+static char pv_str_empty_buf[2];
+static char pv_str_null_buf[8];
+
static str pv_str_empty = { "", 0 };
static str pv_str_null = { "<null>", 6 };
int pv_get_null(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
@@ -1890,6 +1893,13 @@ int pv_init_api(void)
tr_init_table();
if(pv_init_buffer()<0)
return -1;
+
+ pv_str_empty_buf[0] = '\0';
+ pv_str_empty_buf[1] = '\0';
+ pv_str_empty.s = pv_str_empty_buf;
+ strcpy(pv_str_null_buf, "<null>");
+ pv_str_null.s = pv_str_null_buf;
+
if(register_pvars_mod("core", _core_pvs)<0)
return -1;
return 0;
More information about the sr-dev
mailing list