aboutsummaryrefslogtreecommitdiffstats
path: root/src/byte_source.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-16 12:42:58 +0200
committerDavid Robillard <d@drobilla.net>2022-01-13 23:03:30 -0500
commit00af9fa4e0344b1ff642a7ccd63626f77521ea8a (patch)
treebce03b485b9e93c92ddd15b303465b6a93095a08 /src/byte_source.h
parent6f362db2fbfe1b02929673aa9b0529b4328fb195 (diff)
downloadserd-00af9fa4e0344b1ff642a7ccd63626f77521ea8a.tar.gz
serd-00af9fa4e0344b1ff642a7ccd63626f77521ea8a.tar.bz2
serd-00af9fa4e0344b1ff642a7ccd63626f77521ea8a.zip
Simplify reader interface
Diffstat (limited to 'src/byte_source.h')
-rw-r--r--src/byte_source.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/byte_source.h b/src/byte_source.h
index a5c98ef6..69f92295 100644
--- a/src/byte_source.h
+++ b/src/byte_source.h
@@ -23,7 +23,8 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
-#include <stdio.h>
+
+typedef int (*SerdStreamCloseFunc)(void*);
typedef struct {
const char* filename;
@@ -34,6 +35,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
@@ -48,15 +50,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);