bluez5-util: add destroy function
authorWim Taymans <wim.taymans@gmail.com>
Fri, 24 Oct 2014 07:56:50 +0000 (09:56 +0200)
committerArun Raghavan <arun@accosted.net>
Fri, 31 Oct 2014 05:16:10 +0000 (10:46 +0530)
Add a destroy function to the transport that is called before freeing
the transport. Useful for cleaning up extra userdata.

src/modules/bluetooth/bluez5-util.c
src/modules/bluetooth/bluez5-util.h

index 1ee2f33c9bf9dc5345dbcd621c3055a633351bbd..9431aed6e4858966618996c0ba20c683ed358f01 100644 (file)
@@ -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);
index 8db4a177d8f1b10d65ec310966dc6f17a17d237d..1a8a364da07901c24c4df39c983631d132358e1f 100644 (file)
@@ -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;
 };