diff options
Diffstat (limited to 'src/stream.c')
-rw-r--r-- | src/stream.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/stream.c b/src/stream.c index 9de9e83..e29d17d 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-only */ -/* Copyright (C) 2020 Gediminas Jakutis */ +/* Copyright (C) 2020-2021 Gediminas Jakutis */ #include <sys/types.h> #include <sys/stat.h> @@ -96,38 +96,6 @@ err: return ret; } -int stream_readfile(struct stream * const in) -{ - ssize_t ret = 0; - size_t remaining = in->n * in->settings->stride; - ssize_t bytesread = 0; - size_t i; - - try(in->fd < 3, err, EINVAL, "no file open for reading"); - - do { - ret = read(in->fd, in->cache + bytesread, remaining); - if (ret < 0) { - try(errno != EAGAIN, err, errno, "Writing to stream failed with %zi", ret); - } else { - bytesread += ret; - remaining -= ret; - } - } while (ret); - - /* if this is a list, we need to adjust the link pointers from file offsets - * to buffer addresses. 'Cept for the last one, which needs to be NULL. - */ - if (in->settings->format == list) { - for (i = 0; i < (in->n - 1); ++i) { - in->cache_l[i].offset = (char *) in->cache_l[i].next - in->cache; - } - } - -err: - return ret; -} - int stream_shallow_copy(struct stream const * const restrict src, struct stream * const dest) { int ret = 0; |