summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-07-31 22:50:51 -0400
committerDavid Robillard <d@drobilla.net>2016-07-31 22:50:51 -0400
commita3b28f2924801bd59ea7924a652247269e6af928 (patch)
treec9ff4aa5302ab83eefe4cfb873a02deeca62a861 /src
parentc8ae7295e911c62cf9dedf90187656937cc18cbb (diff)
downloadingen-a3b28f2924801bd59ea7924a652247269e6af928.tar.gz
ingen-a3b28f2924801bd59ea7924a652247269e6af928.tar.bz2
ingen-a3b28f2924801bd59ea7924a652247269e6af928.zip
Reduce duplicated code
Diffstat (limited to 'src')
-rw-r--r--src/server/LV2Options.hpp9
-rw-r--r--src/server/LV2ResizeFeature.hpp9
-rw-r--r--src/server/Worker.cpp9
3 files changed, 5 insertions, 22 deletions
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 <http://drobilla.net/>
+ Copyright 2007-2016 David Robillard <http://drobilla.net/>
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<LV2_Feature>(f, &delete_feature);
+ return SPtr<LV2_Feature>(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 <http://drobilla.net/>
+ Copyright 2007-2016 David Robillard <http://drobilla.net/>
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<LV2_Feature> 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<LV2_Feature>(f, &delete_feature);
+ return SPtr<LV2_Feature>(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<LV2_Feature>
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<LV2_Feature>(f, &delete_feature);
+ return SPtr<LV2_Feature>(f, &free_feature);
}
Worker::Worker(Log& log, uint32_t buffer_size)