diff options
author | David Robillard <d@drobilla.net> | 2022-10-02 09:08:22 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 16:27:02 -0500 |
commit | 8978501e5cf06f366eb14f6ef5f5f7f2f8e34986 (patch) | |
tree | 203504ff9b58fc1ba5b71ed1d066104f6a08ffb9 /src/byte_source.h | |
parent | c2e59da8865a8c5719b8ddaf5f68204729a8ebab (diff) | |
download | serd-8978501e5cf06f366eb14f6ef5f5f7f2f8e34986.tar.gz serd-8978501e5cf06f366eb14f6ef5f5f7f2f8e34986.tar.bz2 serd-8978501e5cf06f366eb14f6ef5f5f7f2f8e34986.zip |
Simplify reader interface
Diffstat (limited to 'src/byte_source.h')
-rw-r--r-- | src/byte_source.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/byte_source.h b/src/byte_source.h index 5290dca2..e2697bd2 100644 --- a/src/byte_source.h +++ b/src/byte_source.h @@ -12,7 +12,8 @@ #include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include <stdio.h> + +typedef int (*SerdStreamCloseFunc)(void*); typedef struct { const char* filename; @@ -23,6 +24,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 @@ -37,15 +39,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); |