From ee3c56b54facaa83b35a9da16d5f7d0f58363109 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 31 Jan 2011 15:55:53 +0000 Subject: [PATCH 01/10] match_rule_to_string: don't reinvent dbus_message_type_to_string We don't allow match rules with unknown message types, so losing the "type='%d'" case isn't a great loss. --- bus/signals.c | 33 +++------------------------------ 1 files changed, 3 insertions(+), 30 deletions(-) diff --git a/bus/signals.c b/bus/signals.c index c85a88d..a4705c8 100644 --- a/bus/signals.c +++ b/bus/signals.c @@ -135,36 +135,9 @@ match_rule_to_string (BusMatchRule *rule) if (rule->flags & BUS_MATCH_MESSAGE_TYPE) { - if (rule->message_type == DBUS_MESSAGE_TYPE_INVALID) - { - if (!_dbus_string_append_printf (&str, "type='INVALID'")) - goto nomem; - } - else if (rule->message_type == DBUS_MESSAGE_TYPE_METHOD_CALL) - { - if (!_dbus_string_append_printf (&str, "type='method_call'")) - goto nomem; - } - else if (rule->message_type == DBUS_MESSAGE_TYPE_METHOD_RETURN) - { - if (!_dbus_string_append_printf (&str, "type='method_return'")) - goto nomem; - } - else if (rule->message_type == DBUS_MESSAGE_TYPE_ERROR) - { - if (!_dbus_string_append_printf (&str, "type='error'")) - goto nomem; - } - else if (rule->message_type == DBUS_MESSAGE_TYPE_SIGNAL) - { - if (!_dbus_string_append_printf (&str, "type='signal'")) - goto nomem; - } - else - { - if (!_dbus_string_append_printf (&str, "type='%d'", rule->message_type)) - goto nomem; - } + if (!_dbus_string_append_printf (&str, "type='%s'", + dbus_message_type_to_string (rule->message_type))) + goto nomem; } if (rule->flags & BUS_MATCH_INTERFACE) -- 1.7.2.3