diff options
author | joerg <joerg> | 2008-08-02 20:33:50 +0000 |
---|---|---|
committer | joerg <joerg> | 2008-08-02 20:33:50 +0000 |
commit | 7be93b44a0d2e33aa0dd07de5f5b673bf95b27c8 (patch) | |
tree | 8901b5966bac844405a560018181d94cc4eccd35 /pkgtools/pkg_install/files/lib/conflicts.c | |
parent | f3a58140319f67643ea733850de213b695037b07 (diff) | |
download | pkgsrc-7be93b44a0d2e33aa0dd07de5f5b673bf95b27c8.tar.gz |
Most memory allocation failures were fatal already and the majority of
the rest lacked an explicit check. Add the usual x* wrappers around
malloc and friends that explicitly terminate on error and use them in
all but Dewey.
Diffstat (limited to 'pkgtools/pkg_install/files/lib/conflicts.c')
-rw-r--r-- | pkgtools/pkg_install/files/lib/conflicts.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/pkgtools/pkg_install/files/lib/conflicts.c b/pkgtools/pkg_install/files/lib/conflicts.c index 01468ce0ff6..ba9b3a582ea 100644 --- a/pkgtools/pkg_install/files/lib/conflicts.c +++ b/pkgtools/pkg_install/files/lib/conflicts.c @@ -35,17 +35,6 @@ struct package_conflict { char **conflicting_pattern; }; -static void * -nonnull(void *p) -{ - - if (p == NULL) { - err(EXIT_FAILURE, "NullPointerException"); - /* NOTREACHED */ - } - return p; -} - static FILE * fopen_contents(const char *pkgname, const char *mode) { @@ -88,8 +77,8 @@ check_package_conflict(const char *pkgname, void *v) continue; if (pkg_match(p->name, conflict->pkgname) == 1) { - *(conflict->conflicting_pkgname) = nonnull(strdup(pkgname)); - *(conflict->conflicting_pattern) = nonnull(strdup(p->name)); + *(conflict->conflicting_pkgname) = xstrdup(pkgname); + *(conflict->conflicting_pattern) = xstrdup(p->name); rv = 1 /* nonzero, stop iterating */; break; } |