diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-08-23 15:05:16 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-08-23 17:02:50 +0300 |
commit | 72d8cb8937c5ffa7016ef3fdfeb17c5abae97b61 (patch) | |
tree | f0a16e94666c01a1b87bbe1b4ddbf94c90fae291 /src/database.c | |
parent | 91085a48742611182f08b0c83621641261bca850 (diff) | |
download | apk-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/database.c')
-rw-r--r-- | src/database.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/database.c b/src/database.c index 863829d..f64d706 100644 --- a/src/database.c +++ b/src/database.c @@ -704,7 +704,7 @@ int apk_db_read_overlay(struct apk_database *db, struct apk_istream *is) struct apk_installed_package *ipkg; apk_blob_t token = APK_BLOB_STR("\n"), line, bdir, bfile; - if (IS_ERR_OR_NULL(is)) return PTR_ERR(is); + if (IS_ERR(is)) return PTR_ERR(is); pkg = apk_pkg_new(); if (!pkg) goto no_mem; @@ -758,7 +758,7 @@ int apk_db_index_read(struct apk_database *db, struct apk_istream *is, int repo) gid_t gid; int field, r, lineno = 0; - if (IS_ERR_OR_NULL(is)) return PTR_ERR(is); + if (IS_ERR(is)) return PTR_ERR(is); while (apk_istream_get_delim(is, token, &l) == 0) { lineno++; @@ -1223,7 +1223,7 @@ static int apk_db_index_write_nr_cache(struct apk_database *db) /* Write list of installed non-repository packages to * cached index file */ os = apk_ostream_to_file(db->cache_fd, "installed", 0644); - if (IS_ERR_OR_NULL(os)) return PTR_ERR(os); + if (IS_ERR(os)) return PTR_ERR(os); ctx.os = os; list_for_each_entry(ipkg, &db->installed.packages, installed_pkgs_list) { @@ -2769,7 +2769,7 @@ static int apk_db_unpack_pkg(struct apk_database *db, need_copy = FALSE; is = apk_istream_from_fd_url(filefd, file, apk_db_url_since(db, 0)); - if (IS_ERR_OR_NULL(is)) { + if (IS_ERR(is)) { r = PTR_ERR(is); if (r == -ENOENT && pkg->filename == NULL) r = -APKE_INDEX_STALE; |