summaryrefslogtreecommitdiff
path: root/utils/utils.c
diff options
context:
space:
mode:
authorKevin Bagust <kevin.bagust@ntlworld.com>2004-12-08 00:10:17 +0000
committerKevin Bagust <kevin.bagust@ntlworld.com>2004-12-08 00:10:17 +0000
commite11c05d25701564b9d21b411057400a2ca3206b5 (patch)
tree6603d3d77c2551a63e344b75b4096e055cb24d3e /utils/utils.c
parente3ca55d7ccd0d31076befbaa76438f27540dfdba (diff)
downloadnetsurf-e11c05d25701564b9d21b411057400a2ca3206b5.tar.gz
netsurf-e11c05d25701564b9d21b411057400a2ca3206b5.tar.bz2
[project @ 2004-12-08 00:10:17 by kevinb]
Removed unused function load, and altered call to xcalloc into a call to calloc in clean_cookiejar svn path=/import/netsurf/; revision=1389
Diffstat (limited to 'utils/utils.c')
-rw-r--r--utils/utils.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/utils/utils.c b/utils/utils.c
index aa2494595..c65181511 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -79,26 +79,6 @@ char * xstrdup(const char * const s)
return c;
}
-char * load(const char * const path)
-{
- FILE * fp = fopen(path, "rb");
- char * buf;
- long size, read;
-
- if (fp == 0) die("Failed to open file");
- if (fseek(fp, 0, SEEK_END) != 0) die("fseek() failed");
- if ((size = ftell(fp)) == -1) die("ftell() failed");
- buf = xcalloc((size_t) size, 1);
-
- if (fseek(fp, 0, SEEK_SET) != 0) die("fseek() failed");
- read = fread(buf, 1, (size_t) size, fp);
- if (read < size) die("fread() failed");
-
- fclose(fp);
-
- return buf;
-}
-
char * squash_whitespace(const char * s)
{
char * c = malloc(strlen(s) + 1);
@@ -330,7 +310,12 @@ void clean_cookiejar(void) {
len = ftell(fp);
fseek(fp, 0, SEEK_SET);
- cookies = xcalloc((unsigned int)len, sizeof(char));
+ cookies = calloc((unsigned int)len, sizeof(char));
+ if ( NULL == cookies ) {
+ warn_user( "NoMemory", 0);
+ return;
+ }
+
fread(cookies, (unsigned int)len, sizeof(char), fp);
fclose(fp);