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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 7 10:42:19 CDT 2009


Author: eliel
Date: Tue Jul  7 10:42:16 2009
New Revision: 205043

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205043
Log:
Pass the specific search node to the callback and not the complete
tree.


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=205043&r1=205042&r2=205043
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Tue Jul  7 10:42:16 2009
@@ -973,6 +973,7 @@
 	struct ast_data *generated, *node;
 	struct ao2_iterator i;
 	struct data_provider *provider;
+	struct ast_data_search *search_child = NULL;
 
 	node = data_result_create(parent_node_name);
 	if (!node) {
@@ -1003,7 +1004,12 @@
 	/* 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))) {
-		generated = __data_result_generate_node(query, provider, provider->name, filter, search);
+		if (search) {
+			search_child = data_search_find(search->children, provider->name);
+		}
+		generated = __data_result_generate_node(query, provider, provider->name, filter, search_child);
+		ao2_ref(search_child, -1);
+
 		if (generated) {
 			data_result_add_child(node, generated);
 			ao2_ref(generated, -1);
@@ -1046,7 +1052,7 @@
 	char *node_name, *tmp_path;
 	struct data_provider *provider_child, *tmp_provider_child;
 	struct ast_data *result;
-	struct ast_data_search *search = NULL;
+	struct ast_data_search *search = NULL, *search_child = NULL;
 
 	if (!search_path) {
 		/* generate all the trees?. */
@@ -1083,11 +1089,14 @@
 
 	if (query->search) {
 		search = data_search_parse(query->search);
-	}
-
-	result = data_result_generate_node(query, provider_child, provider_child->name, search);
+		search_child = data_search_find(search->children, provider_child->name);
+	}
+
+	result = data_result_generate_node(query, provider_child, provider_child->name, search_child);
 
 	ao2_ref(provider_child, -1);
+
+	ao2_ref(search_child, -1);
 
 	if (search) {
 		data_search_release(search);




More information about the asterisk-commits mailing list