xbps_xasprintf: do not return NULL anymore; remove checks for this.
This commit is contained in:
@@ -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);
|
||||
|
@@ -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");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -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(
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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",
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user