Browse code

core: function to remove an xavu child value

Daniel-Constantin Mierla authored on 02/04/2020 09:26:52
Showing 2 changed files
... ...
@@ -1258,6 +1258,21 @@ int xavu_rm_by_name(str *name, sr_xavp_t **head)
1258 1258
 	return 0;
1259 1259
 }
1260 1260
 
1261
+/**
1262
+ *
1263
+ */
1264
+int xavu_rm_child_by_name(str *rname, str *cname)
1265
+{
1266
+	sr_xavp_t *avu=NULL;
1267
+
1268
+	avu = xavu_lookup(rname, NULL);
1269
+
1270
+	if(avu == NULL || avu->val.type!=SR_XTYPE_XAVP) {
1271
+		return 0;
1272
+	}
1273
+	return xavu_rm_by_name(cname, &avu->val.v.xavp);
1274
+}
1275
+
1261 1276
 /**
1262 1277
  *
1263 1278
  */
... ...
@@ -124,6 +124,7 @@ sr_xavp_t *xavu_get(str *name, sr_xavp_t *start);
124 124
 sr_xavp_t *xavu_lookup(str *name, sr_xavp_t **start);
125 125
 int xavu_rm(sr_xavp_t *xa, sr_xavp_t **head);
126 126
 int xavu_rm_by_name(str *name, sr_xavp_t **head);
127
+int xavu_rm_child_by_name(str *rname, str *cname);
127 128
 sr_xavp_t *xavu_set_xval(str *name, sr_xval_t *val, sr_xavp_t **list);
128 129
 sr_xavp_t *xavu_set_ival(str *rname, int ival);
129 130
 sr_xavp_t *xavu_set_sval(str *rname, str *sval);