From a3b6babaf0186b34d801a75b62253573ef26a154 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 10 May 2018 20:59:45 +0200 Subject: Hide fopen wrapper and use reader interface consistently --- src/byte_source.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/byte_source.h') diff --git a/src/byte_source.h b/src/byte_source.h index c6c4702e..fa016ee5 100644 --- a/src/byte_source.h +++ b/src/byte_source.h @@ -23,6 +23,8 @@ #include #include +typedef int (*SerdStreamCloseFunc)(void*); + typedef struct { const char* filename; unsigned line; @@ -32,6 +34,7 @@ typedef struct { typedef struct { SerdSource read_func; ///< Read function (e.g. fread) SerdStreamErrorFunc error_func; ///< Error function (e.g. ferror) + SerdStreamCloseFunc close_func; ///< Function for closing stream void* stream; ///< Stream (e.g. FILE) size_t page_size; ///< Number of bytes to read at a time Cursor cur; ///< Cursor for error reporting @@ -44,11 +47,6 @@ typedef struct { bool eof; ///< True iff end of file reached } SerdByteSource; -SerdStatus -serd_byte_source_open_file(SerdByteSource* source, - FILE* file, - bool bulk); - SerdStatus serd_byte_source_open_string(SerdByteSource* source, const char* utf8); @@ -56,6 +54,7 @@ SerdStatus serd_byte_source_open_source(SerdByteSource* source, SerdSource read_func, SerdStreamErrorFunc error_func, + SerdStreamCloseFunc close_func, void* stream, const char* name, size_t page_size); -- cgit v1.2.1