From 2746098ad7d9f9d81e616a25e16aeae784f438a5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 2 Aug 2021 11:32:31 -0400 Subject: Factor out opening input files --- src/serdi.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/serdi.c') diff --git a/src/serdi.c b/src/serdi.c index 890408d2..56762b23 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -147,18 +147,8 @@ read_file(SerdWorld* const world, syntax = syntax ? syntax : serd_guess_syntax(filename); syntax = syntax ? syntax : SERD_TRIG; - SerdByteSource* byte_source = NULL; - if (!strcmp(filename, "-")) { - SerdNode* name = serd_new_string(SERD_STRING("stdin")); - - byte_source = serd_byte_source_new_function( - serd_file_read_byte, (SerdStreamErrorFunc)ferror, NULL, stdin, name, 1); - - serd_node_free(name); - } else { - byte_source = - serd_byte_source_new_filename(filename, bulk_read ? SERD_PAGE_SIZE : 1u); - } + SerdByteSource* byte_source = + serd_open_input(filename, bulk_read ? SERD_PAGE_SIZE : 1u); if (!byte_source) { SERDI_ERRORF( -- cgit v1.2.1