projects
/
platform
/
upstream
/
dbus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[lib-fix] Fixed message handling
[platform/upstream/dbus.git]
/
dbus
/
dbus-object-tree.c
diff --git
a/dbus/dbus-object-tree.c
b/dbus/dbus-object-tree.c
index
989e5d8
..
f6ae19d
100644
(file)
--- a/
dbus/dbus-object-tree.c
+++ b/
dbus/dbus-object-tree.c
@@
-503,7
+503,7
@@
unlock:
connection = tree->connection;
/* Unlock and call application code */
connection = tree->connection;
/* Unlock and call application code */
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (connection)
#endif
{
if (connection)
#endif
{
@@
-515,7
+515,7
@@
unlock:
if (unregister_function)
(* unregister_function) (connection, user_data);
if (unregister_function)
(* unregister_function) (connection, user_data);
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (connection)
#endif
dbus_connection_unref (connection);
if (connection)
#endif
dbus_connection_unref (connection);
@@
-638,7
+638,7
@@
handle_default_introspect_and_unlock (DBusObjectTree *tree,
DBUS_INTERFACE_INTROSPECTABLE,
"Introspect"))
{
DBUS_INTERFACE_INTROSPECTABLE,
"Introspect"))
{
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
{
if (tree->connection)
#endif
{
@@
-653,7
+653,7
@@
handle_default_introspect_and_unlock (DBusObjectTree *tree,
if (!_dbus_string_init (&xml))
{
if (!_dbus_string_init (&xml))
{
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
{
if (tree->connection)
#endif
{
@@
-698,7
+698,7
@@
handle_default_introspect_and_unlock (DBusObjectTree *tree,
if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &v_STRING))
goto out;
if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &v_STRING))
goto out;
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
{
if (tree->connection)
#endif
{
@@
-711,7
+711,7
@@
handle_default_introspect_and_unlock (DBusObjectTree *tree,
result = DBUS_HANDLER_RESULT_HANDLED;
out:
result = DBUS_HANDLER_RESULT_HANDLED;
out:
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
{
if (tree->connection)
#endif
{
@@
-741,6
+741,7
@@
handle_default_introspect_and_unlock (DBusObjectTree *tree,
*
* @param tree the global object tree
* @param message the message to dispatch
*
* @param tree the global object tree
* @param message the message to dispatch
+ * @param found_object return location for the object
* @returns whether message was handled successfully
*/
DBusHandlerResult
* @returns whether message was handled successfully
*/
DBusHandlerResult
@@
-762,7
+763,7
@@
_dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree,
path = NULL;
if (!dbus_message_get_path_decomposed (message, &path))
{
path = NULL;
if (!dbus_message_get_path_decomposed (message, &path))
{
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
{
if (tree->connection)
#endif
{
@@
-777,7
+778,7
@@
_dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree,
if (path == NULL)
{
if (path == NULL)
{
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
{
if (tree->connection)
#endif
{
@@
-846,7
+847,7
@@
_dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree,
_dbus_verbose (" (invoking a handler)\n");
#endif
_dbus_verbose (" (invoking a handler)\n");
#endif
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
{
if (tree->connection)
#endif
{
@@
-863,7
+864,7
@@
_dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree,
message,
user_data);
message,
user_data);
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
_dbus_connection_lock (tree->connection);
if (tree->connection)
#endif
_dbus_connection_lock (tree->connection);
@@
-886,7
+887,7
@@
_dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree,
}
else
{
}
else
{
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
{
if (tree->connection)
#endif
{
@@
-954,7
+955,7
@@
allocate_subtree_object (const char *name)
len = strlen (name);
len = strlen (name);
- subtree = dbus_malloc (MAX (front_padding + (len + 1), sizeof (DBusObjectSubtree)));
+ subtree = dbus_malloc
0
(MAX (front_padding + (len + 1), sizeof (DBusObjectSubtree)));
if (subtree == NULL)
return NULL;
if (subtree == NULL)
return NULL;
@@
-991,7
+992,7
@@
_dbus_object_subtree_new (const char *name,
}
subtree->user_data = user_data;
}
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;
subtree->subtrees = NULL;
subtree->n_subtrees = 0;
subtree->max_subtrees = 0;
@@
-1006,8
+1007,14
@@
_dbus_object_subtree_new (const char *name,
static DBusObjectSubtree *
_dbus_object_subtree_ref (DBusObjectSubtree *subtree)
{
static DBusObjectSubtree *
_dbus_object_subtree_ref (DBusObjectSubtree *subtree)
{
- _dbus_assert (subtree->refcount.value > 0);
+#ifdef DBUS_DISABLE_ASSERT
_dbus_atomic_inc (&subtree->refcount);
_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;
}
return subtree;
}
@@
-1015,9
+1022,12
@@
_dbus_object_subtree_ref (DBusObjectSubtree *subtree)
static void
_dbus_object_subtree_unref (DBusObjectSubtree *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);
{
_dbus_assert (subtree->unregister_function == NULL);
_dbus_assert (subtree->message_function == NULL);
@@
-1048,7
+1058,7
@@
_dbus_object_tree_list_registered_and_unlock (DBusObjectTree *tree,
parent_path,
child_entries);
parent_path,
child_entries);
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
if (tree->connection)
#endif
{
if (tree->connection)
#endif
{
@@
-1205,7
+1215,7
@@
flatten_path (const char **path)
}
}
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@
-1953,4
+1963,4
@@
_dbus_object_tree_test (void)
#endif /* !DOXYGEN_SHOULD_SKIP_THIS */
#endif /* !DOXYGEN_SHOULD_SKIP_THIS */
-#endif /* DBUS_
BUIL
D_TESTS */
+#endif /* DBUS_
ENABLE_EMBEDDE
D_TESTS */