diff options
author | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-04 23:20:09 (EST) |
---|---|---|
committer | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-04 23:20:09 (EST) |
commit | 480538737a8a9be074a1848f2e52cf2d1ff4709f (patch) | |
tree | e24d32dc46e0b83600aaa02a33ecaa6779765d9b /libopkg/pkg.c | |
parent | acd905996191df6ab59050bd179a5ed11e6f72a4 (diff) |
s/malloc/xmalloc/ s/calloc/xcalloc/ s/realloc/realloc/
And redundant error checking removed from the places where allocation failures
were actually checked.
git-svn-id: http://opkg.googlecode.com/svn/trunk@259 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/pkg.c')
-rw-r--r-- | libopkg/pkg.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/libopkg/pkg.c b/libopkg/pkg.c index 33d0d68..48169ea 100644 --- a/libopkg/pkg.c +++ b/libopkg/pkg.c @@ -79,7 +79,7 @@ pkg_t *pkg_new(void) { pkg_t *pkg; - pkg = calloc(1, sizeof(pkg_t)); + pkg = xcalloc(1, sizeof(pkg_t)); if (pkg == NULL) { fprintf(stderr, "%s: out of memory\n", __FUNCTION__); return NULL; @@ -450,7 +450,7 @@ abstract_pkg_t *abstract_pkg_new(void) { abstract_pkg_t * ab_pkg; - ab_pkg = calloc(1, sizeof(abstract_pkg_t)); + ab_pkg = xcalloc(1, sizeof(abstract_pkg_t)); if (ab_pkg == NULL) { fprintf(stderr, "%s: out of memory\n", __FUNCTION__); @@ -992,10 +992,6 @@ str_list_t *pkg_get_installed_files(pkg_t *pkg) } pkg->installed_files = str_list_alloc(); - if (pkg->installed_files == NULL) { - fprintf(stderr, "%s: out of memory\n", __FUNCTION__); - return NULL; - } /* For uninstalled packages, get the file list directly from the package. For installed packages, look at the package.list file in the database. @@ -1262,11 +1258,7 @@ char *pkg_state_flag_to_str(pkg_state_flag_t sf) len += strlen(pkg_state_flag_map[i].str) + 1; } } - str = malloc(len); - if ( str == NULL ) { - fprintf(stderr, "%s: out of memory\n", __FUNCTION__); - return NULL; - } + str = xmalloc(len); str[0] = 0; for (i=0; i < ARRAY_SIZE(pkg_state_flag_map); i++) { if (sf & pkg_state_flag_map[i].value) { |