#endif
{
_dbus_connection_ref_unlocked (connection);
- _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+ _dbus_verbose ("unlock\n");
_dbus_connection_unlock (connection);
}
if (tree->connection)
#endif
{
- _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("unlock\n");
_dbus_connection_unlock (tree->connection);
}
if (tree->connection)
#endif
{
- _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("unlock\n");
_dbus_connection_unlock (tree->connection);
}
{
if (!already_unlocked)
{
- _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+ _dbus_verbose ("unlock\n");
_dbus_connection_unlock (tree->connection);
}
}
*/
DBusHandlerResult
_dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree,
- DBusMessage *message)
+ DBusMessage *message,
+ dbus_bool_t *found_object)
{
char **path;
dbus_bool_t exact_match;
if (tree->connection)
#endif
{
- _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+ _dbus_verbose ("unlock\n");
_dbus_connection_unlock (tree->connection);
}
if (tree->connection)
#endif
{
- _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+ _dbus_verbose ("unlock\n");
_dbus_connection_unlock (tree->connection);
}
/* Find the deepest path that covers the path in the message */
subtree = find_handler (tree, (const char**) path, &exact_match);
+ if (found_object)
+ *found_object = !!subtree;
+
/* Build a list of all paths that cover the path in the message */
list = NULL;
if (tree->connection)
#endif
{
- _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+ _dbus_verbose ("unlock\n");
_dbus_connection_unlock (tree->connection);
}
if (tree->connection)
#endif
{
- _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+ _dbus_verbose ("unlock\n");
_dbus_connection_unlock (tree->connection);
}
}
if ((subtree == NULL) || !exact_match)
{
- _dbus_verbose ("%s: No object at specified path found\n",
- _DBUS_FUNCTION_NAME);
+ _dbus_verbose ("No object at specified path found\n");
return NULL;
}
len = strlen (name);
- subtree = dbus_malloc (MAX (front_padding + (len + 1), sizeof (DBusObjectSubtree)));
+ subtree = dbus_malloc0 (MAX (front_padding + (len + 1), sizeof (DBusObjectSubtree)));
if (subtree == NULL)
return NULL;
}
subtree->user_data = user_data;
- subtree->refcount.value = 1;
+ _dbus_atomic_inc (&subtree->refcount);
subtree->subtrees = NULL;
subtree->n_subtrees = 0;
subtree->max_subtrees = 0;
static DBusObjectSubtree *
_dbus_object_subtree_ref (DBusObjectSubtree *subtree)
{
- _dbus_assert (subtree->refcount.value > 0);
+#ifdef DBUS_DISABLE_ASSERT
_dbus_atomic_inc (&subtree->refcount);
+#else
+ dbus_int32_t old_value;
+
+ old_value = _dbus_atomic_inc (&subtree->refcount);
+ _dbus_assert (old_value > 0);
+#endif
return subtree;
}
static void
_dbus_object_subtree_unref (DBusObjectSubtree *subtree)
{
- _dbus_assert (subtree->refcount.value > 0);
+ dbus_int32_t old_value;
+
+ old_value = _dbus_atomic_dec (&subtree->refcount);
+ _dbus_assert (old_value > 0);
- if (_dbus_atomic_dec (&subtree->refcount) == 1)
+ if (old_value == 1)
{
_dbus_assert (subtree->unregister_function == NULL);
_dbus_assert (subtree->message_function == NULL);
if (tree->connection)
#endif
{
- _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+ _dbus_verbose ("unlock\n");
_dbus_connection_unlock (tree->connection);
}
int i, j, comp;
_dbus_assert (data != NULL);
+ _dbus_assert (path != NULL);
#if VERBOSE_DECOMPOSE
_dbus_verbose ("Decomposing path \"%s\"\n",
i = 0;
while (i < len)
{
+ _dbus_assert (data[i] != '\0');
if (data[i] == '/')
n_components += 1;
++i;
++j;
}
- result = _dbus_object_tree_dispatch_and_unlock (tree, message);
+ result = _dbus_object_tree_dispatch_and_unlock (tree, message, NULL);
if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
goto oom;