[sr-dev] git:master:3cffe878: core: adding xavp_clone_level_nodata_with_new_name
Julien Chavanton
jchavanton at gmail.com
Mon Oct 7 21:01:02 CEST 2019
Module: kamailio
Branch: master
Commit: 3cffe8789fd14baef4ff548bb2afc5b2ca9ed66e
URL: https://github.com/kamailio/kamailio/commit/3cffe8789fd14baef4ff548bb2afc5b2ca9ed66e
Author: Julien Chavanton <jchavanton at gmail.com>
Committer: Julien Chavanton <jchavanton at gmail.com>
Date: 2019-10-01T09:22:43-07:00
core: adding xavp_clone_level_nodata_with_new_name
---
Modified: src/core/xavp.c
Modified: src/core/xavp.h
---
Diff: https://github.com/kamailio/kamailio/commit/3cffe8789fd14baef4ff548bb2afc5b2ca9ed66e.diff
Patch: https://github.com/kamailio/kamailio/commit/3cffe8789fd14baef4ff548bb2afc5b2ca9ed66e.patch
---
diff --git a/src/core/xavp.c b/src/core/xavp.c
index e5e33f6e9d..f279def1ed 100644
--- a/src/core/xavp.c
+++ b/src/core/xavp.c
@@ -693,11 +693,16 @@ struct str_list *xavp_get_list_key_names(sr_xavp_t *xavp)
return result;
}
+sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold)
+{
+ return xavp_clone_level_nodata_with_new_name(xold, &xold->name);
+}
+
/**
* clone the xavp without values that are custom data
* - only one list level is cloned, other sublists are ignored
*/
-sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold)
+sr_xavp_t *xavp_clone_level_nodata_with_new_name(sr_xavp_t *xold, str *dst_name)
{
sr_xavp_t *xnew = NULL;
sr_xavp_t *navp = NULL;
@@ -713,13 +718,13 @@ sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold)
LM_INFO("xavp value type is 'data' - ignoring in clone\n");
return NULL;
}
- xnew = xavp_new_value(&xold->name, &xold->val);
+ xnew = xavp_new_value(dst_name, &xold->val);
if(xnew==NULL)
{
LM_ERR("cannot create cloned root xavp\n");
return NULL;
}
- LM_DBG("cloned root xavp [%.*s]\n", xold->name.len, xold->name.s);
+ LM_DBG("cloned root xavp [%.*s] >> [%.*s]\n", xold->name.len, xold->name.s, dst_name->len, dst_name->s);
if(xold->val.type!=SR_XTYPE_XAVP)
{
diff --git a/src/core/xavp.h b/src/core/xavp.h
index 071a421a4a..85c4bb3a3d 100644
--- a/src/core/xavp.h
+++ b/src/core/xavp.h
@@ -102,6 +102,7 @@ sr_xavp_t *xavp_extract(str *name, sr_xavp_t **list);
void xavp_print_list(sr_xavp_t **head);
sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold);
+sr_xavp_t *xavp_clone_level_nodata_with_new_name(sr_xavp_t *xold, str *dst_name);
sr_xavp_t* xavp_get_child(str *rname, str *cname);
sr_xavp_t* xavp_get_child_with_ival(str *rname, str *cname);
More information about the sr-dev
mailing list