diff options
author | David Robillard <d@drobilla.net> | 2018-12-26 19:25:51 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-12-19 20:52:34 -0500 |
commit | e61d7f710465ca8c87274d9664afeb0b125597a4 (patch) | |
tree | e90661112ed48f7e0e44932b21f59c2c148f1e25 /src/byte_source.h | |
parent | 5522f5ff705374d8d7bba3d21a05674640967c3e (diff) | |
download | serd-e61d7f710465ca8c87274d9664afeb0b125597a4.tar.gz serd-e61d7f710465ca8c87274d9664afeb0b125597a4.tar.bz2 serd-e61d7f710465ca8c87274d9664afeb0b125597a4.zip |
Hide fopen wrapper and use reader interface consistently
Diffstat (limited to 'src/byte_source.h')
-rw-r--r-- | src/byte_source.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/byte_source.h b/src/byte_source.h index dcf97bac..7a04db8d 100644 --- a/src/byte_source.h +++ b/src/byte_source.h @@ -23,6 +23,8 @@ #include <stddef.h> #include <stdio.h> +typedef int (*SerdStreamCloseFunc)(void*); + typedef struct { const char* filename; unsigned line; @@ -32,6 +34,7 @@ typedef struct { typedef struct { SerdReadFunc 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 size_t buf_size; ///< Number of bytes in file_buf @@ -46,17 +49,13 @@ typedef struct { } SerdByteSource; SerdStatus -serd_byte_source_open_file(SerdByteSource* source, - FILE* file, - bool bulk); - -SerdStatus serd_byte_source_open_string(SerdByteSource* source, const char* utf8); SerdStatus serd_byte_source_open_source(SerdByteSource* source, SerdReadFunc read_func, SerdStreamErrorFunc error_func, + SerdStreamCloseFunc close_func, void* stream, const char* name, size_t page_size); |