From d6735d5685b08007344b7c94b2101de28ee4a5f2 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 11 Nov 2012 09:37:27 +0100 Subject: [PATCH] xbps_xasprintf: do not return NULL anymore; remove checks for this. --- bin/xbps-create/main.c | 3 --- bin/xbps-dgraph/main.c | 5 ----- bin/xbps-pkgdb/check_pkg_files.c | 8 -------- bin/xbps-pkgdb/check_pkg_symlinks.c | 4 ---- bin/xbps-query/ownedby.c | 3 --- bin/xbps-remove/main.c | 1 - bin/xbps-rindex/common.c | 2 -- bin/xbps-rindex/index-files.c | 5 +---- bin/xbps-rindex/index.c | 2 -- lib/download.c | 4 ---- lib/initend.c | 1 - lib/package_config_files.c | 13 ------------- lib/package_configure.c | 3 --- lib/package_conflicts.c | 2 -- lib/package_remove.c | 21 --------------------- lib/package_remove_obsoletes.c | 1 - lib/package_unpack.c | 26 -------------------------- lib/pkgdb.c | 2 -- lib/plist.c | 4 ---- lib/plist_find.c | 1 - lib/plist_match.c | 4 ---- lib/repository_sync_index.c | 19 ------------------- lib/transaction_package_replace.c | 2 -- lib/transaction_sortdeps.c | 1 - lib/util.c | 8 +++----- lib/util_hash.c | 1 - tests/libxbps/find_pkg/main.c | 1 - 27 files changed, 4 insertions(+), 143 deletions(-) diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c index 91038fea..4a41a45a 100644 --- a/bin/xbps-create/main.c +++ b/bin/xbps-create/main.c @@ -373,7 +373,6 @@ process_entry_file(struct archive *ar, struct xentry *xe, const char *filematch) entry = archive_entry_new(); assert(entry); p = xbps_xasprintf("%s/%s", destdir, xe->file); - assert(p); archive_entry_set_pathname(entry, xe->file); archive_entry_copy_sourcepath(entry, p); @@ -710,7 +709,6 @@ main(int argc, char **argv) * Create a temp file to store archive data. */ tname = xbps_xasprintf(".xbps-pkg-XXXXXX"); - assert(tname); pkg_fd = mkstemp(tname); assert(pkg_fd != -1); /* @@ -734,7 +732,6 @@ main(int argc, char **argv) * perspective it's atomic. */ binpkg = xbps_xasprintf("%s.%s.xbps", pkgver, arch); - assert(binpkg); (void)fsync(pkg_fd); myumask = umask(0); diff --git a/bin/xbps-dgraph/main.c b/bin/xbps-dgraph/main.c index 99999235..4b7a4db4 100644 --- a/bin/xbps-dgraph/main.c +++ b/bin/xbps-dgraph/main.c @@ -269,9 +269,6 @@ parse_array_in_pkg_dictionary(FILE *f, prop_dictionary_t plistd, if (strcmp(keyname, optional_objs[x]) == 0) { optnode = xbps_xasprintf("[style=\"%s\"", cfprop); - if (optnode == NULL) - die("alloc optnode"); - break; } } @@ -495,8 +492,6 @@ main(int argc, char **argv) */ if (outfile == NULL) { outfile = xbps_xasprintf("%s.dot", argv[0]); - if (outfile == NULL) - die("alloc outfile"); } /* diff --git a/bin/xbps-pkgdb/check_pkg_files.c b/bin/xbps-pkgdb/check_pkg_files.c index bf661c9c..4cb5106f 100644 --- a/bin/xbps-pkgdb/check_pkg_files.c +++ b/bin/xbps-pkgdb/check_pkg_files.c @@ -71,10 +71,6 @@ check_pkg_files(struct xbps_handle *xhp, while ((obj = prop_object_iterator_next(iter))) { prop_dictionary_get_cstring_nocopy(obj, "file", &file); path = xbps_xasprintf("%s/%s", xhp->rootdir, file); - if (path == NULL) { - prop_object_iterator_release(iter); - return -1; - } prop_dictionary_get_cstring_nocopy(obj, "sha256", &sha256); rv = xbps_file_hash_check(path, sha256); @@ -124,10 +120,6 @@ check_pkg_files(struct xbps_handle *xhp, while ((obj = prop_object_iterator_next(iter))) { prop_dictionary_get_cstring_nocopy(obj, "file", &file); path = xbps_xasprintf("%s/%s", xhp->rootdir, file); - if (path == NULL) { - prop_object_iterator_release(iter); - return -1; - } if ((rv = access(path, R_OK)) == -1) { if (errno == ENOENT) { xbps_error_printf( diff --git a/bin/xbps-pkgdb/check_pkg_symlinks.c b/bin/xbps-pkgdb/check_pkg_symlinks.c index 125c0d48..cbbcd2f2 100644 --- a/bin/xbps-pkgdb/check_pkg_symlinks.c +++ b/bin/xbps-pkgdb/check_pkg_symlinks.c @@ -78,9 +78,6 @@ check_pkg_symlinks(struct xbps_handle *xhp, continue; } path = xbps_xasprintf("%s/%s", xhp->rootdir, file); - if (path == NULL) - return -1; - if ((buf = realpath(path, NULL)) == NULL) { xbps_error_printf("%s: broken symlink `%s': " "%s\n", pkgname, file, strerror(errno)); @@ -91,7 +88,6 @@ check_pkg_symlinks(struct xbps_handle *xhp, /* relative symlink target */ dname = dirname(path); buf2 = xbps_xasprintf("%s/%s", dname, tgt); - assert(buf2); buf3 = realpath(buf2, NULL); assert(buf3); free(buf2); diff --git a/bin/xbps-query/ownedby.c b/bin/xbps-query/ownedby.c index b48ced83..7ad69100 100644 --- a/bin/xbps-query/ownedby.c +++ b/bin/xbps-query/ownedby.c @@ -85,9 +85,6 @@ ownedby(struct xbps_handle *xhp, int npatterns, char **patterns) unsigned int i, count; path = xbps_xasprintf("%s/metadata", xhp->metadir); - if (path == NULL) - return -1; - if ((dirp = opendir(path)) == NULL) { free(path); return -1; diff --git a/bin/xbps-remove/main.c b/bin/xbps-remove/main.c index 884848f0..cb7de99d 100644 --- a/bin/xbps-remove/main.c +++ b/bin/xbps-remove/main.c @@ -161,7 +161,6 @@ cachedir_clean(struct xbps_handle *xhp) } /* Internalize props.plist dictionary from binary pkg */ binpkg = xbps_xasprintf("%s/%s", xhp->cachedir, dp->d_name); - assert(binpkg != NULL); pkg_propsd = xbps_dictionary_metadata_plist_by_url(binpkg, "./props.plist"); if (pkg_propsd == NULL) { diff --git a/bin/xbps-rindex/common.c b/bin/xbps-rindex/common.c index 868b1696..cca7871a 100644 --- a/bin/xbps-rindex/common.c +++ b/bin/xbps-rindex/common.c @@ -44,7 +44,6 @@ remove_pkg(const char *repodir, const char *arch, const char *file) /* Remove real binpkg */ filepath = xbps_xasprintf("%s/%s/%s", repodir, arch, file); - assert(filepath); if (remove(filepath) == -1) { rv = errno; xbps_error_printf("failed to remove old binpkg `%s': %s\n", @@ -56,7 +55,6 @@ remove_pkg(const char *repodir, const char *arch, const char *file) /* Remove symlink to binpkg */ filepath = xbps_xasprintf("%s/%s", repodir, file); - assert(filepath); if (remove(filepath) == -1) { rv = errno; xbps_error_printf("failed to remove old binpkg `%s': %s\n", diff --git a/bin/xbps-rindex/index-files.c b/bin/xbps-rindex/index-files.c index ef88b2b2..a6a01231 100644 --- a/bin/xbps-rindex/index-files.c +++ b/bin/xbps-rindex/index-files.c @@ -79,10 +79,7 @@ index_files_clean(struct xbps_handle *xhp, const char *repodir) /* pkg found, do nothing */ continue; } - if ((str = xbps_xasprintf("%s,%s", ipkgver, iarch)) == NULL) { - rv = ENOMEM; - goto out; - } + str = xbps_xasprintf("%s,%s", ipkgver, iarch); if (!prop_array_add_cstring(obsoletes, str)) { free(str); rv = EINVAL; diff --git a/bin/xbps-rindex/index.c b/bin/xbps-rindex/index.c index 3509971a..e00b8997 100644 --- a/bin/xbps-rindex/index.c +++ b/bin/xbps-rindex/index.c @@ -206,7 +206,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv) */ buf = xbps_xasprintf("`%s' (%s)", oldpkgver, oldarch); - assert(buf); rv = remove_pkg(repodir, oldarch, oldfilen); if (rv != 0) { @@ -226,7 +225,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv) * index version. */ buf = xbps_xasprintf("`%s' (%s)", oldpkgver, oldarch); - assert(buf); buf2 = strdup(oldpkgver); assert(buf2); rv = remove_pkg(repodir, oldarch, oldfilen); diff --git a/lib/download.c b/lib/download.c index 2942ddec..e51f8f1f 100644 --- a/lib/download.c +++ b/lib/download.c @@ -124,10 +124,6 @@ xbps_fetch_file(struct xbps_handle *xhp, * Compute destination file path. */ destfile = xbps_xasprintf("%s/%s", outputdir, filename); - if (destfile == NULL) { - rv = -1; - goto out; - } /* * Check if we have to resume a transfer. */ diff --git a/lib/initend.c b/lib/initend.c index 6f30216a..6214d0e0 100644 --- a/lib/initend.c +++ b/lib/initend.c @@ -145,7 +145,6 @@ xbps_init(struct xbps_handle *xhp) buf = xbps_xasprintf("repositories = { %s }", xhp->repository); - assert(buf); if ((rv = cfg_parse_buf(xhp->cfg, buf)) != 0) return rv; free(buf); diff --git a/lib/package_config_files.c b/lib/package_config_files.c index 41a76e01..6c6c403e 100644 --- a/lib/package_config_files.c +++ b/lib/package_config_files.c @@ -105,11 +105,6 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp, prop_dictionary_get_cstring_nocopy(obj2, "file", &cffile); buf = xbps_xasprintf(".%s", cffile); - if (buf == NULL) { - prop_object_iterator_release(iter2); - rv = -1; - goto out; - } if (strcmp(entry_pname, buf) == 0) { prop_dictionary_get_cstring(obj2, "sha256", &sha256_orig); @@ -138,10 +133,6 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp, while ((obj = prop_object_iterator_next(iter))) { prop_dictionary_get_cstring_nocopy(obj, "file", &cffile); buf = xbps_xasprintf(".%s", cffile); - if (buf == NULL) { - prop_object_iterator_release(iter); - return -1; - } if (strcmp(entry_pname, buf)) { free(buf); buf = NULL; @@ -232,10 +223,6 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp, (strcmp(sha256_orig, sha256_new))) { buf = xbps_xasprintf(".%s.new-%s", cffile, version); - if (buf == NULL) { - rv = -1; - break; - } xbps_set_cb_state(xhp, XBPS_STATE_CONFIG_FILE, 0, pkgname, version, "Installing new configuration file to " diff --git a/lib/package_configure.c b/lib/package_configure.c index b68123bb..a0cf1d07 100644 --- a/lib/package_configure.c +++ b/lib/package_configure.c @@ -113,9 +113,6 @@ xbps_configure_pkg(struct xbps_handle *xhp, buf = xbps_xasprintf("%s/metadata/%s/INSTALL", XBPS_META_PATH, pkgname); - if (buf == NULL) - return ENOMEM; - if (chdir(xhp->rootdir) == -1) { xbps_set_cb_state(xhp, XBPS_STATE_CONFIGURE_FAIL, errno, pkgname, version, diff --git a/lib/package_conflicts.c b/lib/package_conflicts.c index df34aa87..b51f03b8 100644 --- a/lib/package_conflicts.c +++ b/lib/package_conflicts.c @@ -57,7 +57,6 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp, prop_dictionary_t pkg_repod) "pkgver", &pkgver); buf = xbps_xasprintf("%s conflicts with " "installed pkg %s", repopkgver, pkgver); - assert(buf != NULL); prop_array_add_cstring(trans_cflicts, buf); free(buf); continue; @@ -72,7 +71,6 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp, prop_dictionary_t pkg_repod) "pkgver", &pkgver); buf = xbps_xasprintf("%s conflicts with " "%s in transaction", repopkgver, pkgver); - assert(buf != NULL); prop_array_add_cstring(trans_cflicts, buf); free(buf); continue; diff --git a/lib/package_remove.c b/lib/package_remove.c index c35c2f28..e0e98e09 100644 --- a/lib/package_remove.c +++ b/lib/package_remove.c @@ -88,9 +88,6 @@ remove_pkg_metadata(struct xbps_handle *xhp, metadir = xbps_xasprintf("%s/%s/metadata/%s", xhp->rootdir, XBPS_META_PATH, pkgname); - if (metadir == NULL) - return ENOMEM; - dirp = opendir(metadir); if (dirp == NULL) { free(metadir); @@ -103,12 +100,6 @@ remove_pkg_metadata(struct xbps_handle *xhp, continue; path = xbps_xasprintf("%s/%s", metadir, dp->d_name); - if (path == NULL) { - (void)closedir(dirp); - free(metadir); - return ENOMEM; - } - if (unlink(path) == -1) { xbps_set_cb_state(xhp, XBPS_STATE_PURGE_FAIL, errno, pkgname, version, @@ -168,10 +159,6 @@ xbps_remove_pkg_files(struct xbps_handle *xhp, while ((obj = prop_object_iterator_next(iter))) { prop_dictionary_get_cstring_nocopy(obj, "file", &file); path = xbps_xasprintf("%s/%s", xhp->rootdir, file); - if (path == NULL) { - rv = ENOMEM; - break; - } if ((strcmp(key, "files") == 0) || (strcmp(key, "conf_files") == 0)) { @@ -282,16 +269,8 @@ xbps_remove_pkg(struct xbps_handle *xhp, buf = xbps_xasprintf("%s/metadata/%s/REMOVE", XBPS_META_PATH, pkgname); - if (buf == NULL) { - rv = ENOMEM; - goto out; - } pkgver = xbps_xasprintf("%s-%s", pkgname, version); - if (pkgver == NULL) { - rv = ENOMEM; - goto out; - } if ((rv = xbps_pkg_state_installed(xhp, pkgname, &state)) != 0) goto out; diff --git a/lib/package_remove_obsoletes.c b/lib/package_remove_obsoletes.c index adaf0191..ab99b7ea 100644 --- a/lib/package_remove_obsoletes.c +++ b/lib/package_remove_obsoletes.c @@ -71,7 +71,6 @@ again: file = xbps_xasprintf(".%s", prop_string_cstring_nocopy(oldstr)); - assert(file); if ((strcmp(array_str, "files") == 0) || (strcmp(array_str, "conf_files") == 0)) { diff --git a/lib/package_unpack.c b/lib/package_unpack.c index 52ef37f8..df5f8405 100644 --- a/lib/package_unpack.c +++ b/lib/package_unpack.c @@ -71,10 +71,6 @@ extract_metafile(struct xbps_handle *xhp, } buf = xbps_xasprintf("%s/metadata/%s/%s", XBPS_META_PATH, pkgname, file); - if (buf == NULL) { - free(pkgname); - return ENOMEM; - } archive_entry_set_pathname(entry, buf); dirc = strdup(buf); if (dirc == NULL) { @@ -133,10 +129,6 @@ remove_metafile(struct xbps_handle *xhp, } buf = xbps_xasprintf("%s/metadata/%s/%s", XBPS_META_PATH, pkgname, file); - if (buf == NULL) { - free(pkgname); - return ENOMEM; - } if (unlink(buf) == -1) { if (errno && errno != ENOENT) { xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FAIL, @@ -291,10 +283,6 @@ unpack_archive(struct xbps_handle *xhp, */ buf = xbps_xasprintf("%s/metadata/%s/INSTALL", XBPS_META_PATH, pkgname); - if (buf == NULL) { - rv = ENOMEM; - goto out; - } rv = extract_metafile(xhp, ar, entry, "INSTALL", pkgver, true, flags); if (rv != 0) @@ -470,7 +458,6 @@ unpack_archive(struct xbps_handle *xhp, assert(buf2); dname = dirname(buf2); p2 = xbps_xasprintf("%s/%s", dname, tgtlnk); - assert(p2); free(buf2); } else { p2 = strdup(tgtlnk); @@ -539,7 +526,6 @@ unpack_archive(struct xbps_handle *xhp, * file but renaming it to .old. */ buf = xbps_xasprintf("%s.old", entry_pname); - assert(buf); (void)rename(entry_pname, buf); free(buf); buf = NULL; @@ -593,10 +579,6 @@ unpack_archive(struct xbps_handle *xhp, */ pkgfilesd = xbps_xasprintf("%s/metadata/%s/%s", XBPS_META_PATH, pkgname, XBPS_PKGFILES); - if (pkgfilesd == NULL) { - rv = ENOMEM; - goto out; - } if (skip_obsoletes || preserve || (!softreplace && !update)) goto out1; /* @@ -631,10 +613,6 @@ out1: * Create pkg metadata directory if doesn't exist. */ buf = xbps_xasprintf("%s/metadata/%s", XBPS_META_PATH, pkgname); - if (buf == NULL) { - rv = ENOMEM; - goto out; - } if (access(buf, R_OK|X_OK) == -1) { if (xbps_mkpath(buf, 0755) == -1) { xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FAIL, @@ -661,10 +639,6 @@ out1: } pkgpropsd = xbps_xasprintf("%s/metadata/%s/%s", XBPS_META_PATH, pkgname, XBPS_PKGPROPS); - if (pkgpropsd == NULL) { - rv = ENOMEM; - goto out; - } if (!prop_dictionary_externalize_to_file(propsd, pkgpropsd)) { rv = errno; xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FAIL, diff --git a/lib/pkgdb.c b/lib/pkgdb.c index ab7120f9..ddb17495 100644 --- a/lib/pkgdb.c +++ b/lib/pkgdb.c @@ -88,8 +88,6 @@ xbps_pkgdb_update(struct xbps_handle *xhp, bool flush) return cached_rv; plist = xbps_xasprintf("%s/%s", xhp->metadir, XBPS_PKGDB); - assert(plist); - if (xhp->pkgdb && flush) { pkgdb_storage = prop_array_internalize_from_zfile(plist); if (pkgdb_storage == NULL || diff --git a/lib/plist.c b/lib/plist.c index dbf59441..4e44ed0c 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -280,8 +280,6 @@ xbps_dictionary_from_metadata_plist(struct xbps_handle *xhp, savedpkgname = pkgname; plistf = xbps_xasprintf("%s/metadata/%s/%s", xhp->metadir, savedpkgname, plist); - if (plistf == NULL) - return NULL; if (access(plistf, R_OK) == -1) { pkgd = xbps_find_virtualpkg_dict_installed(xhp, pkgname, false); @@ -294,8 +292,6 @@ xbps_dictionary_from_metadata_plist(struct xbps_handle *xhp, "pkgname", &savedpkgname); plistf = xbps_xasprintf("%s/metadata/%s/%s", xhp->metadir, savedpkgname, plist); - if (plistf == NULL) - return NULL; } } diff --git a/lib/plist_find.c b/lib/plist_find.c index e333c744..ae5fb7e0 100644 --- a/lib/plist_find.c +++ b/lib/plist_find.c @@ -195,7 +195,6 @@ find_virtualpkg_user_in_conf(struct xbps_handle *xhp, vpkgver = cfg_getnstr(sec, "targets", j); if (strchr(vpkgver, '_') == NULL) { tmp = xbps_xasprintf("%s_1", vpkgver); - assert(tmp != NULL); vpkgname = xbps_pkg_name(tmp); free(tmp); } else { diff --git a/lib/plist_match.c b/lib/plist_match.c index 014f5784..b2b302b9 100644 --- a/lib/plist_match.c +++ b/lib/plist_match.c @@ -71,7 +71,6 @@ xbps_match_any_virtualpkg_in_rundeps(prop_array_t rundeps, prop_array_get_cstring_nocopy(provides, i, &vpkgver); if (strchr(vpkgver, '_') == NULL) { tmp = xbps_xasprintf("%s_1", vpkgver); - assert(tmp != NULL); vpkgver = tmp; } for (x = 0; x < prop_array_count(rundeps); x++) { @@ -117,7 +116,6 @@ match_string_in_array(prop_array_t array, const char *str, int mode) pkgdep = prop_string_cstring_nocopy(obj); if (strchr(pkgdep, '_') == NULL) { tmp = xbps_xasprintf("%s_1", pkgdep); - assert(tmp != NULL); curpkgname = xbps_pkg_name(tmp); free(tmp); } else { @@ -136,7 +134,6 @@ match_string_in_array(prop_array_t array, const char *str, int mode) pkgdep = prop_string_cstring_nocopy(obj); if (strchr(pkgdep, '_') == NULL) { tmp = xbps_xasprintf("%s_1", pkgdep); - assert(tmp != NULL); pkgdep = tmp; } if (xbps_pkgpattern_match(pkgdep, str)) { @@ -153,7 +150,6 @@ match_string_in_array(prop_array_t array, const char *str, int mode) pkgdep = prop_string_cstring_nocopy(obj); if (strchr(pkgdep, '_') == NULL) { tmp = xbps_xasprintf("%s_1", pkgdep); - assert(tmp != NULL); pkgdep = tmp; } if (xbps_pkgpattern_match(str, pkgdep)) { diff --git a/lib/repository_sync_index.c b/lib/repository_sync_index.c index 16735f44..c041f616 100644 --- a/lib/repository_sync_index.c +++ b/lib/repository_sync_index.c @@ -70,9 +70,6 @@ xbps_get_remote_repo_string(const char *uri) url->host, url->doc); fetchFreeURL(url); - if (p == NULL) - return NULL; - for (i = 0; i < strlen(p); i++) { if (p[i] == '.' || p[i] == '/' || p[i] == ':') p[i] = '_'; @@ -128,28 +125,16 @@ xbps_repository_sync_pkg_index(struct xbps_handle *xhp, * Remote repository plist index full URL. */ rpidx = xbps_xasprintf("%s/%s", uri, plistf); - if (rpidx == NULL) { - rv = -1; - goto out; - } /* * Save temporary file in metadir, and rename if it * was downloaded successfully. */ tmp_metafile = xbps_xasprintf("%s/%s", xhp->metadir, plistf); - if (tmp_metafile == NULL) { - rv = -1; - goto out; - } /* * Full path to repository directory to store the plist * index file. */ lrepodir = xbps_xasprintf("%s/%s", xhp->metadir, uri_fixedp); - if (lrepodir == NULL) { - rv = -1; - goto out; - } /* * If directory exists probably the plist index file * was downloaded previously... @@ -195,10 +180,6 @@ xbps_repository_sync_pkg_index(struct xbps_handle *xhp, prop_object_release(array); lrepofile = xbps_xasprintf("%s/%s", lrepodir, plistf); - if (lrepofile == NULL) { - rv = -1; - goto out; - } /* * Create local repodir to store plist index file. */ diff --git a/lib/transaction_package_replace.c b/lib/transaction_package_replace.c index 962dd5c0..9e93865d 100644 --- a/lib/transaction_package_replace.c +++ b/lib/transaction_package_replace.c @@ -163,14 +163,12 @@ xbps_transaction_package_replace(struct xbps_handle *xhp) buf = xbps_xasprintf("%s/%s/metadata/%s/%s", xhp->rootdir, XBPS_META_PATH, curpkgname, XBPS_PKGFILES); - assert(buf != NULL); filesd = prop_dictionary_internalize_from_zfile(buf); free(buf); assert(filesd != NULL); buf = xbps_xasprintf("%s/%s/metadata/%s/%s", xhp->rootdir, XBPS_META_PATH, pkgname, XBPS_PKGFILES); - assert(buf != NULL); dirc = strdup(buf); assert(dirc != NULL); dname = dirname(dirc); diff --git a/lib/transaction_sortdeps.c b/lib/transaction_sortdeps.c index 6202a3ad..27cc33f5 100644 --- a/lib/transaction_sortdeps.c +++ b/lib/transaction_sortdeps.c @@ -346,7 +346,6 @@ xbps_transaction_sort_pkg_deps(struct xbps_handle *xhp) j, &vpkgdep); if (strchr(vpkgdep, '_') == NULL) { vpkg = xbps_xasprintf("%s_1", vpkgdep); - assert(vpkg); vpkgname = xbps_pkg_name(vpkg); free(vpkg); } else { diff --git a/lib/util.c b/lib/util.c index e1b63f2e..707f0bff 100644 --- a/lib/util.c +++ b/lib/util.c @@ -245,9 +245,6 @@ xbps_path_from_repository_uri(struct xbps_handle *xhp, * First check if binpkg is available in cachedir. */ lbinpkg = xbps_xasprintf("%s/%s", xhp->cachedir, filen); - if (lbinpkg == NULL) - return NULL; - if (access(lbinpkg, R_OK) == 0) return lbinpkg; @@ -294,14 +291,15 @@ char * xbps_xasprintf(const char *fmt, ...) { va_list ap; - char *buf; + char *buf = NULL; va_start(ap, fmt); if (vasprintf(&buf, fmt, ap) == -1) { va_end(ap); - return NULL; + assert(buf); } va_end(ap); + assert(buf); return buf; } diff --git a/lib/util_hash.c b/lib/util_hash.c index beee838a..f206252d 100644 --- a/lib/util_hash.c +++ b/lib/util_hash.c @@ -196,7 +196,6 @@ xbps_file_hash_check_dictionary(struct xbps_handle *xhp, rv = xbps_file_hash_check(file, sha256d); } else { buf = xbps_xasprintf("%s/%s", xhp->rootdir, file); - assert(buf != NULL); rv = xbps_file_hash_check(buf, sha256d); free(buf); } diff --git a/tests/libxbps/find_pkg/main.c b/tests/libxbps/find_pkg/main.c index 2793576b..2f2adb6d 100644 --- a/tests/libxbps/find_pkg/main.c +++ b/tests/libxbps/find_pkg/main.c @@ -70,7 +70,6 @@ ATF_TC_BODY(find_virtualpkg_dict_installed_test, tc) /* get test source dir */ tcsdir = atf_tc_get_config_var(tc, "srcdir"); cffile = xbps_xasprintf("%s/xbps.conf", tcsdir); - ATF_REQUIRE(cffile != NULL); /* initialize xbps */ memset(&xh, 0, sizeof(xh));