From 6e92cdd6c64954f5d21e9c73f444b0ca3ecdd9ec Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Fri, 27 Feb 2009 07:01:02 +0800 Subject: Change some methods of matchrule --- bus/dbusimpl.c | 9 ++++----- bus/matchrule.c | 11 +++++------ bus/matchrule.h | 5 ++--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c index f8b8566..fff6364 100644 --- a/bus/dbusimpl.c +++ b/bus/dbusimpl.c @@ -1066,11 +1066,10 @@ bus_dbus_impl_dispatch_message_by_rule (BusDBusImpl *dbus, #endif for (link = dbus->rules; link != NULL; link = link->next) { - if (bus_match_rule_get_recipients (BUS_MATCH_RULE (link->data), - message, - &recipients)) { + recipients = bus_match_rule_get_recipients (BUS_MATCH_RULE (link->data), + message); + if (recipients != NULL) break; - } } for (link = recipients; link != NULL; link = link->next) { @@ -1078,7 +1077,7 @@ bus_dbus_impl_dispatch_message_by_rule (BusDBusImpl *dbus, if (connection != skip_connection) { ibus_connection_send (IBUS_CONNECTION (connection), message); } - g_object_unref (link->data); + g_object_unref (connection); } g_list_free (recipients); } diff --git a/bus/matchrule.c b/bus/matchrule.c index 6bf75c5..f40147a 100644 --- a/bus/matchrule.c +++ b/bus/matchrule.c @@ -649,16 +649,15 @@ bus_match_rule_remove_recipient (BusMatchRule *rule, g_warning ("Remove recipient failed"); } -gboolean +GList * bus_match_rule_get_recipients (BusMatchRule *rule, - DBusMessage *message, - GList **recipients) + DBusMessage *message) { g_assert (BUS_IS_MATCH_RULE (rule)); g_assert (message != NULL); - g_assert (recipients != NULL); GList *link; + GList *recipients = NULL; if (!bus_match_rule_match (rule, message)) return FALSE; @@ -667,9 +666,9 @@ bus_match_rule_get_recipients (BusMatchRule *rule, BusRecipient *recipient = (BusRecipient *) link->data; g_object_ref (recipient->connection); - *recipients = g_list_append (*recipients, recipient->connection); + recipients = g_list_append (recipients, recipient->connection); } - return TRUE; + return recipients; } diff --git a/bus/matchrule.h b/bus/matchrule.h index b69825d..5a965a8 100644 --- a/bus/matchrule.h +++ b/bus/matchrule.h @@ -114,10 +114,9 @@ void bus_match_rule_add_recipient void bus_match_rule_remove_recipient (BusMatchRule *rule, BusConnection *connection); -gboolean bus_match_rule_get_recipients +GList *bus_match_rule_get_recipients (BusMatchRule *rule, - DBusMessage *message, - GList **recipients); + DBusMessage *message); G_END_DECLS #endif -- cgit