[pulseaudio-discuss] [PATCH 1/3] dbus: Give NULL as the error parameter to dbus_bus_remove_match().

Tanu Kaskinen tanuk at iki.fi
Sun Jan 1 09:44:26 PST 2012


We didn't do anything anyway in case of failures. When we
give NULL as the error, dbus_bus_remove_match() can act
asynchronously, so it becomes faster. Also, the bus daemon
can avoid sending any replies, which reduces the amount of
traffic.
---
 src/modules/bluetooth/module-bluetooth-proximity.c |    6 +++---
 src/pulsecore/dbus-util.c                          |   16 +++-------------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c
index 8c3a5b9..7560f5a 100644
--- a/src/modules/bluetooth/module-bluetooth-proximity.c
+++ b/src/modules/bluetooth/module-bluetooth-proximity.c
@@ -344,7 +344,7 @@ static int add_matches(struct userdata *u, pa_bool_t add) {
             goto finish;
         }
     } else
-        dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter1, &e);
+        dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter1, NULL);
 
 
     if (add) {
@@ -352,11 +352,11 @@ static int add_matches(struct userdata *u, pa_bool_t add) {
 
         if (dbus_error_is_set(&e)) {
             pa_log("dbus_bus_add_match(%s) failed: %s", filter2, e.message);
-            dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, &e);
+            dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, NULL);
             goto finish;
         }
     } else
-        dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, &e);
+        dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, NULL);
 
     if (add) {
         pa_assert_se(dbus_connection_add_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u, NULL));
diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c
index fc2d5fc..1a620fe 100644
--- a/src/pulsecore/dbus-util.c
+++ b/src/pulsecore/dbus-util.c
@@ -368,13 +368,8 @@ fail:
     va_end(ap);
     va_start(ap, error);
     for (; k > 0; k--) {
-        DBusError e;
-
         pa_assert_se(t = va_arg(ap, const char*));
-
-        dbus_error_init(&e);
-        dbus_bus_remove_match(c, t, &e);
-        dbus_error_free(&e);
+        dbus_bus_remove_match(c, t, NULL);
     }
     va_end(ap);
 
@@ -384,17 +379,12 @@ fail:
 void pa_dbus_remove_matches(DBusConnection *c, ...) {
     const char *t;
     va_list ap;
-    DBusError error;
 
     pa_assert(c);
 
-    dbus_error_init(&error);
-
     va_start(ap, c);
-    while ((t = va_arg(ap, const char*))) {
-        dbus_bus_remove_match(c, t, &error);
-        dbus_error_free(&error);
-    }
+    while ((t = va_arg(ap, const char*)))
+        dbus_bus_remove_match(c, t, NULL);
     va_end(ap);
 }
 
-- 
1.7.7.3



More information about the pulseaudio-discuss mailing list