[asterisk-commits] eliel: branch eliel/data_retrieval r183643 - /team/eliel/data_retrieval/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Mar 21 14:16:41 CDT 2009
Author: eliel
Date: Sat Mar 21 14:16:38 2009
New Revision: 183643
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183643
Log:
Fix the way the references are being handled.
Modified:
team/eliel/data_retrieval/main/data.c
Modified: team/eliel/data_retrieval/main/data.c
URL: http://svn.digium.com/svn-view/asterisk/team/eliel/data_retrieval/main/data.c?view=diff&rev=183643&r1=183642&r2=183643
==============================================================================
--- team/eliel/data_retrieval/main/data.c (original)
+++ team/eliel/data_retrieval/main/data.c Sat Mar 21 14:16:38 2009
@@ -183,7 +183,11 @@
/*!
* \internal
- * \brief
+ * \brief Find a child node, based on his name.
+ * \param parent Where to find the node.
+ * \param name The node name to find.
+ * \retval NULL if a node wasn't found.
+ * \retval The node found.
*/
static struct data_node *data_find_child(struct ao2_container *parent, const char *name)
{
@@ -233,8 +237,13 @@
if (!child->read && rpath) {
data_nodes_release(child->children, rpath);
}
- ast_log(LOG_ERROR, "RELEASING NODE %s (%d)\n", child->name, ao2_ref(child, 0));
- ao2_ref(child, -2);
+
+ if (ao2_ref(child, 0) == 2) {
+ ao2_unlink(parent, child);
+ ao2_ref(child, -1);
+ } else {
+ ao2_ref(child, -2);
+ }
return 0;
}
@@ -264,10 +273,7 @@
child = data_find_child(parent, node_name);
if (!child) {
- ast_log(LOG_ERROR, "CREATING NODE %s\n", node_name);
child = data_node_add_child(parent, node_name);
- } else {
- ast_log(LOG_ERROR, "ENTERING NODE %s => %d\n", node_name, ao2_ref(child, 0));
}
if (rpath) {
@@ -339,7 +345,5 @@
ast_data_register("asterisk/pepe/prueba", test_data_provider);
ast_data_unregister("asterisk/pepe/prueba");
- ast_log(LOG_ERROR, "RES = %d\n", ao2_container_count(root_data));
-
return 0;
}
More information about the asterisk-commits
mailing list