diff options
Diffstat (limited to 'host/lib/transport')
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 12 | ||||
-rw-r--r-- | host/lib/transport/udp_zero_copy.cpp | 12 |
2 files changed, 4 insertions, 20 deletions
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index d4cfab422..28bea978b 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -73,14 +73,10 @@ public: sptr get_new(void){ _expired = false; - return sptr(this, &libusb_zero_copy_mrb::fake_deleter); + return make_managed_buffer(this); } private: - static void fake_deleter(void *obj){ - static_cast<libusb_zero_copy_mrb *>(obj)->release(); - } - const void *get_buff(void) const{return _lut->buffer;} size_t get_size(void) const{return _lut->actual_length;} @@ -108,14 +104,10 @@ public: sptr get_new(void){ _expired = false; - return sptr(this, &libusb_zero_copy_msb::fake_deleter); + return make_managed_buffer(this); } private: - static void fake_deleter(void *obj){ - static_cast<libusb_zero_copy_msb *>(obj)->commit(0); - } - void *get_buff(void) const{return _lut->buffer;} size_t get_size(void) const{return _lut->length;} diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index c3ba085bf..8c97e1e99 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -52,16 +52,12 @@ public: sptr get_new(size_t len){ _len = len; - return sptr(this, &udp_zero_copy_asio_mrb::fake_deleter); + return make_managed_buffer(this); } template <class T> T cast(void) const{return static_cast<T>(_mem);} private: - static void fake_deleter(void *obj){ - static_cast<udp_zero_copy_asio_mrb *>(obj)->release(); - } - const void *get_buff(void) const{return _mem;} size_t get_size(void) const{return _len;} @@ -90,14 +86,10 @@ public: sptr get_new(size_t len){ _len = len; - return sptr(this, &udp_zero_copy_asio_msb::fake_deleter); + return make_managed_buffer(this); } private: - static void fake_deleter(void *obj){ - static_cast<udp_zero_copy_asio_msb *>(obj)->commit(0); - } - void *get_buff(void) const{return _mem;} size_t get_size(void) const{return _len;} |