summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2009-02-27 07:01:02 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2009-02-27 07:01:02 +0800
commit6e92cdd6c64954f5d21e9c73f444b0ca3ecdd9ec (patch)
tree28b529de021c36f96e435cea43f6d29ead7ffe07
parent7e8d1bfad188854ad45550a2c2467b5caf83923c (diff)
downloadibus-6e92cdd6c64954f5d21e9c73f444b0ca3ecdd9ec.tar.gz
ibus-6e92cdd6c64954f5d21e9c73f444b0ca3ecdd9ec.tar.xz
ibus-6e92cdd6c64954f5d21e9c73f444b0ca3ecdd9ec.zip
Change some methods of matchrule
-rw-r--r--bus/dbusimpl.c9
-rw-r--r--bus/matchrule.c11
-rw-r--r--bus/matchrule.h5
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