diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-07-17 15:43:08 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-07-22 15:30:08 +0300 |
commit | b559a81694d8a95ac786104516aebf98d04b84bc (patch) | |
tree | 2bd4601015e0d7202c3eb685bf79756022d11b06 /src/apk_io.h | |
parent | 94c5e01038a819e8abd062ed81aec321cdff4aa3 (diff) | |
download | apk-tools-b559a81694d8a95ac786104516aebf98d04b84bc.tar.gz apk-tools-b559a81694d8a95ac786104516aebf98d04b84bc.tar.bz2 apk-tools-b559a81694d8a95ac786104516aebf98d04b84bc.tar.xz apk-tools-b559a81694d8a95ac786104516aebf98d04b84bc.zip |
io: rework apk_istream_get_* to not return erros in blob value
The interface was slightly cumbersome, so replace these functions
to return explicit error, and make the return blob a pointer arg.
Diffstat (limited to 'src/apk_io.h')
-rw-r--r-- | src/apk_io.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/apk_io.h b/src/apk_io.h index b0971cd..4f03dbc 100644 --- a/src/apk_io.h +++ b/src/apk_io.h @@ -98,9 +98,9 @@ apk_blob_t apk_istream_mmap(struct apk_istream *is); ssize_t apk_istream_read(struct apk_istream *is, void *ptr, size_t size); void *apk_istream_peek(struct apk_istream *is, size_t len); void *apk_istream_get(struct apk_istream *is, size_t len); -apk_blob_t apk_istream_get_max(struct apk_istream *is, size_t size); -apk_blob_t apk_istream_get_delim(struct apk_istream *is, apk_blob_t token); -static inline apk_blob_t apk_istream_get_all(struct apk_istream *is) { return apk_istream_get_max(is, APK_IO_ALL); } +int apk_istream_get_max(struct apk_istream *is, size_t size, apk_blob_t *data); +int apk_istream_get_delim(struct apk_istream *is, apk_blob_t token, apk_blob_t *data); +static inline int apk_istream_get_all(struct apk_istream *is, apk_blob_t *data) { return apk_istream_get_max(is, APK_IO_ALL, data); } ssize_t apk_istream_splice(struct apk_istream *is, int fd, size_t size, apk_progress_cb cb, void *cb_ctx, struct apk_digest_ctx *dctx); ssize_t apk_stream_copy(struct apk_istream *is, struct apk_ostream *os, size_t size, |