mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa: bluez: use spa_autoptr for DBusMessage
This commit is contained in:
parent
c6c3259a08
commit
6e581deb91
8 changed files with 205 additions and 360 deletions
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef SPA_BLUEZ5_DBUS_HELPERS_H
|
||||
#define SPA_BLUEZ5_DBUS_HELPERS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include <spa/utils/cleanup.h>
|
||||
|
|
@ -29,4 +31,17 @@ static inline DBusMessage *steal_reply_and_unref(DBusPendingCall **pp)
|
|||
return reply;
|
||||
}
|
||||
|
||||
SPA_DEFINE_AUTOPTR_CLEANUP(DBusMessage, DBusMessage, {
|
||||
spa_clear_ptr(*thing, dbus_message_unref);
|
||||
})
|
||||
|
||||
static inline bool reply_with_error(DBusConnection *conn,
|
||||
DBusMessage *reply_to,
|
||||
const char *error_name, const char *error_message)
|
||||
{
|
||||
spa_autoptr(DBusMessage) reply = dbus_message_new_error(reply_to, error_name, error_message);
|
||||
|
||||
return reply && dbus_connection_send(conn, reply, NULL);
|
||||
}
|
||||
|
||||
#endif /* SPA_BLUEZ5_DBUS_HELPERS_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue