diff options
Diffstat (limited to 'src/byte_sink.h')
-rw-r--r-- | src/byte_sink.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/byte_sink.h b/src/byte_sink.h index f023f180..d117a589 100644 --- a/src/byte_sink.h +++ b/src/byte_sink.h @@ -22,19 +22,13 @@ #include <stddef.h> #include <string.h> -typedef enum { - TO_BUFFER, ///< Writing to a user-provided buffer - TO_FILENAME, ///< Writing to a file we opened - TO_FUNCTION, ///< Writing to a user-provided function -} SerdByteSinkType; - struct SerdByteSinkImpl { - SerdWriteFunc write_func; ///< User sink for TO_FUNCTION - void* stream; ///< User data for write_func - char* buf; ///< Local buffer iff block_size > 1 - size_t size; ///< Bytes written so far in this chunk - size_t block_size; ///< Size of chunks to write - SerdByteSinkType type; ///< Type of output + SerdWriteFunc write_func; ///< User sink for TO_FUNCTION + SerdStreamCloseFunc close_func; ///< Optional function to close stream + void* stream; ///< User data for write_func + char* buf; ///< Local buffer iff block_size > 1 + size_t size; ///< Bytes written so far in this chunk + size_t block_size; ///< Size of chunks to write }; static inline size_t |