diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-12-16 14:08:53 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-12-16 14:08:53 +0000 |
commit | 23a6041698cf4670751d64f5f02c31a693fba065 (patch) | |
tree | 7fa65321edf435b8b85c1842fe8e4a8f3ab7938f | |
parent | 979ba8a8b525950f0c1a830c37d8d996790f2aba (diff) |
use the curlassert() instead of custom checks
-rw-r--r-- | lib/memdebug.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/lib/memdebug.c b/lib/memdebug.c index ba3c964c9..e917c64d4 100644 --- a/lib/memdebug.c +++ b/lib/memdebug.c @@ -133,13 +133,9 @@ char *curl_dostrdup(const char *str, int line, const char *source) { char *mem; size_t len; - - if(NULL ==str) { - fprintf(stderr, "ILLEGAL strdup() on NULL at %s:%d\n", - source, line); - exit(2); - } + curlassert(str != NULL); + if(countcheck("strdup", line, source)) return NULL; @@ -184,11 +180,8 @@ void curl_dofree(void *ptr, int line, const char *source) { struct memdebug *mem; - if(NULL == ptr) { - fprintf(stderr, "ILLEGAL free() on NULL at %s:%d\n", - source, line); - exit(2); - } + curlassert(ptr != NULL); + mem = (struct memdebug *)((char *)ptr - offsetof(struct memdebug, mem)); /* destroy */ @@ -244,11 +237,7 @@ int curl_fclose(FILE *file, int line, const char *source) { int res; - if(NULL == file) { - fprintf(stderr, "ILLEGAL flose() on NULL at %s:%d\n", - source, line); - exit(2); - } + curlassert(file != NULL); res=(fclose)(file); if(logfile) |