diff options
Diffstat (limited to 'src/io.h')
| -rw-r--r-- | src/io.h | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -26,32 +26,30 @@ segment. Used for freeing and unmapping purposes, if necessary. */ enum _location { HEAP, -} +}; /* Structure to emulate a stream of data that maintains a current position. The structure additionally maintains a `length` variable containing the stream's length. */ struct stream { size_t len; /* Length of the stream. */ - void *_start; /* Pointer to the stream's start. */ - void *_cur; /* Pointer to the current position. */ + char *_start; /* Pointer to the stream's start. */ + char *_cur; /* Pointer to the current position. */ enum _location _loc; /* Location of the stream in memory. */ -} +}; -/* Allocates `len` bytes of memory and returns a new stream pointing to - it. The memory provided has not zeroed. */ +/* Allocates `len` bytes of non-zeroed memory and returns a new stream + structure pointing to it. */ struct stream *stream_new(size_t len); /* Called to free or unmap the memory chunk associated with the given stream, as well as the stream structure itself. */ void stream_free(struct stream *s); - /* Copies `n` bytes from the given stream into the memory area specified - by `dest`. The stream is advanced appropriately. */ + by `dest`. The stream's cursor is advanced appropriately. */ void stream_read(void *dest, struct stream *s, size_t n); - /* Copies `n` bytes into the given stream from the memory area specified - by `src`. The stream is advanced appropriately. */ + by `src`. The stream's cursor is advanced appropriately. */ void stream_write(struct stream *s, void *src, size_t n); |