summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index c14a848..2b32a94 100644
--- a/src/util.c
+++ b/src/util.c
@@ -22,6 +22,21 @@ int stream_rewind(struct stream * const restrict in)
return ret;
}
+int stream_skip(struct stream * const restrict in)
+{
+ int ret = 0;
+ size_t ss;
+ struct entry_l discard;
+
+ ss = in->settings->ss;
+
+ while (ss--) {
+ in->get(in, &discard);
+ }
+
+ return ret;
+}
+
int split(struct stream * const src, struct stream * const A, struct stream * const B)
{
int ret = 0;
@@ -57,6 +72,7 @@ int split(struct stream * const src, struct stream * const A, struct stream * co
try_s((ret = src->copy(src, A)), err);
try_s((ret = cache_create(B)), err);
try_s((ret = src->copy(src, B)), err);
+ stream_rewind(src);
} else {
A->name = B->name = src->name;
A->type = B->type = stream_lite;
@@ -64,6 +80,7 @@ int split(struct stream * const src, struct stream * const A, struct stream * co
try_s((ret = src->copy(src, A)), err);
try_s((ret = stream_open(B)), err);
try_s((ret = src->copy(src, B)), err);
+ stream_rewind(src);
}
A->settings = B->settings = src->settings;