summaryrefslogtreecommitdiffstats
path: root/libopkg/file_util.c
diff options
context:
space:
mode:
authorgraham.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)
commit480538737a8a9be074a1848f2e52cf2d1ff4709f (patch)
treee24d32dc46e0b83600aaa02a33ecaa6779765d9b /libopkg/file_util.c
parentacd905996191df6ab59050bd179a5ed11e6f72a4 (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/file_util.c')
-rw-r--r--libopkg/file_util.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/libopkg/file_util.c b/libopkg/file_util.c
index b867df7..902b8c9 100644
--- a/libopkg/file_util.c
+++ b/libopkg/file_util.c
@@ -75,11 +75,7 @@ char *file_read_line_alloc(FILE *file)
buf_len = strlen(buf);
if (line) {
line_size += buf_len;
- line = realloc(line, line_size);
- if (line == NULL) {
- fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
- break;
- }
+ line = xrealloc(line, line_size);
strcat(line, buf);
} else {
line_size = buf_len + 1;
@@ -147,11 +143,7 @@ char *file_md5sum_alloc(const char *file_name)
char *md5sum_hex;
unsigned char md5sum_bin[md5sum_bin_len];
- md5sum_hex = calloc(1, md5sum_hex_len + 1);
- if (md5sum_hex == NULL) {
- fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
- return NULL;
- }
+ md5sum_hex = xcalloc(1, md5sum_hex_len + 1);
file = fopen(file_name, "r");
if (file == NULL) {
@@ -200,11 +192,7 @@ char *file_sha256sum_alloc(const char *file_name)
char *sha256sum_hex;
unsigned char sha256sum_bin[sha256sum_bin_len];
- sha256sum_hex = calloc(1, sha256sum_hex_len + 1);
- if (sha256sum_hex == NULL) {
- fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
- return NULL;
- }
+ sha256sum_hex = xcalloc(1, sha256sum_hex_len + 1);
file = fopen(file_name, "r");
if (file == NULL) {