From 69ed35ed71fc68b35e2e2e97902a3105d7d8443e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 2 May 2016 23:35:43 +0200 Subject: [PATCH] test/{run_input,dump_text_file}: use class ScopeLock --- test/dump_text_file.cxx | 5 +---- test/run_input.cxx | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx index 20af5678f..92ac64a12 100644 --- a/test/dump_text_file.cxx +++ b/test/dump_text_file.cxx @@ -51,17 +51,14 @@ dump_input_stream(InputStreamPtr &&is) dump_text_file(tis); } - is->Lock(); + const ScopeLock protect(is->mutex); Error error; if (!is->Check(error)) { LogError(error); - is->Unlock(); return EXIT_FAILURE; } - is->Unlock(); - return 0; } diff --git a/test/run_input.cxx b/test/run_input.cxx index 4433611f8..757895124 100644 --- a/test/run_input.cxx +++ b/test/run_input.cxx @@ -49,7 +49,7 @@ tag_save(FILE *file, const Tag &tag) static int dump_input_stream(InputStream *is) { - is->Lock(); + const ScopeLock protect(is->mutex); /* print meta data */ @@ -84,12 +84,9 @@ dump_input_stream(InputStream *is) Error error; if (!is->Check(error)) { LogError(error); - is->Unlock(); return EXIT_FAILURE; } - is->Unlock(); - return 0; }