diff options
author | Ross Burton <ross@linux.intel.com> | 2008-11-17 16:42:21 +0000 |
---|---|---|
committer | Ross Burton <ross@linux.intel.com> | 2008-11-17 16:42:21 +0000 |
commit | bcb3b08767a99ab46eeb49e4c5d2f0f2adb4532d (patch) | |
tree | b724b2df6cd71a4980de9a2829789f9484fb1c4b /rest/rest-xml-parser.c | |
parent | 2b1f5a39fc03ba3bd8aec5cf50e7e678646920b3 (diff) | |
download | librest-bcb3b08767a99ab46eeb49e4c5d2f0f2adb4532d.tar.gz |
Use static GQueues in rest_xml_node_find
Diffstat (limited to 'rest/rest-xml-parser.c')
-rw-r--r-- | rest/rest-xml-parser.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/rest/rest-xml-parser.c b/rest/rest-xml-parser.c index 597d0f0..87555e5 100644 --- a/rest/rest-xml-parser.c +++ b/rest/rest-xml-parser.c @@ -164,24 +164,22 @@ rest_xml_node_find (RestXmlNode *start, { RestXmlNode *node; RestXmlNode *tmp; - GQueue *stack; + GQueue stack = G_QUEUE_INIT; GList *children, *l; - stack = g_queue_new (); - g_queue_push_head (stack, start); + g_queue_push_head (&stack, start); - while ((node = g_queue_pop_head (stack)) != NULL) + while ((node = g_queue_pop_head (&stack)) != NULL) { if ((tmp = g_hash_table_lookup (node->children, tag)) != NULL) { - g_queue_free (stack); return tmp; } children = g_hash_table_get_values (node->children); for (l = children; l; l = l->next) { - g_queue_push_head (stack, l->data); + g_queue_push_head (&stack, l->data); } g_list_free (children); } |