From 28a418ad5de4f76a0b9202588152cac4a73edd61 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Fri, 11 Mar 2005 18:15:25 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'dbus-0.23.4'. --- dbus/dbus-object-tree.c | 459 ++++++++---------------------------------------- 1 file changed, 69 insertions(+), 390 deletions(-) (limited to 'dbus/dbus-object-tree.c') diff --git a/dbus/dbus-object-tree.c b/dbus/dbus-object-tree.c index 1d6029af..f4fa82d4 100644 --- a/dbus/dbus-object-tree.c +++ b/dbus/dbus-object-tree.c @@ -1,7 +1,7 @@ /* -*- mode: C; c-file-style: "gnu" -*- */ /* dbus-object-tree.c DBusObjectTree (internals of DBusConnection) * - * Copyright (C) 2003, 2005 Red Hat Inc. + * Copyright (C) 2003 Red Hat Inc. * * Licensed under the Academic Free License version 2.1 * @@ -462,7 +462,7 @@ _dbus_object_tree_unregister_and_unlock (DBusObjectTree *tree, _dbus_warn ("Attempted to unregister path (path[0] = %s path[1] = %s) which isn't registered\n", path[0] ? path[0] : "null", path[1] ? path[1] : "null"); - goto unlock; + goto unlock; } #else _dbus_assert (subtree != NULL); @@ -507,7 +507,6 @@ unlock: #endif { _dbus_connection_ref_unlocked (connection); - _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME); _dbus_connection_unlock (connection); } @@ -612,56 +611,22 @@ _dbus_object_tree_list_registered_unlocked (DBusObjectTree *tree, } static DBusHandlerResult -handle_default_introspect_and_unlock (DBusObjectTree *tree, - DBusMessage *message, - const char **path) +handle_default_introspect_unlocked (DBusObjectTree *tree, + DBusMessage *message, + const char **path) { DBusString xml; DBusHandlerResult result; char **children; int i; - DBusMessage *reply; - DBusMessageIter iter; - const char *v_STRING; - dbus_bool_t already_unlocked; - /* We have the connection lock here */ - - already_unlocked = FALSE; - - _dbus_verbose (" considering default Introspect() handler...\n"); - - reply = NULL; - if (!dbus_message_is_method_call (message, - DBUS_INTERFACE_INTROSPECTABLE, + DBUS_INTERFACE_ORG_FREEDESKTOP_INTROSPECTABLE, "Introspect")) - { -#ifdef DBUS_BUILD_TESTS - if (tree->connection) -#endif - { - _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__); - _dbus_connection_unlock (tree->connection); - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - _dbus_verbose (" using default Introspect() handler!\n"); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; if (!_dbus_string_init (&xml)) - { -#ifdef DBUS_BUILD_TESTS - if (tree->connection) -#endif - { - _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__); - _dbus_connection_unlock (tree->connection); - } - - return DBUS_HANDLER_RESULT_NEED_MEMORY; - } + return DBUS_HANDLER_RESULT_NEED_MEMORY; result = DBUS_HANDLER_RESULT_NEED_MEMORY; @@ -669,9 +634,6 @@ handle_default_introspect_and_unlock (DBusObjectTree *tree, if (!_dbus_object_tree_list_registered_unlocked (tree, path, &children)) goto out; - if (!_dbus_string_append (&xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE)) - goto out; - if (!_dbus_string_append (&xml, "\n")) goto out; @@ -687,44 +649,12 @@ handle_default_introspect_and_unlock (DBusObjectTree *tree, if (!_dbus_string_append (&xml, "\n")) goto out; - - reply = dbus_message_new_method_return (message); - if (reply == NULL) - goto out; - - dbus_message_iter_init_append (reply, &iter); - v_STRING = _dbus_string_get_const_data (&xml); - if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &v_STRING)) - goto out; - -#ifdef DBUS_BUILD_TESTS - if (tree->connection) -#endif - { - already_unlocked = TRUE; - - if (!_dbus_connection_send_and_unlock (tree->connection, reply, NULL)) - goto out; - } result = DBUS_HANDLER_RESULT_HANDLED; out: -#ifdef DBUS_BUILD_TESTS - if (tree->connection) -#endif - { - if (!already_unlocked) - { - _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__); - _dbus_connection_unlock (tree->connection); - } - } - _dbus_string_free (&xml); dbus_free_string_array (children); - if (reply) - dbus_message_unref (reply); return result; } @@ -763,10 +693,7 @@ _dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree, #ifdef DBUS_BUILD_TESTS if (tree->connection) #endif - { - _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME); - _dbus_connection_unlock (tree->connection); - } + _dbus_connection_unlock (tree->connection); _dbus_verbose ("No memory to get decomposed path\n"); @@ -778,10 +705,7 @@ _dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree, #ifdef DBUS_BUILD_TESTS if (tree->connection) #endif - { - _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME); - _dbus_connection_unlock (tree->connection); - } + _dbus_connection_unlock (tree->connection); _dbus_verbose ("No path field in message\n"); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -844,10 +768,7 @@ _dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree, #ifdef DBUS_BUILD_TESTS if (tree->connection) #endif - { - _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME); - _dbus_connection_unlock (tree->connection); - } + _dbus_connection_unlock (tree->connection); /* FIXME you could unregister the subtree in another thread * before we invoke the callback, and I can't figure out a @@ -876,19 +797,14 @@ _dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree, { /* This hardcoded default handler does a minimal Introspect() */ - result = handle_default_introspect_and_unlock (tree, message, - (const char**) path); + result = handle_default_introspect_unlocked (tree, message, + (const char**) path); } - else - { + #ifdef DBUS_BUILD_TESTS - if (tree->connection) + if (tree->connection) #endif - { - _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME); - _dbus_connection_unlock (tree->connection); - } - } + _dbus_connection_unlock (tree->connection); while (list != NULL) { @@ -1021,112 +937,11 @@ _dbus_object_tree_list_registered_and_unlock (DBusObjectTree *tree, #ifdef DBUS_BUILD_TESTS if (tree->connection) #endif - { - _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME); - _dbus_connection_unlock (tree->connection); - } + _dbus_connection_unlock (tree->connection); return result; } - - -/** Set to 1 to get a bunch of spew about disassembling the path string */ -#define VERBOSE_DECOMPOSE 0 - -/** - * Decompose an object path. A path of just "/" is - * represented as an empty vector of strings. - * The path need not be nul terminated. - * - * @param data the path data - * @param len the length of the path string - * @param path address to store new object path - * @param path_len length of stored path - */ -dbus_bool_t -_dbus_decompose_path (const char* data, - int len, - char ***path, - int *path_len) -{ - char **retval; - int n_components; - int i, j, comp; - - _dbus_assert (data != NULL); - -#if VERBOSE_DECOMPOSE - _dbus_verbose ("Decomposing path \"%s\"\n", - data); -#endif - - n_components = 0; - if (len > 1) /* if path is not just "/" */ - { - i = 0; - while (i < len) - { - if (data[i] == '/') - n_components += 1; - ++i; - } - } - - retval = dbus_new0 (char*, n_components + 1); - - if (retval == NULL) - return FALSE; - - comp = 0; - if (n_components == 0) - i = 1; - else - i = 0; - while (comp < n_components) - { - _dbus_assert (i < len); - - if (data[i] == '/') - ++i; - j = i; - - while (j < len && data[j] != '/') - ++j; - - /* Now [i, j) is the path component */ - _dbus_assert (i < j); - _dbus_assert (data[i] != '/'); - _dbus_assert (j == len || data[j] == '/'); - -#if VERBOSE_DECOMPOSE - _dbus_verbose (" (component in [%d,%d))\n", - i, j); -#endif - - retval[comp] = _dbus_memdup (&data[i], j - i + 1); - if (retval[comp] == NULL) - { - dbus_free_string_array (retval); - return FALSE; - } - retval[comp][j-i] = '\0'; -#if VERBOSE_DECOMPOSE - _dbus_verbose (" (component %d = \"%s\")\n", - comp, retval[comp]); -#endif - - ++comp; - i = j; - } - _dbus_assert (i == len); - - *path = retval; - if (path_len) - *path_len = n_components; - - return TRUE; -} - + /** @} */ #ifdef DBUS_BUILD_TESTS @@ -1137,31 +952,22 @@ static char* flatten_path (const char **path) { DBusString str; + int i; char *s; if (!_dbus_string_init (&str)) return NULL; - if (path[0] == NULL) + i = 0; + while (path[i]) { if (!_dbus_string_append_byte (&str, '/')) goto nomem; - } - else - { - int i; - - i = 0; - while (path[i]) - { - if (!_dbus_string_append_byte (&str, '/')) - goto nomem; - - if (!_dbus_string_append (&str, path[i])) - goto nomem; - - ++i; - } + + if (!_dbus_string_append (&str, path[i])) + goto nomem; + + ++i; } if (!_dbus_string_steal_data (&str, &s)) @@ -1300,7 +1106,7 @@ do_register (DBusObjectTree *tree, { DBusObjectPathVTable vtable = { test_unregister_function, test_message_function, NULL }; - + tree_test_data[i].message_handled = FALSE; tree_test_data[i].handler_unregistered = FALSE; tree_test_data[i].handler_fallback = fallback; @@ -1387,82 +1193,17 @@ do_test_dispatch (DBusObjectTree *tree, } static size_t -string_array_length (const char **array) +string_array_length (char **array) { size_t i; for (i = 0; array[i]; i++) ; return i; } -typedef struct -{ - const char *path; - const char *result[20]; -} DecomposePathTest; - -static DecomposePathTest decompose_tests[] = { - { "/foo", { "foo", NULL } }, - { "/foo/bar", { "foo", "bar", NULL } }, - { "/", { NULL } }, - { "/a/b", { "a", "b", NULL } }, - { "/a/b/c", { "a", "b", "c", NULL } }, - { "/a/b/c/d", { "a", "b", "c", "d", NULL } }, - { "/foo/bar/q", { "foo", "bar", "q", NULL } }, - { "/foo/bar/this/is/longer", { "foo", "bar", "this", "is", "longer", NULL } } -}; - -static dbus_bool_t -run_decompose_tests (void) -{ - int i; - - i = 0; - while (i < _DBUS_N_ELEMENTS (decompose_tests)) - { - char **result; - int result_len; - int expected_len; - - if (!_dbus_decompose_path (decompose_tests[i].path, - strlen (decompose_tests[i].path), - &result, &result_len)) - return FALSE; - - expected_len = string_array_length (decompose_tests[i].result); - - if (result_len != (int) string_array_length ((const char**)result) || - expected_len != result_len || - path_contains (decompose_tests[i].result, - (const char**) result) != STR_EQUAL) - { - int real_len = string_array_length ((const char**)result); - _dbus_warn ("Expected decompose of %s to have len %d, returned %d, appears to have %d\n", - decompose_tests[i].path, expected_len, result_len, - real_len); - _dbus_warn ("Decompose resulted in elements: { "); - i = 0; - while (i < real_len) - { - _dbus_warn ("\"%s\"%s", result[i], - (i + 1) == real_len ? "" : ", "); - ++i; - } - _dbus_warn ("}\n"); - _dbus_assert_not_reached ("path decompose failed\n"); - } - - dbus_free_string_array (result); - - ++i; - } - - return TRUE; -} static dbus_bool_t object_tree_test_iteration (void *data) { - const char *path0[] = { NULL }; const char *path1[] = { "foo", NULL }; const char *path2[] = { "foo", "bar", NULL }; const char *path3[] = { "foo", "bar", "baz", NULL }; @@ -1472,46 +1213,19 @@ object_tree_test_iteration (void *data) const char *path7[] = { "blah", "boof", "this", "is", "really", "long", NULL }; const char *path8[] = { "childless", NULL }; DBusObjectTree *tree; - TreeTestData tree_test_data[9]; + TreeTestData tree_test_data[8]; int i; dbus_bool_t exact_match; - if (!run_decompose_tests ()) - return FALSE; - tree = NULL; tree = _dbus_object_tree_new (NULL); if (tree == NULL) goto out; - if (!do_register (tree, path0, TRUE, 0, tree_test_data)) - goto out; - - _dbus_assert (find_subtree (tree, path0, NULL)); - _dbus_assert (!find_subtree (tree, path1, NULL)); - _dbus_assert (!find_subtree (tree, path2, NULL)); - _dbus_assert (!find_subtree (tree, path3, NULL)); - _dbus_assert (!find_subtree (tree, path4, NULL)); - _dbus_assert (!find_subtree (tree, path5, NULL)); - _dbus_assert (!find_subtree (tree, path6, NULL)); - _dbus_assert (!find_subtree (tree, path7, NULL)); - _dbus_assert (!find_subtree (tree, path8, NULL)); - - _dbus_assert (find_handler (tree, path0, &exact_match) && exact_match); - _dbus_assert (find_handler (tree, path1, &exact_match) == tree->root && !exact_match); - _dbus_assert (find_handler (tree, path2, &exact_match) == tree->root && !exact_match); - _dbus_assert (find_handler (tree, path3, &exact_match) == tree->root && !exact_match); - _dbus_assert (find_handler (tree, path4, &exact_match) == tree->root && !exact_match); - _dbus_assert (find_handler (tree, path5, &exact_match) == tree->root && !exact_match); - _dbus_assert (find_handler (tree, path6, &exact_match) == tree->root && !exact_match); - _dbus_assert (find_handler (tree, path7, &exact_match) == tree->root && !exact_match); - _dbus_assert (find_handler (tree, path8, &exact_match) == tree->root && !exact_match); - - if (!do_register (tree, path1, TRUE, 1, tree_test_data)) + if (!do_register (tree, path1, TRUE, 0, tree_test_data)) goto out; - _dbus_assert (find_subtree (tree, path0, NULL)); _dbus_assert (find_subtree (tree, path1, NULL)); _dbus_assert (!find_subtree (tree, path2, NULL)); _dbus_assert (!find_subtree (tree, path3, NULL)); @@ -1521,7 +1235,6 @@ object_tree_test_iteration (void *data) _dbus_assert (!find_subtree (tree, path7, NULL)); _dbus_assert (!find_subtree (tree, path8, NULL)); - _dbus_assert (find_handler (tree, path0, &exact_match) && exact_match); _dbus_assert (find_handler (tree, path1, &exact_match) && exact_match); _dbus_assert (find_handler (tree, path2, &exact_match) && !exact_match); _dbus_assert (find_handler (tree, path3, &exact_match) && !exact_match); @@ -1531,7 +1244,7 @@ object_tree_test_iteration (void *data) _dbus_assert (find_handler (tree, path7, &exact_match) == tree->root && !exact_match); _dbus_assert (find_handler (tree, path8, &exact_match) == tree->root && !exact_match); - if (!do_register (tree, path2, TRUE, 2, tree_test_data)) + if (!do_register (tree, path2, TRUE, 1, tree_test_data)) goto out; _dbus_assert (find_subtree (tree, path1, NULL)); @@ -1543,10 +1256,9 @@ object_tree_test_iteration (void *data) _dbus_assert (!find_subtree (tree, path7, NULL)); _dbus_assert (!find_subtree (tree, path8, NULL)); - if (!do_register (tree, path3, TRUE, 3, tree_test_data)) + if (!do_register (tree, path3, TRUE, 2, tree_test_data)) goto out; - _dbus_assert (find_subtree (tree, path0, NULL)); _dbus_assert (find_subtree (tree, path1, NULL)); _dbus_assert (find_subtree (tree, path2, NULL)); _dbus_assert (find_subtree (tree, path3, NULL)); @@ -1556,10 +1268,9 @@ object_tree_test_iteration (void *data) _dbus_assert (!find_subtree (tree, path7, NULL)); _dbus_assert (!find_subtree (tree, path8, NULL)); - if (!do_register (tree, path4, TRUE, 4, tree_test_data)) + if (!do_register (tree, path4, TRUE, 3, tree_test_data)) goto out; - _dbus_assert (find_subtree (tree, path0, NULL)); _dbus_assert (find_subtree (tree, path1, NULL)); _dbus_assert (find_subtree (tree, path2, NULL)); _dbus_assert (find_subtree (tree, path3, NULL)); @@ -1569,10 +1280,9 @@ object_tree_test_iteration (void *data) _dbus_assert (!find_subtree (tree, path7, NULL)); _dbus_assert (!find_subtree (tree, path8, NULL)); - if (!do_register (tree, path5, TRUE, 5, tree_test_data)) + if (!do_register (tree, path5, TRUE, 4, tree_test_data)) goto out; - _dbus_assert (find_subtree (tree, path0, NULL)); _dbus_assert (find_subtree (tree, path1, NULL)); _dbus_assert (find_subtree (tree, path2, NULL)); _dbus_assert (find_subtree (tree, path3, NULL)); @@ -1581,8 +1291,7 @@ object_tree_test_iteration (void *data) _dbus_assert (!find_subtree (tree, path6, NULL)); _dbus_assert (!find_subtree (tree, path7, NULL)); _dbus_assert (!find_subtree (tree, path8, NULL)); - - _dbus_assert (find_handler (tree, path0, &exact_match) == tree->root && exact_match); + _dbus_assert (find_handler (tree, path1, &exact_match) != tree->root && exact_match); _dbus_assert (find_handler (tree, path2, &exact_match) != tree->root && exact_match); _dbus_assert (find_handler (tree, path3, &exact_match) != tree->root && exact_match); @@ -1592,10 +1301,9 @@ object_tree_test_iteration (void *data) _dbus_assert (find_handler (tree, path7, &exact_match) != tree->root && !exact_match); _dbus_assert (find_handler (tree, path8, &exact_match) == tree->root && !exact_match); - if (!do_register (tree, path6, TRUE, 6, tree_test_data)) + if (!do_register (tree, path6, TRUE, 5, tree_test_data)) goto out; - _dbus_assert (find_subtree (tree, path0, NULL)); _dbus_assert (find_subtree (tree, path1, NULL)); _dbus_assert (find_subtree (tree, path2, NULL)); _dbus_assert (find_subtree (tree, path3, NULL)); @@ -1605,10 +1313,9 @@ object_tree_test_iteration (void *data) _dbus_assert (!find_subtree (tree, path7, NULL)); _dbus_assert (!find_subtree (tree, path8, NULL)); - if (!do_register (tree, path7, TRUE, 7, tree_test_data)) + if (!do_register (tree, path7, TRUE, 6, tree_test_data)) goto out; - _dbus_assert (find_subtree (tree, path0, NULL)); _dbus_assert (find_subtree (tree, path1, NULL)); _dbus_assert (find_subtree (tree, path2, NULL)); _dbus_assert (find_subtree (tree, path3, NULL)); @@ -1618,10 +1325,9 @@ object_tree_test_iteration (void *data) _dbus_assert (find_subtree (tree, path7, NULL)); _dbus_assert (!find_subtree (tree, path8, NULL)); - if (!do_register (tree, path8, TRUE, 8, tree_test_data)) + if (!do_register (tree, path8, TRUE, 7, tree_test_data)) goto out; - _dbus_assert (find_subtree (tree, path0, NULL)); _dbus_assert (find_subtree (tree, path1, NULL)); _dbus_assert (find_subtree (tree, path2, NULL)); _dbus_assert (find_subtree (tree, path3, NULL)); @@ -1630,8 +1336,7 @@ object_tree_test_iteration (void *data) _dbus_assert (find_subtree (tree, path6, NULL)); _dbus_assert (find_subtree (tree, path7, NULL)); _dbus_assert (find_subtree (tree, path8, NULL)); - - _dbus_assert (find_handler (tree, path0, &exact_match) == tree->root && exact_match); + _dbus_assert (find_handler (tree, path1, &exact_match) != tree->root && exact_match); _dbus_assert (find_handler (tree, path2, &exact_match) != tree->root && exact_match); _dbus_assert (find_handler (tree, path3, &exact_match) != tree->root && exact_match); @@ -1651,7 +1356,7 @@ object_tree_test_iteration (void *data) _dbus_object_tree_list_registered_unlocked (tree, path1, &child_entries); if (child_entries != NULL) { - nb = string_array_length ((const char**)child_entries); + nb = string_array_length (child_entries); _dbus_assert (nb == 1); dbus_free_string_array (child_entries); } @@ -1659,7 +1364,7 @@ object_tree_test_iteration (void *data) _dbus_object_tree_list_registered_unlocked (tree, path2, &child_entries); if (child_entries != NULL) { - nb = string_array_length ((const char**)child_entries); + nb = string_array_length (child_entries); _dbus_assert (nb == 2); dbus_free_string_array (child_entries); } @@ -1667,7 +1372,7 @@ object_tree_test_iteration (void *data) _dbus_object_tree_list_registered_unlocked (tree, path8, &child_entries); if (child_entries != NULL) { - nb = string_array_length ((const char**)child_entries); + nb = string_array_length (child_entries); _dbus_assert (nb == 0); dbus_free_string_array (child_entries); } @@ -1675,7 +1380,7 @@ object_tree_test_iteration (void *data) _dbus_object_tree_list_registered_unlocked (tree, root, &child_entries); if (child_entries != NULL) { - nb = string_array_length ((const char**)child_entries); + nb = string_array_length (child_entries); _dbus_assert (nb == 3); dbus_free_string_array (child_entries); } @@ -1697,40 +1402,25 @@ object_tree_test_iteration (void *data) if (tree == NULL) goto out; - if (!do_register (tree, path0, TRUE, 0, tree_test_data)) + if (!do_register (tree, path1, TRUE, 0, tree_test_data)) goto out; - if (!do_register (tree, path1, TRUE, 1, tree_test_data)) + if (!do_register (tree, path2, TRUE, 1, tree_test_data)) goto out; - if (!do_register (tree, path2, TRUE, 2, tree_test_data)) + if (!do_register (tree, path3, TRUE, 2, tree_test_data)) goto out; - if (!do_register (tree, path3, TRUE, 3, tree_test_data)) + if (!do_register (tree, path4, TRUE, 3, tree_test_data)) goto out; - if (!do_register (tree, path4, TRUE, 4, tree_test_data)) + if (!do_register (tree, path5, TRUE, 4, tree_test_data)) goto out; - if (!do_register (tree, path5, TRUE, 5, tree_test_data)) + if (!do_register (tree, path6, TRUE, 5, tree_test_data)) goto out; - if (!do_register (tree, path6, TRUE, 6, tree_test_data)) + if (!do_register (tree, path7, TRUE, 6, tree_test_data)) goto out; - if (!do_register (tree, path7, TRUE, 7, tree_test_data)) + if (!do_register (tree, path8, TRUE, 7, tree_test_data)) goto out; - if (!do_register (tree, path8, TRUE, 8, tree_test_data)) - goto out; - - _dbus_object_tree_unregister_and_unlock (tree, path0); - - _dbus_assert (!find_subtree (tree, path0, NULL)); - _dbus_assert (find_subtree (tree, path1, NULL)); - _dbus_assert (find_subtree (tree, path2, NULL)); - _dbus_assert (find_subtree (tree, path3, NULL)); - _dbus_assert (find_subtree (tree, path4, NULL)); - _dbus_assert (find_subtree (tree, path5, NULL)); - _dbus_assert (find_subtree (tree, path6, NULL)); - _dbus_assert (find_subtree (tree, path7, NULL)); - _dbus_assert (find_subtree (tree, path8, NULL)); _dbus_object_tree_unregister_and_unlock (tree, path1); - _dbus_assert (!find_subtree (tree, path0, NULL)); _dbus_assert (!find_subtree (tree, path1, NULL)); _dbus_assert (find_subtree (tree, path2, NULL)); _dbus_assert (find_subtree (tree, path3, NULL)); @@ -1742,7 +1432,6 @@ object_tree_test_iteration (void *data) _dbus_object_tree_unregister_and_unlock (tree, path2); - _dbus_assert (!find_subtree (tree, path0, NULL)); _dbus_assert (!find_subtree (tree, path1, NULL)); _dbus_assert (!find_subtree (tree, path2, NULL)); _dbus_assert (find_subtree (tree, path3, NULL)); @@ -1754,7 +1443,6 @@ object_tree_test_iteration (void *data) _dbus_object_tree_unregister_and_unlock (tree, path3); - _dbus_assert (!find_subtree (tree, path0, NULL)); _dbus_assert (!find_subtree (tree, path1, NULL)); _dbus_assert (!find_subtree (tree, path2, NULL)); _dbus_assert (!find_subtree (tree, path3, NULL)); @@ -1766,7 +1454,6 @@ object_tree_test_iteration (void *data) _dbus_object_tree_unregister_and_unlock (tree, path4); - _dbus_assert (!find_subtree (tree, path0, NULL)); _dbus_assert (!find_subtree (tree, path1, NULL)); _dbus_assert (!find_subtree (tree, path2, NULL)); _dbus_assert (!find_subtree (tree, path3, NULL)); @@ -1778,7 +1465,6 @@ object_tree_test_iteration (void *data) _dbus_object_tree_unregister_and_unlock (tree, path5); - _dbus_assert (!find_subtree (tree, path0, NULL)); _dbus_assert (!find_subtree (tree, path1, NULL)); _dbus_assert (!find_subtree (tree, path2, NULL)); _dbus_assert (!find_subtree (tree, path3, NULL)); @@ -1790,7 +1476,6 @@ object_tree_test_iteration (void *data) _dbus_object_tree_unregister_and_unlock (tree, path6); - _dbus_assert (!find_subtree (tree, path0, NULL)); _dbus_assert (!find_subtree (tree, path1, NULL)); _dbus_assert (!find_subtree (tree, path2, NULL)); _dbus_assert (!find_subtree (tree, path3, NULL)); @@ -1802,7 +1487,6 @@ object_tree_test_iteration (void *data) _dbus_object_tree_unregister_and_unlock (tree, path7); - _dbus_assert (!find_subtree (tree, path0, NULL)); _dbus_assert (!find_subtree (tree, path1, NULL)); _dbus_assert (!find_subtree (tree, path2, NULL)); _dbus_assert (!find_subtree (tree, path3, NULL)); @@ -1814,7 +1498,6 @@ object_tree_test_iteration (void *data) _dbus_object_tree_unregister_and_unlock (tree, path8); - _dbus_assert (!find_subtree (tree, path0, NULL)); _dbus_assert (!find_subtree (tree, path1, NULL)); _dbus_assert (!find_subtree (tree, path2, NULL)); _dbus_assert (!find_subtree (tree, path3, NULL)); @@ -1833,47 +1516,43 @@ object_tree_test_iteration (void *data) } /* Register it all again, and test dispatch */ - - if (!do_register (tree, path0, TRUE, 0, tree_test_data)) - goto out; - if (!do_register (tree, path1, FALSE, 1, tree_test_data)) + + if (!do_register (tree, path1, FALSE, 0, tree_test_data)) goto out; - if (!do_register (tree, path2, TRUE, 2, tree_test_data)) + if (!do_register (tree, path2, TRUE, 1, tree_test_data)) goto out; - if (!do_register (tree, path3, TRUE, 3, tree_test_data)) + if (!do_register (tree, path3, TRUE, 2, tree_test_data)) goto out; - if (!do_register (tree, path4, TRUE, 4, tree_test_data)) + if (!do_register (tree, path4, TRUE, 3, tree_test_data)) goto out; - if (!do_register (tree, path5, TRUE, 5, tree_test_data)) + if (!do_register (tree, path5, TRUE, 4, tree_test_data)) goto out; - if (!do_register (tree, path6, FALSE, 6, tree_test_data)) + if (!do_register (tree, path6, FALSE, 5, tree_test_data)) goto out; - if (!do_register (tree, path7, TRUE, 7, tree_test_data)) + if (!do_register (tree, path7, TRUE, 6, tree_test_data)) goto out; - if (!do_register (tree, path8, TRUE, 8, tree_test_data)) + if (!do_register (tree, path8, TRUE, 7, tree_test_data)) goto out; #if 0 spew_tree (tree); #endif - - if (!do_test_dispatch (tree, path0, 0, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) - goto out; - if (!do_test_dispatch (tree, path1, 1, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) + + if (!do_test_dispatch (tree, path1, 0, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) goto out; - if (!do_test_dispatch (tree, path2, 2, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) + if (!do_test_dispatch (tree, path2, 1, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) goto out; - if (!do_test_dispatch (tree, path3, 3, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) + if (!do_test_dispatch (tree, path3, 2, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) goto out; - if (!do_test_dispatch (tree, path4, 4, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) + if (!do_test_dispatch (tree, path4, 3, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) goto out; - if (!do_test_dispatch (tree, path5, 5, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) + if (!do_test_dispatch (tree, path5, 4, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) goto out; - if (!do_test_dispatch (tree, path6, 6, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) + if (!do_test_dispatch (tree, path6, 5, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) goto out; - if (!do_test_dispatch (tree, path7, 7, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) + if (!do_test_dispatch (tree, path7, 6, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) goto out; - if (!do_test_dispatch (tree, path8, 8, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) + if (!do_test_dispatch (tree, path8, 7, tree_test_data, _DBUS_N_ELEMENTS (tree_test_data))) goto out; out: -- cgit