dbus/dbus/dbus
Michael Meeks
michael@ximian.com
Mon, 08 Mar 2004 02:29:16 -0800
CVS commit by michael:
2004-03-08 Michael Meeks <michael@ximian.com>
* dbus/dbus-message.c (dbus_message_iter_get_args_valist):
cleanup cut/paste/inefficiency.
M +14 -40 dbus/dbus/dbus/dbus-message.c 1.119
--- dbus/dbus/dbus/dbus-message.c #1.118:1.119
@@ -2261,4 +2261,5 @@ dbus_message_iter_get_args_valist (DBusM
void **data;
int *len, type;
+ dbus_bool_t err = FALSE;
type = va_arg (var_args, int);
@@ -2282,60 +2283,28 @@ dbus_message_iter_get_args_valist (DBusM
{
case DBUS_TYPE_BYTE:
- if (!dbus_message_iter_get_byte_array (iter, (unsigned char **)data, len))
- {
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto out;
- }
+ err = !dbus_message_iter_get_byte_array (iter, (unsigned char **)data, len);
break;
case DBUS_TYPE_BOOLEAN:
- if (!dbus_message_iter_get_boolean_array (iter, (unsigned char **)data, len))
- {
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto out;
- }
+ err = !dbus_message_iter_get_boolean_array (iter, (unsigned char **)data, len);
break;
case DBUS_TYPE_INT32:
- if (!dbus_message_iter_get_int32_array (iter, (dbus_int32_t **)data, len))
- {
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto out;
- }
+ err = !dbus_message_iter_get_int32_array (iter, (dbus_int32_t **)data, len);
break;
case DBUS_TYPE_UINT32:
- if (!dbus_message_iter_get_uint32_array (iter, (dbus_uint32_t **)data, len))
- {
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto out;
- }
+ err = !dbus_message_iter_get_uint32_array (iter, (dbus_uint32_t **)data, len);
break;
#ifdef DBUS_HAVE_INT64
case DBUS_TYPE_INT64:
- if (!dbus_message_iter_get_int64_array (iter, (dbus_int64_t **)data, len))
- {
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto out;
- }
+ err = !dbus_message_iter_get_int64_array (iter, (dbus_int64_t **)data, len);
break;
case DBUS_TYPE_UINT64:
- if (!dbus_message_iter_get_uint64_array (iter, (dbus_uint64_t **)data, len))
- {
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto out;
- }
+ err = !dbus_message_iter_get_uint64_array (iter, (dbus_uint64_t **)data, len);
break;
#endif /* DBUS_HAVE_INT64 */
case DBUS_TYPE_DOUBLE:
- if (!dbus_message_iter_get_double_array (iter, (double **)data, len))
- {
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto out;
- }
+ err = !dbus_message_iter_get_double_array (iter, (double **)data, len);
break;
case DBUS_TYPE_STRING:
- if (!dbus_message_iter_get_string_array (iter, (char ***)data, len))
- {
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto out;
- }
+ err = !dbus_message_iter_get_string_array (iter, (char ***)data, len);
break;
case DBUS_TYPE_NIL:
@@ -2351,4 +2320,9 @@ dbus_message_iter_get_args_valist (DBusM
goto out;
}
+ if (err)
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ goto out;
+ }
}
break;