mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-27 08:00:09 +01:00
Make array-printing code easier to follow
Previously dbus_message_iter_get_arg_type() was called twice: once in the loop condition to update 'current_type', and once to check if the loop will run again. This patch moves updating current_type to the end of the loop body.
This commit is contained in:
parent
03cc20707a
commit
1e14e409a4
1 changed files with 7 additions and 2 deletions
|
|
@ -186,12 +186,17 @@ print_iter (DBusMessageIter *iter, dbus_bool_t literal, int depth)
|
|||
|
||||
dbus_message_iter_recurse (iter, &subiter);
|
||||
|
||||
current_type = dbus_message_iter_get_arg_type (&subiter);
|
||||
|
||||
printf("array [\n");
|
||||
while ((current_type = dbus_message_iter_get_arg_type (&subiter)) != DBUS_TYPE_INVALID)
|
||||
while (current_type != DBUS_TYPE_INVALID)
|
||||
{
|
||||
print_iter (&subiter, literal, depth+1);
|
||||
|
||||
dbus_message_iter_next (&subiter);
|
||||
if (dbus_message_iter_get_arg_type (&subiter) != DBUS_TYPE_INVALID)
|
||||
current_type = dbus_message_iter_get_arg_type (&subiter);
|
||||
|
||||
if (current_type != DBUS_TYPE_INVALID)
|
||||
printf (",");
|
||||
}
|
||||
indent(depth);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue