[sr-dev] git:andrei/rve_f_params: core: pvapi: added pv_spec_free_contents()

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Aug 5 23:07:01 CEST 2010


Module: sip-router
Branch: andrei/rve_f_params
Commit: b4f455f834e621c58c0750660b9e63ccbb01f695
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b4f455f834e621c58c0750660b9e63ccbb01f695

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu Aug  5 22:38:24 2010 +0200

core: pvapi: added pv_spec_free_contents()

Added pv_spec_free_contents() that behaves like pv_spec_free(),
but frees only the contents of the pv_spec and not the pv_spec
itself (good for cleaning up pv_specs that are part of other
structures).

---

 pvapi.c |   16 +++++++++++++---
 pvar.h  |    1 +
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/pvapi.c b/pvapi.c
index 72024cd..7610534 100644
--- a/pvapi.c
+++ b/pvapi.c
@@ -1075,15 +1075,25 @@ error:
 	return NULL;
 }
 
+
+
+/** frees only the contests of a pv_spec_t. */
+void pv_spec_free_contents(pv_spec_t *spec)
+{
+	/* TODO: free name if it is PV */
+	if(spec->trans)
+		tr_free((trans_t*)spec->trans);
+}
+
+
+
 /**
  *
  */
 void pv_spec_free(pv_spec_t *spec)
 {
 	if(spec==0) return;
-	/* TODO: free name if it is PV */
-	if(spec->trans)
-		tr_free((trans_t*)spec->trans);
+	pv_spec_free_contents(spec);
 	pkg_free(spec);
 }
 
diff --git a/pvar.h b/pvar.h
index 19b9310..b1a5cfa 100644
--- a/pvar.h
+++ b/pvar.h
@@ -175,6 +175,7 @@ int pv_printf(struct sip_msg* msg, pv_elem_p list, char *buf, int *len);
 int pv_elem_free_all(pv_elem_p log);
 void pv_value_destroy(pv_value_t *val);
 void pv_spec_free(pv_spec_t *spec);
+void pv_spec_free_contents(pv_spec_t* spec);
 int pv_spec_dbg(pv_spec_p sp);
 int pv_get_spec_index(struct sip_msg* msg, pv_param_p ip, int *idx, int *flags);
 int pv_get_avp_name(struct sip_msg* msg, pv_param_p ip, int_str *avp_name,




More information about the sr-dev mailing list