test/{run_input,dump_text_file}: use class ScopeLock

This commit is contained in:
Max Kellermann 2016-05-02 23:35:43 +02:00
parent 280d35a053
commit 69ed35ed71
2 changed files with 2 additions and 8 deletions

View File

@ -51,17 +51,14 @@ dump_input_stream(InputStreamPtr &&is)
dump_text_file(tis); dump_text_file(tis);
} }
is->Lock(); const ScopeLock protect(is->mutex);
Error error; Error error;
if (!is->Check(error)) { if (!is->Check(error)) {
LogError(error); LogError(error);
is->Unlock();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
is->Unlock();
return 0; return 0;
} }

View File

@ -49,7 +49,7 @@ tag_save(FILE *file, const Tag &tag)
static int static int
dump_input_stream(InputStream *is) dump_input_stream(InputStream *is)
{ {
is->Lock(); const ScopeLock protect(is->mutex);
/* print meta data */ /* print meta data */
@ -84,12 +84,9 @@ dump_input_stream(InputStream *is)
Error error; Error error;
if (!is->Check(error)) { if (!is->Check(error)) {
LogError(error); LogError(error);
is->Unlock();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
is->Unlock();
return 0; return 0;
} }