summaryrefslogtreecommitdiffstats
path: root/tests/ingen_bench.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-07 22:42:29 +0100
committerDavid Robillard <d@drobilla.net>2019-03-08 09:08:16 +0100
commitce3f3aff9c27f902c6b6b5a0f8d9bdc3dfb26c3f (patch)
tree4608634b1b306c8cf27c5a9ed97f445b5ca3fa91 /tests/ingen_bench.cpp
parent8eba534e99cd8db29cca03035a115312935a22a3 (diff)
downloadingen-ce3f3aff9c27f902c6b6b5a0f8d9bdc3dfb26c3f.tar.gz
ingen-ce3f3aff9c27f902c6b6b5a0f8d9bdc3dfb26c3f.tar.bz2
ingen-ce3f3aff9c27f902c6b6b5a0f8d9bdc3dfb26c3f.zip
Use smart pointers to manage World in programs
Diffstat (limited to 'tests/ingen_bench.cpp')
-rw-r--r--tests/ingen_bench.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/ingen_bench.cpp b/tests/ingen_bench.cpp
index b51ec364..1a0d84ca 100644
--- a/tests/ingen_bench.cpp
+++ b/tests/ingen_bench.cpp
@@ -35,14 +35,14 @@
using namespace std;
using namespace ingen;
-World* world = nullptr;
+unique_ptr<World> world;
static void
ingen_try(bool cond, const char* msg)
{
if (!cond) {
cerr << "ingen: Error: " << msg << endl;
- delete world;
+ world.reset();
exit(EXIT_FAILURE);
}
}
@@ -63,7 +63,7 @@ main(int argc, char** argv)
// Create world
try {
- world = new World(nullptr, nullptr, nullptr);
+ world = unique_ptr<World>{new World(nullptr, nullptr, nullptr)};
world->conf().add(
"output", "output", 'O', "File to write benchmark output",
ingen::Configuration::SESSION, world->forge().String, Atom());
@@ -135,6 +135,5 @@ main(int argc, char** argv)
// Shut down
world->engine()->deactivate();
- delete world;
return EXIT_SUCCESS;
}