]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/common/cmdlib.c
quake3: delete dead strupr
[xonotic/netradiant.git] / tools / quake3 / common / cmdlib.c
index 90174e36b6cf18f8d74ea26a0ec5158d262cd7f5..60edebad465e5ca22c5d1b156a96b2e932fee5f2 100644 (file)
@@ -47,7 +47,6 @@
 #define BASEDIRNAME "quake" // assumed to have a 2 or 3 following
 #define PATHSEPERATOR '/'
 
-#ifdef SAFE_MALLOC
 void *safe_malloc( size_t size ){
        void *p;
 
@@ -69,7 +68,28 @@ void *safe_malloc_info( size_t size, char* info ){
 
        return p;
 }
-#endif // !SAFE_MALLOC
+
+void *safe_malloc0( size_t size ){
+       void *p;
+
+       p = calloc( 1, size );
+       if ( !p ) {
+               Error( "safe_malloc0 failed on allocation of %i bytes", size );
+       }
+
+       return p;
+}
+
+void *safe_malloc0_info( size_t size, char* info ){
+       void *p;
+
+       p = calloc( 1, size );
+       if ( !p ) {
+               Error( "%s: safe_malloc0 failed on allocation of %i bytes", info, size );
+       }
+
+       return p;
+}
 
 // set these before calling CheckParm
 int myargc;
@@ -479,23 +499,6 @@ int Q_stricmp( const char *s1, const char *s2 ){
        return Q_strncasecmp( s1, s2, 99999 );
 }
 
-// NOTE TTimo when switching to Multithread DLL (Release/Debug) in the config
-//   started getting warnings about that function, prolly a duplicate with the runtime function
-//   maybe we still need to have it in linux builds
-/*
-   char *strupr (char *start)
-   {
-    char       *in;
-    in = start;
-    while (*in)
-    {
-   *in = toupper(*in);
-        in++;
-    }
-    return start;
-   }
- */
-
 char *strlower( char *start ){
        char    *in;
        in = start;
@@ -655,8 +658,7 @@ int    LoadFileBlock( const char *filename, void **bufferptr ){
        if ( nBlock > 0 ) {
                nAllocSize += MEM_BLOCKSIZE - nBlock;
        }
-       buffer = safe_malloc( nAllocSize + 1 );
-       memset( buffer, 0, nAllocSize + 1 );
+       buffer = safe_malloc0( nAllocSize + 1 );
        SafeRead( f, buffer, length );
        fclose( f );