From: Simon McVittie Date: Wed, 16 Feb 2011 17:52:03 +0000 (+0000) Subject: Add a macro to centralize checking for string-like types X-Git-Tag: dbus-1.5.10~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bca090096a32e9d86383beae4da05b2df861ee5b;p=thirdparty%2Fdbus.git Add a macro to centralize checking for string-like types Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095 Reviewed-by: Guillaume Desmottes --- diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 73a53ccd5..b02f490cf 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -40,6 +40,10 @@ #include +#define _DBUS_TYPE_IS_STRINGLIKE(type) \ + (type == DBUS_TYPE_STRING || type == DBUS_TYPE_SIGNATURE || \ + type == DBUS_TYPE_OBJECT_PATH) + static void dbus_message_finalize (DBusMessage *message); /** @@ -887,9 +891,7 @@ _dbus_message_iter_get_args_valist (DBusMessageIter *iter, _dbus_type_reader_read_fixed_multi (&array, (void *) ptr, n_elements_p); } - else if (spec_element_type == DBUS_TYPE_STRING || - spec_element_type == DBUS_TYPE_SIGNATURE || - spec_element_type == DBUS_TYPE_OBJECT_PATH) + else if (_DBUS_TYPE_IS_STRINGLIKE (spec_element_type)) { char ***str_array_p; int n_elements; @@ -1799,9 +1801,7 @@ dbus_message_append_args_valist (DBusMessage *message, goto failed; } } - else if (element_type == DBUS_TYPE_STRING || - element_type == DBUS_TYPE_SIGNATURE || - element_type == DBUS_TYPE_OBJECT_PATH) + else if (_DBUS_TYPE_IS_STRINGLIKE (element_type)) { const char ***value_p; const char **value;