[svn-commits] eliel: branch group/data_api_gsoc2009 r210555 - in /team/group/data_api_gsoc2...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 5 09:58:07 CDT 2009


Author: eliel
Date: Wed Aug  5 09:58:03 2009
New Revision: 210555

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=210555
Log:
Hide to the callback the filtering mechanism.


Modified:
    team/group/data_api_gsoc2009/apps/app_queue.c
    team/group/data_api_gsoc2009/include/asterisk/channel.h
    team/group/data_api_gsoc2009/include/asterisk/data.h
    team/group/data_api_gsoc2009/main/channel.c
    team/group/data_api_gsoc2009/main/data.c
    team/group/data_api_gsoc2009/tests/test_data.c

Modified: team/group/data_api_gsoc2009/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/apps/app_queue.c?view=diff&rev=210555&r1=210554&r2=210555
==============================================================================
--- team/group/data_api_gsoc2009/apps/app_queue.c (original)
+++ team/group/data_api_gsoc2009/apps/app_queue.c Wed Aug  5 09:58:03 2009
@@ -7540,7 +7540,6 @@
  * \param[in] queue The queue to add.
  */
 static void queues_data_provider_get_helper(const struct ast_data_search *search,
-	const struct ast_data_filter *filter,
 	struct ast_data *data_root, struct call_queue *queue)
 {
 	int member_notmatch, caller_notmatch, caller_channel_notmatch;
@@ -7556,12 +7555,12 @@
 		return;
 	}
 
-	data_queue = ast_data_add_node(filter, data_root, "queue");
+	data_queue = ast_data_add_node(data_root, "queue");
 	if (!data_queue) {
 		return;
 	}
 
-	ast_data_add_structure(filter, call_queue, data_queue, queue);
+	ast_data_add_structure(call_queue, data_queue, queue);
 
 	member_notmatch = ast_data_search_has_condition(search, "queue/members/member");
 	/* add queue members */
@@ -7574,20 +7573,20 @@
 		}
 
 		if (!data_members) {
-			data_members = ast_data_add_node(filter, data_queue, "members");
+			data_members = ast_data_add_node(data_queue, "members");
 			if (!data_members) {
 				ao2_ref(member, -1);
 				continue;
 			}
 		}
 
-		data_member = ast_data_add_node(filter, data_members, "member");
+		data_member = ast_data_add_node(data_members, "member");
 		if (!data_member) {
 			ao2_ref(member, -1);
 			continue;
 		}
 
-		ast_data_add_structure(filter, member, data_member, member);
+		ast_data_add_structure(member, data_member, member);
 
 		ao2_ref(member, -1);
 	}
@@ -7615,26 +7614,26 @@
 			}
 
 			if (!data_callers) {
-				data_callers = ast_data_add_node(filter, data_queue, "callers");
+				data_callers = ast_data_add_node(data_queue, "callers");
 				if (!data_callers) {
 					continue;
 				}
 			}
 
-			data_caller = ast_data_add_node(filter, data_callers, "caller");
+			data_caller = ast_data_add_node(data_callers, "caller");
 			if (!data_caller) {
 				continue;
 			}
 
-			ast_data_add_structure(filter, queue_ent, data_caller, qe);
+			ast_data_add_structure(queue_ent, data_caller, qe);
 
 			/* add the caller channel. */
-			data_caller_channel = ast_data_add_node(filter, data_caller, "channel");
+			data_caller_channel = ast_data_add_node(data_caller, "channel");
 			if (!data_caller_channel) {
 				continue;
 			}
 
-			ast_channel_data_add_structure(filter, data_caller_channel, qe->chan);
+			ast_channel_data_add_structure(data_caller_channel, qe->chan);
 		}
 	}
 
@@ -7652,7 +7651,6 @@
  * \retval non-NULL The generated tree.
  */
 static int queues_data_provider_get(const struct ast_data_search *search,
-	const struct ast_data_filter *filter,
 	struct ast_data *data_root)
 {
 	struct ao2_iterator i;
@@ -7685,7 +7683,7 @@
 			queue_unref(queue_realtime);
 		}
 
-		queues_data_provider_get_helper(search, filter, data_root, queue);
+		queues_data_provider_get_helper(search, data_root, queue);
 		ao2_unlock(queue);
 		queue_unref(queue);
 	}

