25 #include <citrusleaf/alloc.h>
35 #define AS_STREAM_END ((void *) 0)
41 struct as_stream_hooks_s;
46 typedef enum as_stream_status_e {
59 typedef struct as_stream_s {
75 const struct as_stream_hooks_s *
hooks;
85 typedef struct as_stream_hooks_s {
127 if ( !stream )
return stream;
129 stream->
free =
false;
131 stream->
hooks = hooks;
148 if ( !stream )
return stream;
152 stream->
hooks = hooks;
168 if ( stream && stream->
free ) {
188 return (stream ? stream->
data : NULL);
216 return stream != NULL && stream->
hooks != NULL && stream->
hooks->read;
246 return stream != NULL && stream->
hooks != NULL && stream->
hooks->write;
void as_stream_free(void *ptr)
static as_stream * as_stream_init(as_stream *stream, void *data, const as_stream_hooks *hooks)
static as_stream * as_stream_new(void *data, const as_stream_hooks *hooks)
static as_stream_status as_stream_write(const as_stream *stream, as_val *value)
static as_val * as_stream_read(const as_stream *stream)
#define as_util_hook(hook, default, object, args...)
static bool as_stream_writable(const as_stream *stream)
static void * as_stream_source(const as_stream *stream)
const struct as_stream_hooks_s * hooks
static bool as_stream_readable(const as_stream *stream)
static void as_stream_destroy(as_stream *stream)
void * as_stream_malloc(size_t size)