Michael Stefaniuc : msvcrt: Remove redundant NULL checks before MSVCRT_free .

Alexandre Julliard julliard at wine.codeweavers.com
Wed Aug 9 06:03:27 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 243a3e410719bc5f56891b52b1f0d68226f7b7f0
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=243a3e410719bc5f56891b52b1f0d68226f7b7f0

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Aug  9 01:17:41 2006 +0200

msvcrt: Remove redundant NULL checks before MSVCRT_free.

---

 dlls/msvcrt/console.c |    3 +--
 dlls/msvcrt/cpp.c     |    3 +--
 dlls/msvcrt/exit.c    |    3 +--
 dlls/msvcrt/file.c    |    7 ++-----
 dlls/msvcrt/process.c |    7 +++----
 5 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/dlls/msvcrt/console.c b/dlls/msvcrt/console.c
index 612c65d..013ed54 100644
--- a/dlls/msvcrt/console.c
+++ b/dlls/msvcrt/console.c
@@ -231,8 +231,7 @@ int CDECL _kbhit(void)
           break;
         }
       }
-    if (ir)
-      MSVCRT_free(ir);
+    MSVCRT_free(ir);
   }
   UNLOCK_CONSOLE;
   return retval;
diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c
index 461380e..5ea595d 100644
--- a/dlls/msvcrt/cpp.c
+++ b/dlls/msvcrt/cpp.c
@@ -544,8 +544,7 @@ DEFINE_THISCALL_WRAPPER(MSVCRT_type_info
 void __stdcall MSVCRT_type_info_dtor(type_info * _this)
 {
   TRACE("(%p)\n", _this);
-  if (_this->name)
-    MSVCRT_free(_this->name);
+  MSVCRT_free(_this->name);
 }
 
 /******************************************************************
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index 0c670aa..34e97e4 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -219,8 +219,7 @@ MSVCRT__onexit_t CDECL MSVCRT__onexit(MS
     }
     memcpy (newtable, MSVCRT_atexit_table, MSVCRT_atexit_table_size);
     MSVCRT_atexit_table_size += 32;
-    if (MSVCRT_atexit_table)
-      MSVCRT_free (MSVCRT_atexit_table);
+    MSVCRT_free (MSVCRT_atexit_table);
     MSVCRT_atexit_table = newtable;
   }
   MSVCRT_atexit_table[MSVCRT_atexit_registered] = func;
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 3b3a6de..9fe09dd 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -2040,11 +2040,8 @@ int CDECL MSVCRT_fclose(MSVCRT_FILE* fil
   int r, flag;
 
   flag = file->_flag;
-  if (file->_tmpfname)
-  {
-    MSVCRT_free(file->_tmpfname);
-    file->_tmpfname = NULL;
-  }
+  MSVCRT_free(file->_tmpfname);
+  file->_tmpfname = NULL;
   /* flush stdio buffers */
   if(file->_flag & MSVCRT__IOWRT)
       MSVCRT_fflush(file);
diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c
index 7aa01ff..85a1e6c 100644
--- a/dlls/msvcrt/process.c
+++ b/dlls/msvcrt/process.c
@@ -371,7 +371,7 @@ MSVCRT_intptr_t CDECL _spawnle(int flags
     ret = msvcrt_spawn(flags, name, args, envs);
 
     MSVCRT_free(args);
-    if (envs) MSVCRT_free(envs);
+    MSVCRT_free(envs);
     return ret;
 }
 
@@ -427,7 +427,7 @@ MSVCRT_intptr_t CDECL _spawnlpe(int flag
     ret = msvcrt_spawn(flags, fullname[0] ? fullname : name, args, envs);
 
     MSVCRT_free(args);
-    if (envs) MSVCRT_free(envs);
+    MSVCRT_free(envs);
     return ret;
 }
 
@@ -482,8 +482,7 @@ MSVCRT_intptr_t CDECL _spawnve(int flags
     ret = msvcrt_spawn(flags, fullname, args, envs);
     MSVCRT_free(args);
   }
-  if (envs)
-    MSVCRT_free(envs);
+  MSVCRT_free(envs);
 
   return ret;
 }




More information about the wine-cvs mailing list