]> granicus.if.org Git - curl/commitdiff
use the curlassert() instead of custom checks
authorDaniel Stenberg <daniel@haxx.se>
Tue, 16 Dec 2003 14:08:53 +0000 (14:08 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 16 Dec 2003 14:08:53 +0000 (14:08 +0000)
lib/memdebug.c

index ba3c964c9e9449ca30627f0d6008cb5789be1534..e917c64d479deefc73330676497460d09578e51f 100644 (file)
@@ -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)