diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2014-10-24 09:56:50 +0200 |
---|---|---|
committer | Arun Raghavan <arun@accosted.net> | 2014-10-31 10:46:10 +0530 |
commit | d7199bafea7be9ca26ee9a551e245de0f4bc9e29 (patch) | |
tree | b6f2c722e110115b9cd3b2224c2beb2b87757696 | |
parent | 2251085ddacd780163ed2d84194aff3a0d5153f7 (diff) |
bluez5-util: add destroy function
Add a destroy function to the transport that is called before freeing
the transport. Useful for cleaning up extra userdata.
-rw-r--r-- | src/modules/bluetooth/bluez5-util.c | 2 | ||||
-rw-r--r-- | src/modules/bluetooth/bluez5-util.h | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c index 1ee2f33c9..9431aed6e 100644 --- a/src/modules/bluetooth/bluez5-util.c +++ b/src/modules/bluetooth/bluez5-util.c @@ -205,6 +205,8 @@ void pa_bluetooth_transport_unlink(pa_bluetooth_transport *t) { void pa_bluetooth_transport_free(pa_bluetooth_transport *t) { pa_assert(t); + if (t->destroy) + t->destroy(t); pa_bluetooth_transport_unlink(t); pa_xfree(t->owner); diff --git a/src/modules/bluetooth/bluez5-util.h b/src/modules/bluetooth/bluez5-util.h index 8db4a177d..1a8a364da 100644 --- a/src/modules/bluetooth/bluez5-util.h +++ b/src/modules/bluetooth/bluez5-util.h @@ -60,6 +60,7 @@ typedef enum pa_bluetooth_transport_state { typedef int (*pa_bluetooth_transport_acquire_cb)(pa_bluetooth_transport *t, bool optional, size_t *imtu, size_t *omtu); typedef void (*pa_bluetooth_transport_release_cb)(pa_bluetooth_transport *t); +typedef void (*pa_bluetooth_transport_destroy_cb)(pa_bluetooth_transport *t); struct pa_bluetooth_transport { pa_bluetooth_device *device; @@ -76,6 +77,7 @@ struct pa_bluetooth_transport { pa_bluetooth_transport_acquire_cb acquire; pa_bluetooth_transport_release_cb release; + pa_bluetooth_transport_destroy_cb destroy; void *userdata; }; |