[pulseaudio-commits] 3 commits - src/modules src/pulsecore

Tanu Kaskinen tanuk at kemper.freedesktop.org
Sat Jan 28 04:32:30 PST 2012


 src/modules/bluetooth/module-bluetooth-proximity.c |   12 ++++++------
 src/pulsecore/dbus-util.c                          |   16 +++-------------
 2 files changed, 9 insertions(+), 19 deletions(-)

New commits:
commit 54ca23df6fb27b0874f72d8c747d8674c1028fb2
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Sun Jan 1 19:44:28 2012 +0200

    bluetooth: Change function name add_matches to update_matches.
    
    A function that is used for removing matches should not be
    called add_matches.

diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c
index 9ba3fd8..3247017 100644
--- a/src/modules/bluetooth/module-bluetooth-proximity.c
+++ b/src/modules/bluetooth/module-bluetooth-proximity.c
@@ -325,7 +325,7 @@ finish:
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
-static int add_matches(struct userdata *u, pa_bool_t add) {
+static int update_matches(struct userdata *u, pa_bool_t add) {
     char *filter1, *filter2;
     DBusError e;
     int r = -1;
@@ -401,7 +401,7 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
-    if (add_matches(u, TRUE) < 0)
+    if (update_matches(u, TRUE) < 0)
         goto fail;
 
     pa_assert_se(msg = dbus_message_new_method_call("org.bluez", u->hci_path, "org.bluez.Adapter", "ListBondings"));
@@ -476,7 +476,7 @@ void pa__done(pa_module*m) {
     }
 
     if (u->dbus_connection) {
-        add_matches(u, FALSE);
+        update_matches(u, FALSE);
         pa_dbus_connection_unref(u->dbus_connection);
     }
 

commit 8846239be730b3f99c982b54a4171b20e68bcc00
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Sun Jan 1 19:44:27 2012 +0200

    bluetooth: Remove the right match in the proximity module.
    
    The original intention of this code was probably that if
    adding filter1 succeeded but adding filter2 failed, then
    filter1 should be removed so that either both or none of the
    filters get added.

diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c
index 7560f5a..9ba3fd8 100644
--- a/src/modules/bluetooth/module-bluetooth-proximity.c
+++ b/src/modules/bluetooth/module-bluetooth-proximity.c
@@ -352,7 +352,7 @@ 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, NULL);
+            dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter1, NULL);
             goto finish;
         }
     } else

commit 7e4eef2179f93fa99c110da65b497fec5996df2d
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Sun Jan 1 19:44:26 2012 +0200

    dbus: Give NULL as the error parameter to dbus_bus_remove_match().
    
    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.

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 3daf90f..adffa88 100644
--- a/src/pulsecore/dbus-util.c
+++ b/src/pulsecore/dbus-util.c
@@ -367,13 +367,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);
 
@@ -383,17 +378,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);
 }
 



More information about the pulseaudio-commits mailing list