diff src/util.c @ 281:5eece4dfd945 noffle

[svn] * src/log.c,src/log.h: Add Log_fatal() for reporting fatal errors and exiting, Log_gdbm_fatal() for the the same but specifically as a GDBM error reporting function, and a new log debug level AUTH for a forthcoming authentication mechanism. * src/database.c,src/group.c: Provide new gdbm error function to all gdbm opens. * src/noffle.c: Add atexit() to always close databases on a program- inspired exit. * src/content.c,src/dynamicstring.c,src/fetchlist.c,src/filter.c, src/itemlist.c,src/log.c,src/log.h,src/over.c,src/protocol.h, src/request.c,src/util.c: Use Log_fatal where appropriate.
author bears
date Fri, 27 Dec 2002 21:48:25 +0000
parents 49b452b667a6
children 4426fde0a72c
line wrap: on
line diff
--- a/src/util.c	Tue Dec 24 09:08:59 2002 +0000
+++ b/src/util.c	Fri Dec 27 21:48:25 2002 +0000
@@ -1,7 +1,7 @@
 /*
   util.c
 
-  $Id: util.c 411 2002-11-17 15:18:19Z bears $
+  $Id: util.c 413 2002-12-27 21:48:25Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -557,13 +557,10 @@
 void
 Utl_allocAndCpy( char **dst, const char *src )
 {
-    int len = strlen( src );
-    if ( ! ( *dst = malloc( (size_t)len + 1 ) ) )
-    {
-        Log_err( "Cannot allocate string with length %lu", strlen( src ) );
-        exit( EXIT_FAILURE );
-    }
-    memcpy( *dst, src, (size_t)len + 1 );
+    size_t len = strlen( src );
+    if ( ! ( *dst = malloc( len + 1 ) ) )
+        Log_fatal( "Cannot allocate string with length %lu", len );
+    memcpy( *dst, src, len + 1 );
 }
 
 SignalHandler