25 #include <citrusleaf/alloc.h>
31 #define AS_STREAM_END ((void *) 0)
37 struct as_stream_hooks_s;
42 typedef enum as_stream_status_e {
55 typedef struct as_stream_s {
71 const struct as_stream_hooks_s *
hooks;
81 typedef struct as_stream_hooks_s {
123 if ( !stream )
return stream;
125 stream->
free =
false;
127 stream->
hooks = hooks;
144 if ( !stream )
return stream;
148 stream->
hooks = hooks;
164 if ( stream && stream->
free ) {
184 return (stream ? stream->
data : NULL);
212 return stream != NULL && stream->
hooks != NULL && stream->
hooks->read;
242 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)
static bool as_stream_readable(const as_stream *stream)
static void as_stream_destroy(as_stream *stream)
void * as_stream_malloc(size_t size)
struct as_stream_hooks_s * hooks