summaryrefslogtreecommitdiffstats
path: root/src/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stream.c')
-rw-r--r--src/stream.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/stream.c b/src/stream.c
index e29d17d..83235a5 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -18,7 +18,7 @@
#include "cache.h"
static int stream_open_out(struct stream * const in);
-static int stream_open_out_lite(struct stream * const in);
+static int stream_open_lite(struct stream * const in);
static int stream_open_in(struct stream * const in);
static int stream_flush(struct stream * const in);
static int stream_flush_array(struct stream * const in);
@@ -31,8 +31,8 @@ int stream_open(struct stream * const in)
try(!in || in->fd > 0 || (!in->name && in->type != stream_randread), err, EINVAL, "invalid argunent");
switch (in->type) {
- case (stream_outlite):
- ret = stream_open_out_lite(in);
+ case (stream_lite):
+ ret = stream_open_lite(in);
break;
case (stream_out):
try(!in->name, err, EINVAL, "no filename given");
@@ -104,17 +104,15 @@ int stream_shallow_copy(struct stream const * const restrict src, struct stream
dest->settings = src->settings;
dest->index = 0;
- if (src->settings->access == cached) {
- dest->type = stream_cache;
- dest->get_next_element_cache = src->get_next_element_cache;
- dest->place_next_element_cache = src->place_next_element_cache;
- dest->split = src->split;
- dest->rewind = src->rewind;
- try_s((ret = cache_create(dest)), err);
- } else {
- rin_warn("stub!");
- ret = ENOSYS;
- }
+ dest->get = src->get;
+ dest->put = src->put;
+ dest->split = src->split;
+ dest->rewind = src->rewind;
+ dest->copy = src->copy;
+
+ dest->type = src->settings->access == cached ? stream_cache : stream_lite;
+
+ try_s((ret = cache_create(dest)), err);
err:
return ret;
@@ -150,7 +148,7 @@ err:
return ret;
}
-static int stream_open_out_lite(struct stream * const in)
+static int stream_open_lite(struct stream * const in)
{
struct stat st;
char *dname = NULL;