]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add switch_xml_unbind_search_function_ptr
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 Jul 2008 17:36:47 +0000 (17:36 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 Jul 2008 17:36:47 +0000 (17:36 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8907 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_xml.h
src/switch_xml.cpp

index 237f24969b5f375ed3dd31a31149a3c7aaf4b19e..b7493ea1bcd7059850a331189175bf42633a874b 100644 (file)
@@ -362,6 +362,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function_removable(switch
                                                                                                                                                  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
index eaaccbb066488c37636ed4a2a2edd9c40790b52f..22b4591d050f0a87c27a4294684721aeb6861b05 100644 (file)
@@ -166,6 +166,28 @@ SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function(switch_xml_bin
        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;