[asterisk-commits] eliel: branch group/data_api_gsoc2009 r205981 - in /team/group/data_api_gsoc2...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 10 15:51:53 CDT 2009
Author: eliel
Date: Fri Jul 10 15:51:48 2009
New Revision: 205981
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205981
Log:
Fix the way the tree if being formatted inside the app_queue callback.
Modified:
team/group/data_api_gsoc2009/apps/app_queue.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=205981&r1=205980&r2=205981
==============================================================================
--- team/group/data_api_gsoc2009/apps/app_queue.c (original)
+++ team/group/data_api_gsoc2009/apps/app_queue.c Fri Jul 10 15:51:48 2009
@@ -7422,10 +7422,10 @@
struct ao2_iterator i, im;
struct call_queue *queue;
struct member *member;
- struct ast_data *res, *q, *m;
-
- res = ast_data_create("queues");
- if (!res) {
+ struct ast_data *data_root, *data_queue, *data_member, *data_members;
+
+ data_root = ast_data_create("queues");
+ if (!data_root) {
return NULL;
}
@@ -7433,19 +7433,19 @@
while ((queue = ao2_iterator_next(&i))) {
ao2_lock(queue);
- q = ast_data_add_node(res, "queue");
- if (!q) {
+ data_queue = ast_data_add_node(data_root, "queue");
+ if (!data_queue) {
ao2_unlock(queue);
queue_unref(queue);
continue;
}
- ast_data_add_structure(q, data_structure_call_queue,
+ ast_data_add_structure(data_queue, data_structure_call_queue,
ARRAY_LEN(data_structure_call_queue), queue);
if (queue->members) {
- m = ast_data_add_node(res, "members");
- if (!m) {
+ data_members = ast_data_add_node(data_queue, "members");
+ if (!data_members) {
ao2_unlock(queue);
queue_unref(queue);
continue;
@@ -7453,7 +7453,13 @@
im = ao2_iterator_init(queue->members, 0);
while ((member = ao2_iterator_next(&im))) {
- ast_data_add_structure(m, data_structure_member,
+ data_member = ast_data_add_node(data_members, "member");
+ if (!data_member) {
+ ao2_ref(member, -1);
+ continue;
+ }
+
+ ast_data_add_structure(data_member, data_structure_member,
ARRAY_LEN(data_structure_member), member);
ao2_ref(member, -1);
}
@@ -7463,7 +7469,7 @@
queue_unref(queue);
}
- return res;
+ return data_root;
}
static const struct ast_data_handler queues_data_provider = {
@@ -7472,7 +7478,7 @@
};
static const struct ast_data_entry queue_data_providers[] = {
- AST_DATA_ENTRY("asterisk/application/queue", &queues_data_provider),
+ AST_DATA_ENTRY("asterisk/application/app_queue", &queues_data_provider),
};
static int unload_module(void)
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=205981&r1=205980&r2=205981
==============================================================================
--- team/group/data_api_gsoc2009/tests/test_data.c (original)
+++ team/group/data_api_gsoc2009/tests/test_data.c Fri Jul 10 15:51:48 2009
@@ -214,7 +214,7 @@
FILE *outfile;
struct ast_data_query query = {
.version = AST_DATA_QUERY_VERSION,
- .path = "asterisk",
+ .path = "asterisk/application/app_queue",
};
switch (cmd) {
More information about the asterisk-commits
mailing list