Skip to content

Commit

Permalink
CacheDB core: Improve flags for cache_fetch() results
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuchircu committed Feb 23, 2017
1 parent 2ed2a67 commit 21dddc5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions action.c
Expand Up @@ -1304,6 +1304,7 @@ int do_action(struct action* a, struct sip_msg* msg)
{
val.rs = aux;
val.flags = PV_VAL_STR;
fix_val_str_flags(val);

spec = (pv_spec_t*)a->elem[2].u.data;
if (pv_set_value(msg, spec, 0, &val) < 0) {
Expand Down
10 changes: 10 additions & 0 deletions pvar.h
Expand Up @@ -59,6 +59,16 @@
#define PV_VAL_PKG 32
#define PV_VAL_SHM 64

#define fix_val_str_flags(_pvv) \
do { \
if (_pvv.flags & PV_VAL_STR) { \
if (!_pvv.rs.s && _pvv.rs.len == 0) \
_pvv.flags |= PV_VAL_NULL; \
else if (_pvv.rs.s && _pvv.rs.len == 0) \
_pvv.flags |= PV_VAL_EMPTY; \
} \
} while (0)

#define PV_NAME_INTSTR 0
#define PV_NAME_PVAR 1

Expand Down

0 comments on commit 21dddc5

Please sign in to comment.