spa: bluez: use spa_auto for DBusError

This commit is contained in:
Barnabás Pőcze 2023-07-11 20:44:23 +02:00
parent b52d590936
commit ca85872e83
8 changed files with 44 additions and 124 deletions

View file

@ -464,12 +464,10 @@ static void mm_clean_modem(struct impl *this)
static DBusHandlerResult mm_filter_cb(DBusConnection *bus, DBusMessage *m, void *user_data)
{
struct impl *this = user_data;
DBusError err;
dbus_error_init(&err);
if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameOwnerChanged")) {
const char *name, *old_owner, *new_owner;
spa_auto(DBusError) err = DBUS_ERROR_INIT;
spa_log_debug(this->log, "Name owner changed %s", dbus_message_get_path(m));
@ -673,18 +671,16 @@ finish:
static int add_filters(struct impl *this)
{
DBusError err;
if (this->filters_added)
return 0;
dbus_error_init(&err);
if (!dbus_connection_add_filter(this->conn, mm_filter_cb, this, NULL)) {
spa_log_error(this->log, "failed to add filter function");
goto fail;
return -EIO;
}
spa_auto(DBusError) err = DBUS_ERROR_INIT;
dbus_bus_add_match(this->conn,
"type='signal',sender='org.freedesktop.DBus',"
"interface='org.freedesktop.DBus',member='NameOwnerChanged'," "arg0='" MM_DBUS_SERVICE "'", &err);
@ -710,10 +706,6 @@ static int add_filters(struct impl *this)
this->filters_added = true;
return 0;
fail:
dbus_error_free(&err);
return -EIO;
}
bool mm_is_available(void *modemmanager)