From 36a704e8b54b65e8414fd2a02d973e74a9256e1d Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 1 Oct 2015 09:11:11 +0200 Subject: [PATCH] core: pv - helper function to return empty string --- pvapi.c | 15 +++++++++++++++ pvar.h | 1 + 2 files changed, 16 insertions(+) diff --git a/pvapi.c b/pvapi.c index 3918895c8b2..e9b557e12f8 100644 --- a/pvapi.c +++ b/pvapi.c @@ -608,6 +608,21 @@ int pv_get_null(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) return 0; } +/** + * + */ +int pv_get_strempty(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) +{ + if(res==NULL) + return -1; + + res->rs = pv_str_empty; + res->ri = 0; + res->flags = PV_VAL_STR; + return 0; +} + + /** * */ diff --git a/pvar.h b/pvar.h index 3bdfe17bbe9..8cc84887a2c 100644 --- a/pvar.h +++ b/pvar.h @@ -210,6 +210,7 @@ str* pv_cache_get_name(pv_spec_t *spec); /*! \brief PV helper functions */ int pv_get_null(struct sip_msg *msg, pv_param_t *param, pv_value_t *res); +int pv_get_strempty(struct sip_msg *msg, pv_param_t *param, pv_value_t *res); int pv_get_uintval(struct sip_msg *msg, pv_param_t *param, pv_value_t *res, unsigned int uival);