[asterisk-commits] eliel: branch group/data_api_gsoc2009 r210752 - /team/group/data_api_gsoc2009...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 5 19:22:56 CDT 2009


Author: eliel
Date: Wed Aug  5 19:22:52 2009
New Revision: 210752

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=210752
Log:
Fix an issue in the filtering mechanism.


Modified:
    team/group/data_api_gsoc2009/main/data.c

Modified: team/group/data_api_gsoc2009/main/data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/main/data.c?view=diff&rev=210752&r1=210751&r2=210752
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Wed Aug  5 19:22:52 2009
@@ -1648,11 +1648,11 @@
 	const struct ast_data_search *search,
 	const struct data_filter *filter)
 {
-	struct ast_data *generated = NULL, *node;
+	struct ast_data *generated, *node;
 	struct ao2_iterator i;
 	struct data_provider *provider;
 	struct ast_data_search *search_child = NULL;
-	struct data_filter *filter_child = NULL;
+	struct data_filter *filter_child;
 
 	node = data_result_create(parent_node_name);
 	if (!node) {
@@ -1666,15 +1666,9 @@
 
 	/* if this is a terminal node, just run the callback function. */
 	if (root_provider->handler && root_provider->handler->get) {
-		if (filter) {
-			filter_child = data_filter_find(filter->children, node->name);
-		}
-		node->filter = filter_child;
+		node->filter = filter;
 		root_provider->handler->get(search, node);
 		ast_module_unref(root_provider->module);
-		if (filter_child) {
-			ao2_ref(filter_child, -1);
-		}
 		return node;
 	}
 
@@ -1685,6 +1679,9 @@
 	/* if this is not a terminal node, generate every child node. */
 	i = ao2_iterator_init(root_provider->children, 0);
 	while ((provider = ao2_iterator_next(&i))) {
+		filter_child = NULL;
+		generated = NULL;
+
 		/* get the internal search node. */
 		if (search) {
 			search_child = data_search_find(search->children, provider->name);
@@ -1693,6 +1690,7 @@
 		if (filter) {
 			filter_child = data_filter_find(filter->children, provider->name);
 		}
+
 		if (!filter || filter_child) {
 			/* only generate the internal node, if we have something to
 			 * generate based on the filtering string. */
@@ -1700,6 +1698,7 @@
 				provider->name,
 				search_child, filter_child);
 		}
+
 		/* decrement the refcount of the internal search node. */
 		if (search_child) {
 			ao2_ref(search_child, -1);
@@ -1790,7 +1789,7 @@
 	}
 
 	result = data_result_generate_node(query, provider_child, provider_child->name,
-			search_child, filter);
+			search_child, filter_child);
 
 	/* release the requested provider. */
 	ao2_ref(provider_child, -1);




More information about the asterisk-commits mailing list