summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-02-16 17:52:03 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-02-21 14:51:06 +0000
commitbca090096a32e9d86383beae4da05b2df861ee5b (patch)
tree48d774a302b87b500722637a4b591fac2bf9186e
parent1d8abcd4d21eaa999f28bc3cb89976bfe50cb9b0 (diff)
downloaddbus-bca090096a32e9d86383beae4da05b2df861ee5b.tar.gz
Add a macro to centralize checking for string-like types
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r--dbus/dbus-message.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 73a53ccd..b02f490c 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -40,6 +40,10 @@
#include <string.h>
+#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;