From 0fb72073a5dea24b5af98fd9ad12d7fae0c8001d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 16 Feb 2011 17:52:03 +0000 Subject: [PATCH 03/10] Add a macro to centralize checking for string-like types --- dbus/dbus-message.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 73a53cc..b02f490 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; -- 1.7.9