checking for empty arrays
Mike Gorse
mgorse at novell.com
Thu Oct 14 15:17:13 PDT 2010
Hi all,
Is there a good way to check for an empty array using libdbus? I want to
avoid calling dbus_message_iter_recurse on the array iter if the array is
empty, since I think that causes a crash. Currently I have code like
this:
dbus_message_iter_recurse (&iter, &iter_array);
if (dbus_message_iter_get_array_len (&iter_array) > 0) do
{
...
}
while (dbus_message_iter_next (&iter_array));
But the above is not good because dbus_message_iter_get_array_len is
deprecated. I cannot use dbus_message_iter_get_fixed_array because I have
an array of structures, and I haven't found a way to check that there is
data at the original position before recursing into it.
Thanks,
-Mike
More information about the dbus
mailing list