Modified: team/group/data_api_gsoc2009/include/asterisk/channel.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/include/asterisk/channel.h?view=diff&rev=210555&r1=210554&r2=210555
==============================================================================
--- team/group/data_api_gsoc2009/include/asterisk/channel.h (original)
+++ team/group/data_api_gsoc2009/include/asterisk/channel.h Wed Aug  5 09:58:03 2009
@@ -2671,14 +2671,12 @@
 
 /*!
  * \brief Insert into an astdata tree, the channel structure.
- * \param[in] filter The filtering tree.
  * \param[in] tree The ast data tree.
  * \param[in] chan The channel structure to add to tree.
  * \retval <0 on error.
  * \retval 0 on success.
  */
-int ast_channel_data_add_structure(const struct ast_data_filter *filter,
-	struct ast_data *tree, struct ast_channel *chan);
+int ast_channel_data_add_structure(struct ast_data *tree, struct ast_channel *chan);
 
 /*!
  * \brief Compare to channel structures using the data api.

Modified: team/group/data_api_gsoc2009/include/asterisk/data.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/include/asterisk/data.h?view=diff&rev=210555&r1=210554&r2=210555
==============================================================================
--- team/group/data_api_gsoc2009/include/asterisk/data.h (original)
+++ team/group/data_api_gsoc2009/include/asterisk/data.h Wed Aug  5 09:58:03 2009
@@ -101,9 +101,6 @@
 /*! \brief opaque definition of an ast_data_search structure. */
 struct ast_data_search;
 
-/*! \brief opaque definition of an ast_data_filter structure. */
-struct ast_data_filter;
-
 /*! \brief structure retrieved from a node, with the nodes content. */
 struct ast_data_retrieve {
 	enum ast_data_type type;
@@ -121,7 +118,6 @@
 };
 
 typedef int (*ast_data_get_cb)(const struct ast_data_search *search,
-	const struct ast_data_filter *filter,
 	struct ast_data *root);
 typedef int *(*ast_data_put_cb)(void);
 
@@ -435,108 +431,91 @@
 
 /*!
  * \brief Add a container child.
- * \param[in] filter The filtering tree.
- * \param[in] root The root of the ast_data to insert into.
- * \param[in] childname The name of the child element to be added.
- * \retval NULL on error (memory exhaustion only).
- * \retval non-NULL a newly allocated node.
- */
-struct ast_data *ast_data_add_node(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname);
+ * \param[in] root The root of the ast_data to insert into.
+ * \param[in] childname The name of the child element to be added.
+ * \retval NULL on error (memory exhaustion only).
+ * \retval non-NULL a newly allocated node.
+ */
+struct ast_data *ast_data_add_node(struct ast_data *root, const char *childname);
 
 /*!
  * \brief Add an integer node type.
- * \param[in] filter The filtering tree.
  * \param[in] root The root of the ast_data to insert into.
  * \param[in] childname The name of the child element to be added.
  * \param[in] value The value for the new node.
  * \retval NULL on error (memory exhaustion only).
  * \retval non-NULL a newly allocated node.
  */
-struct ast_data *ast_data_add_int(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+struct ast_data *ast_data_add_int(struct ast_data *root, const char *childname,
 	int value);
 
 /*!
  * \brief Add an unsigned integer node type.
- * \param[in] filter The filtering tree.
  * \param[in] root The root of the ast_data to insert into.
  * \param[in] childname The name of the child element to be added.
  * \param[in] value The value for the new node.
  * \retval NULL on error (memory exhaustion only).
  * \retval non-NULL a newly allocated node.
  */
-struct ast_data *ast_data_add_uint(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+struct ast_data *ast_data_add_uint(struct ast_data *root, const char *childname,
 	unsigned int value);
 
 /*!
  * \brief Add a floating point node type.
- * \param[in] filter The filtering tree.
  * \param[in] root The root of the ast_data to insert into.
  * \param[in] childname The name of the child element to be added.
  * \param[in] dbl The value for the new node.
  * \retval NULL on error (memory exhaustion only).
  * \retval non-NULL a newly allocated node.
  */
-struct ast_data *ast_data_add_dbl(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+struct ast_data *ast_data_add_dbl(struct ast_data *root, const char *childname,
 	double dbl);
 /*!
  * \brief Add a ipv4 address type.
- * \param[in] filter The filtering tree.
  * \param[in] root The root of the ast_data to insert into.
  * \param[in] childname The name of the child element to be added.
  * \param[in] addr The ipv4 address value.
  * \retval NULL on error (memory exhaustion only).
  * \retval non-NULL a newly allocated node.
  */
-struct ast_data *ast_data_add_ipaddr(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+struct ast_data *ast_data_add_ipaddr(struct ast_data *root, const char *childname,
 	struct in_addr addr);
 
 /*!
  * \brief Add a ptr node type.
- * \param[in] filter The filtering tree.
  * \param[in] root The root of the ast_data to insert into.
  * \param[in] childname The name of the child element to be added.
  * \param[in] ptr The pointer value to add.
  * \retval NULL on error (memory exhaustion only).
  * \retval non-NULL a newly allocated node.
  */
-struct ast_data *ast_data_add_ptr(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+struct ast_data *ast_data_add_ptr(struct ast_data *root, const char *childname,
 	void *ptr);
 
 /*!
  * \brief Add a string node type.
- * \param[in] filter The filtering tree.
  * \param[in] root The root of the ast_data to insert into.
  * \param[in] childname The name of the child element to be added.
  * \param[in] value The value for the new node.
  * \retval NULL on error (memory exhaustion only).
  * \retval non-NULL a newly allocated node.
  */
-struct ast_data *ast_data_add_str(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+struct ast_data *ast_data_add_str(struct ast_data *root, const char *childname,
 	const char *string);
 
 /*!
  * \brief Add a boolean node type.
- * \param[in] filter The filtering tree.
  * \param[in] root The root of the ast_data to insert into.
  * \param[in] childname The name of the child element to be added.
  * \param[in] value The value for the new node.
  * \retval NULL on error (memory exhaustion only).
  * \retval non-NULL a newly allocated node.
  */
-struct ast_data *ast_data_add_bool(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+struct ast_data *ast_data_add_bool(struct ast_data *root, const char *childname,
 	unsigned int boolean);
 
 /*!
  * \brief Add a complete structure to a node.
- * \param[in] filter The filtering tree.
  * \param[in] root Where to add the structure.
  * \param[in] mapping The structure mapping array.
  * \param[in] mapping_len The lenght of the mapping array.
@@ -544,11 +523,11 @@
  * \retval 0 on success.
  * \retval 1 on error.
  */
-int __ast_data_add_structure(const struct ast_data_filter *filter,
-	struct ast_data *root, const struct ast_data_mapping_structure *mapping,
+int __ast_data_add_structure(struct ast_data *root,
+	const struct ast_data_mapping_structure *mapping,
 	size_t mapping_len, void *structure);
-#define ast_data_add_structure(filter, structure_name, root, structure)				\
-	__ast_data_add_structure(filter, root, __data_mapping_structure_##structure_name,	\
+#define ast_data_add_structure(structure_name, root, structure)				\
+	__ast_data_add_structure(root, __data_mapping_structure_##structure_name,	\
 		ARRAY_LEN(__data_mapping_structure_##structure_name), structure)
 
 /*!

Modified: team/group/data_api_gsoc2009/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/main/channel.c?view=diff&rev=210555&r1=210554&r2=210555
==============================================================================
--- team/group/data_api_gsoc2009/main/channel.c (original)
+++ team/group/data_api_gsoc2009/main/channel.c Wed Aug  5 09:58:03 2009
@@ -257,10 +257,9 @@
 	return var;
 }
 
-int ast_channel_data_add_structure(const struct ast_data_filter *filter,
-	struct ast_data *tree, struct ast_channel *chan)
-{
-	return ast_data_add_structure(filter, ast_channel, tree, chan);
+int ast_channel_data_add_structure(struct ast_data *tree, struct ast_channel *chan)
+{
+	return ast_data_add_structure(ast_channel, tree, chan);
 }
 
 int ast_channel_data_cmp_structure(const struct ast_data_search *tree,

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=210555&r1=210554&r2=210555
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Wed Aug  5 09:58:03 2009
@@ -70,6 +70,10 @@
 		void *ptr;
 	} payload;
 
+	/*! \brief The filter node that depends on the current node,
+	 * this is used only when creating the result tree. */
+	const struct data_filter *filter;
+
 	/*! \brief The list of nodes inside this node. */
 	struct ao2_container *children;
 	/*! \brief The name of the node. */
@@ -100,7 +104,7 @@
 };
 
 /*! \brief The filter node. */
-struct ast_data_filter {
+struct data_filter {
 	/*! \brief node childrens. */
 	struct ao2_container *children;
 	/*! \brief node name. */
@@ -1433,7 +1437,7 @@
  */
 static int data_filter_hash(const void *obj, const int flags)
 {
-	const struct ast_data_filter *node = obj;
+	const struct data_filter *node = obj;
 	return ast_str_hash(node->name);
 }
 
@@ -1443,7 +1447,7 @@
  */
 static int data_filter_cmp(void *obj, void *arg, int flags)
 {
-	struct ast_data_filter *node1 = obj, *node2 = arg;
+	struct data_filter *node1 = obj, *node2 = arg;
 	return strcasecmp(node1->name, node2->name) ? 0 : CMP_MATCH;
 }
 
@@ -1454,7 +1458,7 @@
  */
 static void data_filter_destructor(void *obj)
 {
-	struct ast_data_filter *filter = obj;
+	struct data_filter *filter = obj;
 
 	ao2_ref(filter->children, -1);
 }
@@ -1465,9 +1469,9 @@
  * \retval NULL on error.
  * \retval non-NULL The allocated search node structure.
  */
-static struct ast_data_filter *data_filter_alloc(const char *name)
-{
-	struct ast_data_filter *res;
+static struct data_filter *data_filter_alloc(const char *name)
+{
+	struct data_filter *res;
 	size_t name_len = strlen(name) + 1;
 
 	res = ao2_alloc(sizeof(*res) + name_len, data_filter_destructor);
@@ -1493,7 +1497,7 @@
  * \brief Release a filter tree.
  * \param[in] filter The filter tree root node.
  */
-static void data_filter_release(struct ast_data_filter *filter)
+static void data_filter_release(struct data_filter *filter)
 {
 	ao2_ref(filter, -1);
 }
@@ -1507,10 +1511,10 @@
  * \retval The node found.
  * \note Remember to decrement the ref count of the returned node after using it.
  */
-static struct ast_data_filter *data_filter_find(struct ao2_container *parent,
+static struct data_filter *data_filter_find(struct ao2_container *parent,
 	const char *name)
 {
-	struct ast_data_filter *find_node, *found;
+	struct data_filter *find_node, *found;
 
 	find_node = data_filter_alloc(name);
 	if (!find_node) {
@@ -1532,10 +1536,10 @@
  * \param[in] name The name of the node to add.
  * \note Remember to decrement the ref count after using the returned node.
  */
-static struct ast_data_filter *data_filter_add_child(struct ao2_container *root,
+static struct data_filter *data_filter_add_child(struct ao2_container *root,
 	char *name)
 {
-	struct ast_data_filter *node;
+	struct data_filter *node;
 
 	node = data_filter_find(root, name);
 	if (node) {
@@ -1562,7 +1566,7 @@
  */
 static int data_filter_add_nodes(struct ao2_container *root, char *path)
 {
-	struct ast_data_filter *node;
+	struct data_filter *node;
 	char *savepath, *saveptr, *token, *node_name;
 	int ret = 0;
 
@@ -1597,9 +1601,9 @@
  * \brief Generate a filter list based on a filter string provided by the API user.
  * \param[in] A filter string to create a filter from.
  */
-static struct ast_data_filter *data_filter_generate(const char *constfilter)
-{
-	struct ast_data_filter *filter = NULL;
+static struct data_filter *data_filter_generate(const char *constfilter)
+{
+	struct data_filter *filter = NULL;
 	char *strfilter, *token, *saveptr;
 	int node_added = 0;
 
@@ -1640,13 +1644,13 @@
 	const struct data_provider *root_provider,
 	const char *parent_node_name,
 	const struct ast_data_search *search,
-	const struct ast_data_filter *filter)
+	const struct data_filter *filter)
 {
 	struct ast_data *generated = NULL, *node;
 	struct ao2_iterator i;
 	struct data_provider *provider;
 	struct ast_data_search *search_child = NULL;
-	struct ast_data_filter *filter_child = NULL;
+	struct data_filter *filter_child = NULL;
 
 	node = data_result_create(parent_node_name);
 	if (!node) {
@@ -1660,7 +1664,8 @@
 
 	/* if this is a terminal node, just run the callback function. */
 	if (root_provider->handler && root_provider->handler->get) {
-		root_provider->handler->get(search, filter, node);
+		node->filter = filter;
+		root_provider->handler->get(search, node);
 		ast_module_unref(root_provider->module);
 		return node;
 	}
@@ -1723,7 +1728,7 @@
 	struct data_provider *provider_child, *tmp_provider_child;
 	struct ast_data *result, *result_filtered;
 	struct ast_data_search *search = NULL, *search_child = NULL;
-	struct ast_data_filter *filter = NULL, *filter_child = NULL;
+	struct data_filter *filter = NULL, *filter_child = NULL;
 
 	if (!search_path) {
 		/* generate all the trees?. */
@@ -1952,12 +1957,11 @@
  * \retval NULL on error.
  * \retval non-NULL The added child node pointer.
  */
-static struct ast_data *__ast_data_add(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *name,
+static struct ast_data *__ast_data_add(struct ast_data *root, const char *name,
 	enum ast_data_type type, void *ptr)
 {
 	struct ast_data *node;
-	struct ast_data_filter *filter_node;
+	struct data_filter *filter, *filter_child = NULL;
 
 	if (!root || !root->children) {
 		/* invalid data result node. */
@@ -1965,12 +1969,12 @@
 	}
 
 	/* check if we need to add this node, based on the filter. */
-	if (filter) {
-		filter_node = data_filter_find(filter->children, name);
-		if (!filter_node) {
+	if (root->filter) {
+		filter = data_filter_find(root->filter->children, name);
+		if (!filter) {
 			return NULL;
 		}
-		ao2_ref(filter_node, -1);
+		ao2_ref(filter, -1);
 	}
 
 	node = data_result_create(name);
@@ -2001,6 +2005,15 @@
 		node->payload.ipaddr = *(struct in_addr *) ptr;
 		break;
 	case AST_DATA_CONTAINER:
+		if (root->filter) {
+			filter_child = data_filter_find(root->filter->children, name);
+			if (filter_child) {
+				/* do not increment the refcount because it is not neccesary. */
+				ao2_ref(filter_child, -1);
+			}
+		}
+		node->filter = filter_child;
+		break;
 	default:
 		break;
 	}
@@ -2012,55 +2025,47 @@
 	return node;
 }
 
-struct ast_data *ast_data_add_node(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *name)
-{
-	return __ast_data_add(filter, root, name, AST_DATA_CONTAINER, NULL);
-}
-
-struct ast_data *ast_data_add_int(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *name, int value)
-{
-	return __ast_data_add(filter, root, name, AST_DATA_INTEGER, &value);
-}
-
-struct ast_data *ast_data_add_uint(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *name,
+struct ast_data *ast_data_add_node(struct ast_data *root, const char *name)
+{
+	return __ast_data_add(root, name, AST_DATA_CONTAINER, NULL);
+}
+
+struct ast_data *ast_data_add_int(struct ast_data *root, const char *name, int value)
+{
+	return __ast_data_add(root, name, AST_DATA_INTEGER, &value);
+}
+
+struct ast_data *ast_data_add_uint(struct ast_data *root, const char *name,
 	unsigned int value)
 {
-	return __ast_data_add(filter, root, name, AST_DATA_UNSIGNED_INTEGER, &value);
-}
-
-struct ast_data *ast_data_add_dbl(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+	return __ast_data_add(root, name, AST_DATA_UNSIGNED_INTEGER, &value);
+}
+
+struct ast_data *ast_data_add_dbl(struct ast_data *root, const char *childname,
 	double dbl)
 {
-	return __ast_data_add(filter, root, childname, AST_DATA_DOUBLE, &dbl);
-}
-
-struct ast_data *ast_data_add_bool(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+	return __ast_data_add(root, childname, AST_DATA_DOUBLE, &dbl);
+}
+
+struct ast_data *ast_data_add_bool(struct ast_data *root, const char *childname,
 	unsigned int boolean)
 {
-	return __ast_data_add(filter, root, childname, AST_DATA_BOOLEAN, &boolean);
-}
-
-struct ast_data *ast_data_add_ipaddr(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+	return __ast_data_add(root, childname, AST_DATA_BOOLEAN, &boolean);
+}
+
+struct ast_data *ast_data_add_ipaddr(struct ast_data *root, const char *childname,
 	struct in_addr addr)
 {
-	return __ast_data_add(filter, root, childname, AST_DATA_IPADDR, &addr);
-}
-
-struct ast_data *ast_data_add_ptr(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+	return __ast_data_add(root, childname, AST_DATA_IPADDR, &addr);
+}
+
+struct ast_data *ast_data_add_ptr(struct ast_data *root, const char *childname,
 	void *ptr)
 {
-	return __ast_data_add(filter, root, childname, AST_DATA_POINTER, ptr);
-}
-
-struct ast_data *ast_data_add_str(const struct ast_data_filter *filter,
-	struct ast_data *root, const char *childname,
+	return __ast_data_add(root, childname, AST_DATA_POINTER, ptr);
+}
+
+struct ast_data *ast_data_add_str(struct ast_data *root, const char *childname,
 	const char *value)
 {
 	char *name;
@@ -2073,7 +2078,7 @@
 
 	strcpy(name, (ast_strlen_zero(value) ? "" : value));
 
-	res = __ast_data_add(filter, root, childname, AST_DATA_STRING, name);
+	res = __ast_data_add(root, childname, AST_DATA_STRING, name);
 	if (!res) {
 		ast_free(name);
 	}
@@ -2081,56 +2086,46 @@
 	return res;
 }
 
-int __ast_data_add_structure(const struct ast_data_filter *filter, struct ast_data *root,
+int __ast_data_add_structure(struct ast_data *root,
 	const struct ast_data_mapping_structure *mapping, size_t mapping_len,
 	void *structure)
 {
 	int i;
-	struct ast_data_filter *filter_child = NULL;
-
-	if (filter) {
-		filter_child = data_filter_find(filter->children, root->name);
-		if (!filter_child) {
-			return 0;
-		}
-	}
 
 	for (i = 0; i < mapping_len; i++) {
 		switch (mapping[i].type) {
 		case AST_DATA_INTEGER:
-			ast_data_add_int(filter_child, root, mapping[i].name,
+			ast_data_add_int(root, mapping[i].name,
 				mapping[i].get.AST_DATA_INTEGER(structure));
 			break;
 		case AST_DATA_UNSIGNED_INTEGER:
-			ast_data_add_uint(filter_child, root, mapping[i].name,
+			ast_data_add_uint(root, mapping[i].name,
 				mapping[i].get.AST_DATA_UNSIGNED_INTEGER(structure));
 			break;
 		case AST_DATA_DOUBLE:
-			ast_data_add_dbl(filter_child, root, mapping[i].name,
+			ast_data_add_dbl(root, mapping[i].name,
 				mapping[i].get.AST_DATA_DOUBLE(structure));
 			break;
 		case AST_DATA_BOOLEAN:
-			ast_data_add_bool(filter_child, root, mapping[i].name,
+			ast_data_add_bool(root, mapping[i].name,
 				mapping[i].get.AST_DATA_BOOLEAN(structure));
 			break;
 		case AST_DATA_STRING:
-			ast_data_add_str(filter_child, root, mapping[i].name,
+			ast_data_add_str(root, mapping[i].name,
 				mapping[i].get.AST_DATA_STRING(structure));
 			break;
 		case AST_DATA_CONTAINER:
 			break;
 		case AST_DATA_IPADDR:
-			ast_data_add_ipaddr(filter_child, root, mapping[i].name,
+			ast_data_add_ipaddr(root, mapping[i].name,
 				mapping[i].get.AST_DATA_IPADDR(structure));
 			break;
 		case AST_DATA_POINTER:
-			ast_data_add_ptr(filter_child, root, mapping[i].name,
+			ast_data_add_ptr(root, mapping[i].name,
 				mapping[i].get.AST_DATA_POINTER(structure));
 			break;
 		}
 	}
-
-	ao2_ref(filter_child, -1);
 
 	return 0;
 }

Modified: team/group/data_api_gsoc2009/tests/test_data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/tests/test_data.c?view=diff&rev=210555&r1=210554&r2=210555
==============================================================================
--- team/group/data_api_gsoc2009/tests/test_data.c (original)
+++ team/group/data_api_gsoc2009/tests/test_data.c Wed Aug  5 09:58:03 2009
@@ -56,7 +56,6 @@
 AST_DATA_STRUCTURE(test_structure, DATA_EXPORT_TEST_STRUCTURE);
 
 static int test_data_full_provider(const struct ast_data_search *search,
-	const struct ast_data_filter *filter,
 	struct ast_data *root)
 {
 	struct ast_data *test_structure;
@@ -67,19 +66,18 @@
 		.a_uint = 20
 	};
 
-	test_structure = ast_data_add_node(filter, root, "test_structure");
+	test_structure = ast_data_add_node(root, "test_structure");
 	if (!test_structure) {
 		ast_debug(1, "Internal data api error\n");
 		return 0;
 	}
 
-	ast_data_add_structure(filter, test_structure, test_structure, &local_test_structure);
+	ast_data_add_structure(test_structure, test_structure, &local_test_structure);
 
 	return 0;
 }
 
 static int test_data_null_provider(const struct ast_data_search *search,
-	const struct ast_data_filter *filter,
 	struct ast_data *root)
 {
 	return 0;




More information about the svn-commits mailing list