From aeb2baa495776d9fc06e63f91167c40c334303c8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 29 Dec 2013 18:08:49 +0100 Subject: InputStream: add static method OpenReady() Merge some duplicate code. --- test/dump_text_file.cxx | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'test/dump_text_file.cxx') diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx index 3da965f03..764d3f24b 100644 --- a/test/dump_text_file.cxx +++ b/test/dump_text_file.cxx @@ -49,23 +49,6 @@ dump_text_file(TextInputStream &is) static int dump_input_stream(InputStream &is) { - Error error; - - is.Lock(); - - /* wait until the stream becomes ready */ - - is.WaitReady(); - - if (!is.Check(error)) { - LogError(error); - is.Unlock(); - return EXIT_FAILURE; - } - - /* read data and tags from the stream */ - - is.Unlock(); { TextInputStream tis(is); dump_text_file(tis); @@ -73,6 +56,7 @@ dump_input_stream(InputStream &is) is.Lock(); + Error error; if (!is.Check(error)) { LogError(error); is.Unlock(); @@ -121,7 +105,7 @@ int main(int argc, char **argv) Mutex mutex; Cond cond; - InputStream *is = InputStream::Open(argv[1], mutex, cond, error); + InputStream *is = InputStream::OpenReady(argv[1], mutex, cond, error); if (is != NULL) { ret = dump_input_stream(*is); is->Close(); -- cgit v1.2.3