[Freeswitch-svn] [commit] r8907 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Mon Jul 7 13:36:47 EDT 2008


Author: anthm
Date: Mon Jul  7 13:36:47 2008
New Revision: 8907

Modified:
   freeswitch/trunk/src/include/switch_xml.h
   freeswitch/trunk/src/switch_xml.cpp

Log:
add switch_xml_unbind_search_function_ptr

Modified: freeswitch/trunk/src/include/switch_xml.h
==============================================================================
--- freeswitch/trunk/src/include/switch_xml.h	(original)
+++ freeswitch/trunk/src/include/switch_xml.h	Mon Jul  7 13:36:47 2008
@@ -362,6 +362,7 @@
 																		  switch_xml_section_t sections, void *user_data, switch_xml_binding_t **binding);
 
 SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function(switch_xml_binding_t **binding);
+SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function_ptr(switch_xml_search_function_t function);
 
 ///\brief parse a string for a list of sections
 ///\param str a | delimited list of section names

Modified: freeswitch/trunk/src/switch_xml.cpp
==============================================================================
--- freeswitch/trunk/src/switch_xml.cpp	(original)
+++ freeswitch/trunk/src/switch_xml.cpp	Mon Jul  7 13:36:47 2008
@@ -166,6 +166,28 @@
 	return status;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function_ptr(switch_xml_search_function_t function)
+{
+	switch_xml_binding_t *ptr, *last = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	switch_mutex_lock(XML_LOCK);
+	for (ptr = BINDINGS; ptr; ptr = ptr->next) {
+		if (ptr->function == function) {
+			if (last) {
+				last->next = ptr->next;
+			} else {
+				BINDINGS = ptr->next;
+			}
+			status = SWITCH_STATUS_SUCCESS;
+		}
+		last = ptr;
+	}
+	switch_mutex_unlock(XML_LOCK);
+
+	return status;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function(switch_xml_search_function_t function, switch_xml_section_t sections, void *user_data)
 {
 	switch_xml_binding_t *binding = NULL, *ptr = NULL;



More information about the Freeswitch-svn mailing list