diff Outdoor.cpp @ 2369:bddcaf5d5db2

removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
author Grumpy7
date Mon, 12 May 2014 01:50:32 +0200
parents 91b6c0a338ad
children eba7123e4a2d
line wrap: on
line diff
--- a/Outdoor.cpp	Mon May 12 00:13:39 2014 +0200
+++ b/Outdoor.cpp	Mon May 12 01:50:32 2014 +0200
@@ -668,26 +668,14 @@
 //----- (0047C7C2) --------------------------------------------------------
 void OutdoorLocationTerrain::Release()//очистить локацию
 {
-  if (pHeightmap)
-  {
-    free(this->pHeightmap);
-    pHeightmap = nullptr;
-  }
-  if (pTilemap)
-  {
-    free(pTilemap);
-    pTilemap = nullptr;
-  }
-  if (pAttributemap)
-  {
-    free(pAttributemap);
-    pAttributemap = nullptr;
-  }
-  if (pDmap)
-  {
-    free(pDmap);
-    pDmap = nullptr;
-  }
+  free(this->pHeightmap);
+  pHeightmap = nullptr;
+  free(pTilemap);
+  pTilemap = nullptr;
+  free(pAttributemap);
+  pAttributemap = nullptr;
+  free(pDmap);
+  pDmap = nullptr;
 
   _47C7A9();
 }
@@ -1065,35 +1053,20 @@
     uNumBModels = 0;
   }
 
-  if (pSpawnPoints)
-  {
-    free(pSpawnPoints);
-    pSpawnPoints = nullptr;
-  }
+  free(pSpawnPoints);
+  pSpawnPoints = nullptr;
   uNumSpawnPoints = 0;
 
   pTerrain.Release();
 
-  if (pCmap)
-  {
-    free(pCmap);
-    pCmap = nullptr;
-  }
-  if (pOMAP)
-  {
-    free(pOMAP);
-    pOMAP = nullptr;
-  }
-  if (pFaceIDLIST)
-  {
-    free(pFaceIDLIST);
-    pFaceIDLIST = nullptr;
-  }
-  if (pTerrainNormals)
-  {
-    free(pTerrainNormals);
-    pTerrainNormals = nullptr;
-  }
+  free(pCmap);
+  pCmap = nullptr;
+  free(pOMAP);
+  pOMAP = nullptr;
+  free(pFaceIDLIST);
+  pFaceIDLIST = nullptr;
+  free(pTerrainNormals);
+  pTerrainNormals = nullptr;
 }
 
 //----- (0047D0A6) --------------------------------------------------------
@@ -1632,11 +1605,7 @@
 
   //v43 = (char *)v43 + 16384;
   //v108 = (int)ptr_D4;
-  if (pCmap)
-  {
-    free(pCmap);
-    pCmap = nullptr;
-  }
+  free(pCmap);
   pCmap = malloc(0x8000);
   pTerrain.FillDMap(0, 0, 128, 128);
 
@@ -1842,11 +1811,8 @@
 
   //uSourceLen = (char *)uSourceLen + 4;
   //v108 = (int)pFaceIDLIST;
-  if (pFaceIDLIST)
-  {
-    free(pFaceIDLIST);
-    pFaceIDLIST = nullptr;
-  }
+  free(pFaceIDLIST);
+  pFaceIDLIST = nullptr;
   //v66 = field_DC;
   //pFaceIDLIST = 0;
   //v67 = malloc(0, 2 * v66, "IDLIST");
@@ -1864,11 +1830,7 @@
   //v108 = (int)pOMAP;
   //free((void *)v108);
   //pOMAP = 0;
-  if (pOMAP)
-  {
-    free(pOMAP);
-    pOMAP = nullptr;
-  }
+  free(pOMAP);
   //v69 = malloc(0, 0x10000u, "OMAP");
   pOMAP = (unsigned int *)malloc(0x10000);
   //v108 = 65536;