summaryrefslogtreecommitdiff
path: root/src/io.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-08-23 15:05:16 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-08-23 17:02:50 +0300
commit72d8cb8937c5ffa7016ef3fdfeb17c5abae97b61 (patch)
treef0a16e94666c01a1b87bbe1b4ddbf94c90fae291 /src/io.c
parent91085a48742611182f08b0c83621641261bca850 (diff)
downloadapk-tools-72d8cb8937c5ffa7016ef3fdfeb17c5abae97b61.tar.gz
apk-tools-72d8cb8937c5ffa7016ef3fdfeb17c5abae97b61.tar.bz2
apk-tools-72d8cb8937c5ffa7016ef3fdfeb17c5abae97b61.tar.xz
apk-tools-72d8cb8937c5ffa7016ef3fdfeb17c5abae97b61.zip
remove IS_ERR_OR_NULL
In most places where pointer can be an 'error' it cannot be null pointer. Further, in those cases just calling PTR_ERR() is not enough to handle the null case. Simplify code by removing this case. If NULL case needs to be handled, it's better to add separate check and return fixed error code in that case.
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/io.c b/src/io.c
index 218e008..a8821e4 100644
--- a/src/io.c
+++ b/src/io.c
@@ -154,7 +154,7 @@ void *apk_istream_peek(struct apk_istream *is, size_t len)
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;
+ if (!IS_ERR(p)) is->ptr += len;
else apk_istream_error(is, PTR_ERR(p));
return p;
}
@@ -595,7 +595,7 @@ struct apk_istream *__apk_istream_from_file(int atfd, const char *file, int try_
if (try_mmap) {
struct apk_istream *is = apk_mmap_istream_from_fd(fd);
- if (!IS_ERR_OR_NULL(is)) return is;
+ if (!IS_ERR(is)) return is;
}
return apk_istream_from_fd(fd);
}
@@ -816,7 +816,7 @@ int apk_fileinfo_get(int atfd, const char *filename, unsigned int flags,
apk_digest_calc(&fi->digest, hash_alg, target, st.st_size);
} else {
struct apk_istream *is = apk_istream_from_file(atfd, filename);
- if (!IS_ERR_OR_NULL(is)) {
+ if (!IS_ERR(is)) {
struct apk_digest_ctx dctx;
apk_blob_t blob;
@@ -995,7 +995,7 @@ struct apk_ostream *apk_ostream_to_file(int atfd, const char *file, mode_t mode)
if (fd < 0) return ERR_PTR(-errno);
os = apk_ostream_to_fd(fd);
- if (IS_ERR_OR_NULL(os)) return ERR_CAST(os);
+ if (IS_ERR(os)) return ERR_CAST(os);
struct apk_fd_ostream *fos = container_of(os, struct apk_fd_ostream, os);
fos->file = file;