Commit e431887e authored by Olivier Andrieu's avatar Olivier Andrieu

2004-05-21 Olivier Andrieu <oliv__a@users.sourceforge.net>

	* dbus/dbus-object-tree.c
	(_dbus_object_tree_list_registered_unlock, lookup_subtree): return
	children even if the requested path isn't registered.
	(object_tree_test_iteration): test object_tree_list_registered.

	* configure.in: undefine HAVE_ABSTRACT_SOCKETS instead of defining
	it to 0.
parent df23f08f
2004-05-21 Olivier Andrieu <oliv__a@users.sourceforge.net>
* dbus/dbus-object-tree.c
(_dbus_object_tree_list_registered_unlock, lookup_subtree): return
children even if the requested path isn't registered.
(object_tree_test_iteration): test object_tree_list_registered.
* configure.in: undefine HAVE_ABSTRACT_SOCKETS instead of defining
it to 0.
2004-05-20 Kristian Høgsberg <krh@redhat.com>
* doc/TODO: Remove resolved items.
......
......@@ -625,15 +625,12 @@ if test x$enable_abstract_sockets = xno; then
fi
if test x$have_abstract_sockets = xyes ; then
abstract_sockets=1
DBUS_PATH_OR_ABSTRACT=abstract
AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace])
else
abstract_sockets=0
DBUS_PATH_OR_ABSTRACT=path
fi
AC_DEFINE_UNQUOTED(HAVE_ABSTRACT_SOCKETS, $abstract_sockets, [Have abstract socket namespace])
# this is used in addresses to prefer abstract, e.g.
# unix:path=/foo or unix:abstract=/foo
AC_SUBST(DBUS_PATH_OR_ABSTRACT)
......
......@@ -343,6 +343,16 @@ find_subtree (DBusObjectTree *tree,
return subtree;
}
static DBusObjectSubtree*
lookup_subtree (DBusObjectTree *tree,
const char **path)
{
#if VERBOSE_FIND
_dbus_verbose ("Looking for subtree\n");
#endif
return find_subtree_recurse (tree->root, path, FALSE, FALSE, NULL);
}
static DBusObjectSubtree*
find_handler (DBusObjectTree *tree,
const char **path)
......@@ -553,12 +563,10 @@ _dbus_object_tree_list_registered_unlocked (DBusObjectTree *tree,
*child_entries = NULL;
subtree = find_subtree (tree, parent_path, NULL);
subtree = lookup_subtree (tree, parent_path);
if (subtree == NULL)
{
retval = dbus_new0 (char *, 1);
if (retval == NULL)
goto out;
}
else
{
......@@ -1143,6 +1151,15 @@ do_test_dispatch (DBusObjectTree *tree,
return FALSE;
}
static size_t
string_array_length (char **array)
{
size_t i;
for (i = 0; array[i]; i++) ;
return i;
}
static dbus_bool_t
object_tree_test_iteration (void *data)
{
......@@ -1287,6 +1304,46 @@ object_tree_test_iteration (void *data)
_dbus_assert (find_handler (tree, path7) != tree->root);
_dbus_assert (find_handler (tree, path8) != tree->root);
/* test the list_registered function */
{
const char *root[] = { NULL };
char **child_entries;
int nb;
_dbus_object_tree_list_registered_unlocked (tree, path1, &child_entries);
if (child_entries != NULL)
{
nb = string_array_length (child_entries);
_dbus_assert (nb == 1);
dbus_free_string_array (child_entries);
}
_dbus_object_tree_list_registered_unlocked (tree, path2, &child_entries);
if (child_entries != NULL)
{
nb = string_array_length (child_entries);
_dbus_assert (nb == 2);
dbus_free_string_array (child_entries);
}
_dbus_object_tree_list_registered_unlocked (tree, path8, &child_entries);
if (child_entries != NULL)
{
nb = string_array_length (child_entries);
_dbus_assert (nb == 0);
dbus_free_string_array (child_entries);
}
_dbus_object_tree_list_registered_unlocked (tree, root, &child_entries);
if (child_entries != NULL)
{
nb = string_array_length (child_entries);
_dbus_assert (nb == 3);
dbus_free_string_array (child_entries);
}
}
/* Check that destroying tree calls unregister funcs */
_dbus_object_tree_unref (tree);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment