summaryrefslogtreecommitdiff
path: root/src/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/io.c b/src/io.c
index 5a426cf..0ec278b 100644
--- a/src/io.c
+++ b/src/io.c
@@ -130,12 +130,11 @@ static int __apk_istream_fill(struct apk_istream *is)
return 0;
}
-void *apk_istream_get(struct apk_istream *is, size_t len)
+void *apk_istream_peek(struct apk_istream *is, size_t len)
{
do {
if (is->end - is->ptr >= len) {
void *ptr = is->ptr;
- is->ptr += len;
return ptr;
}
} while (!__apk_istream_fill(is));
@@ -147,6 +146,13 @@ void *apk_istream_get(struct apk_istream *is, size_t len)
return ERR_PTR(-EIO);
}
+void *apk_istream_get(struct apk_istream *is, size_t len)
+{
+ void *p = apk_istream_peek(is, len);
+ if (!IS_ERR_OR_NULL(p)) is->ptr += len;
+ return p;
+}
+
apk_blob_t apk_istream_get_max(struct apk_istream *is, size_t max)
{
if (is->ptr == is->end)