From a3b28f2924801bd59ea7924a652247269e6af928 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 31 Jul 2016 22:50:51 -0400 Subject: Reduce duplicated code --- src/server/LV2Options.hpp | 9 ++------- src/server/LV2ResizeFeature.hpp | 9 ++------- src/server/Worker.cpp | 9 +-------- 3 files changed, 5 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/server/LV2Options.hpp b/src/server/LV2Options.hpp index e7db2553..1ef8db91 100644 --- a/src/server/LV2Options.hpp +++ b/src/server/LV2Options.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard + Copyright 2007-2016 David Robillard Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -30,11 +30,6 @@ public: : _uris(uris) {} - static void delete_feature(LV2_Feature* feature) { - free(feature->data); - free(feature); - } - void set(int32_t sample_rate, int32_t block_length, int32_t seq_size) { _sample_rate = sample_rate; _block_length = block_length; @@ -60,7 +55,7 @@ public: f->URI = LV2_OPTIONS__options; f->data = malloc(sizeof(options)); memcpy(f->data, options, sizeof(options)); - return SPtr(f, &delete_feature); + return SPtr(f, &free_feature); } private: diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp index 8bfa5d12..f61165ee 100644 --- a/src/server/LV2ResizeFeature.hpp +++ b/src/server/LV2ResizeFeature.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard + Copyright 2007-2016 David Robillard Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -42,11 +42,6 @@ struct ResizeFeature : public Ingen::LV2Features::Feature { return LV2_RESIZE_PORT_ERR_UNKNOWN; } - static void delete_feature(LV2_Feature* feature) { - free(feature->data); - free(feature); - } - const char* uri() const { return LV2_RESIZE_PORT_URI; } SPtr feature(World* w, Node* n) { @@ -60,7 +55,7 @@ struct ResizeFeature : public Ingen::LV2Features::Feature { LV2_Feature* f = (LV2_Feature*)malloc(sizeof(LV2_Feature)); f->URI = LV2_RESIZE_PORT_URI; f->data = data; - return SPtr(f, &delete_feature); + return SPtr(f, &free_feature); } }; diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 6706f147..a89bd4b3 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -72,13 +72,6 @@ Worker::request(LV2Block* block, return LV2_WORKER_SUCCESS; } -static void -delete_feature(LV2_Feature* feature) -{ - free(feature->data); - free(feature); -} - SPtr Worker::Schedule::feature(World* world, Node* n) { @@ -96,7 +89,7 @@ Worker::Schedule::feature(World* world, Node* n) f->URI = LV2_WORKER__schedule; f->data = data; - return SPtr(f, &delete_feature); + return SPtr(f, &free_feature); } Worker::Worker(Log& log, uint32_t buffer_size) -- cgit v1.2.1