Module: kamailio
Branch: master
Commit: 02b168d34786c363c6b5ce5a5e885c419f7de9e4
URL: 
https://github.com/kamailio/kamailio/commit/02b168d34786c363c6b5ce5a5e885c419f7de9e4

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2020-04-02T11:26:52+02:00

core: function to remove an xavu child value

---

Modified: src/core/xavp.c
Modified: src/core/xavp.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/02b168d34786c363c6b5ce5a5e885c419f7de9e4.diff
Patch: 
https://github.com/kamailio/kamailio/commit/02b168d34786c363c6b5ce5a5e885c419f7de9e4.patch

---

diff --git a/src/core/xavp.c b/src/core/xavp.c
index 12c52512fd..dc60fffd0a 100644
--- a/src/core/xavp.c
+++ b/src/core/xavp.c
@@ -1258,6 +1258,21 @@ int xavu_rm_by_name(str *name, sr_xavp_t **head)
        return 0;
 }
 
+/**
+ *
+ */
+int xavu_rm_child_by_name(str *rname, str *cname)
+{
+       sr_xavp_t *avu=NULL;
+
+       avu = xavu_lookup(rname, NULL);
+
+       if(avu == NULL || avu->val.type!=SR_XTYPE_XAVP) {
+               return 0;
+       }
+       return xavu_rm_by_name(cname, &avu->val.v.xavp);
+}
+
 /**
  *
  */
diff --git a/src/core/xavp.h b/src/core/xavp.h
index 66addbfff8..9145497d05 100644
--- a/src/core/xavp.h
+++ b/src/core/xavp.h
@@ -124,6 +124,7 @@ sr_xavp_t *xavu_get(str *name, sr_xavp_t *start);
 sr_xavp_t *xavu_lookup(str *name, sr_xavp_t **start);
 int xavu_rm(sr_xavp_t *xa, sr_xavp_t **head);
 int xavu_rm_by_name(str *name, sr_xavp_t **head);
+int xavu_rm_child_by_name(str *rname, str *cname);
 sr_xavp_t *xavu_set_xval(str *name, sr_xval_t *val, sr_xavp_t **list);
 sr_xavp_t *xavu_set_ival(str *rname, int ival);
 sr_xavp_t *xavu_set_sval(str *rname, str *sval);


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to