test/testautomation_surface.c
changeset 7720 f9a649383362
parent 7678 286c42d7c5ed
child 8673 50135c28f7cf
     1.1 --- a/test/testautomation_surface.c	Thu Aug 29 08:29:21 2013 -0700
     1.2 +++ b/test/testautomation_surface.c	Thu Aug 29 08:29:51 2013 -0700
     1.3 @@ -63,14 +63,10 @@
     1.4  void
     1.5  _surfaceTearDown(void *arg)
     1.6  {
     1.7 -    if (referenceSurface != NULL) {
     1.8 -        SDL_FreeSurface(referenceSurface);
     1.9 -        referenceSurface = NULL;
    1.10 -    }
    1.11 -    if (testSurface != NULL) {
    1.12 -        SDL_FreeSurface(testSurface);
    1.13 -        testSurface = NULL;
    1.14 -    }
    1.15 +    SDL_FreeSurface(referenceSurface);
    1.16 +    referenceSurface = NULL;
    1.17 +    SDL_FreeSurface(testSurface);
    1.18 +    testSurface = NULL;
    1.19  }
    1.20  
    1.21  /**
    1.22 @@ -193,10 +189,8 @@
    1.23      SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_SetSurfaceBlendMode, expected: 0, got: %i", checkFailCount4);
    1.24  
    1.25      /* Clean up */
    1.26 -    if (face != NULL) {
    1.27 -        SDL_FreeSurface(face);
    1.28 -        face = NULL;
    1.29 -    }
    1.30 +    SDL_FreeSurface(face);
    1.31 +    face = NULL;
    1.32  }
    1.33  
    1.34  /* Helper to check that a file exists */
    1.35 @@ -250,14 +244,10 @@
    1.36      unlink(sampleFilename);
    1.37  
    1.38      /* Clean up */
    1.39 -    if (face != NULL) {
    1.40      SDL_FreeSurface(face);
    1.41      face = NULL;
    1.42 -    }
    1.43 -    if (rface != NULL) {
    1.44      SDL_FreeSurface(rface);
    1.45      rface = NULL;
    1.46 -    }
    1.47  
    1.48      return TEST_COMPLETED;
    1.49  }
    1.50 @@ -294,14 +284,10 @@
    1.51      SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    1.52  
    1.53      /* Clean up. */
    1.54 -    if (face != NULL) {
    1.55 -        SDL_FreeSurface( face );
    1.56 -        face = NULL;
    1.57 -    }
    1.58 -    if (rface != NULL) {
    1.59 -        SDL_FreeSurface( rface );
    1.60 -        rface = NULL;
    1.61 -    }
    1.62 +    SDL_FreeSurface(face);
    1.63 +    face = NULL;
    1.64 +    SDL_FreeSurface(rface);
    1.65 +    rface = NULL;
    1.66  
    1.67      return TEST_COMPLETED;
    1.68  }
    1.69 @@ -427,9 +413,7 @@
    1.70     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    1.71  
    1.72     /* Clean up. */
    1.73 -   if (compareSurface != NULL) {
    1.74 -    SDL_FreeSurface( compareSurface );
    1.75 -   }
    1.76 +   SDL_FreeSurface(compareSurface);
    1.77  
    1.78     return TEST_COMPLETED;
    1.79  }
    1.80 @@ -452,9 +436,7 @@
    1.81     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    1.82  
    1.83     /* Clean up. */
    1.84 -   if (compareSurface != NULL) {
    1.85 -    SDL_FreeSurface( compareSurface );
    1.86 -   }
    1.87 +   SDL_FreeSurface(compareSurface);
    1.88  
    1.89     return TEST_COMPLETED;
    1.90  }
    1.91 @@ -477,9 +459,7 @@
    1.92     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
    1.93  
    1.94     /* Clean up. */
    1.95 -   if (compareSurface != NULL) {
    1.96 -    SDL_FreeSurface( compareSurface );
    1.97 -   }
    1.98 +   SDL_FreeSurface(compareSurface);
    1.99  
   1.100     return TEST_COMPLETED;
   1.101  }
   1.102 @@ -503,9 +483,7 @@
   1.103     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   1.104  
   1.105     /* Clean up. */
   1.106 -   if (compareSurface != NULL) {
   1.107 -    SDL_FreeSurface( compareSurface );
   1.108 -   }
   1.109 +   SDL_FreeSurface(compareSurface);
   1.110  
   1.111     return TEST_COMPLETED;
   1.112  }
   1.113 @@ -528,9 +506,7 @@
   1.114     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   1.115  
   1.116     /* Clean up. */
   1.117 -   if (compareSurface != NULL) {
   1.118 -    SDL_FreeSurface( compareSurface );
   1.119 -   }
   1.120 +   SDL_FreeSurface(compareSurface);
   1.121  
   1.122     return TEST_COMPLETED;
   1.123  }
   1.124 @@ -553,9 +529,7 @@
   1.125     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   1.126  
   1.127     /* Clean up. */
   1.128 -   if (compareSurface != NULL) {
   1.129 -    SDL_FreeSurface( compareSurface );
   1.130 -   }
   1.131 +   SDL_FreeSurface(compareSurface);
   1.132  
   1.133     return TEST_COMPLETED;
   1.134  }
   1.135 @@ -578,9 +552,7 @@
   1.136     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   1.137  
   1.138     /* Clean up. */
   1.139 -   if (compareSurface != NULL) {
   1.140 -      SDL_FreeSurface( compareSurface );
   1.141 -   }
   1.142 +   SDL_FreeSurface(compareSurface);
   1.143  
   1.144     return TEST_COMPLETED;
   1.145  }
   1.146 @@ -603,9 +575,7 @@
   1.147     SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
   1.148  
   1.149     /* Clean up. */
   1.150 -   if (compareSurface != NULL) {
   1.151 -     SDL_FreeSurface(compareSurface);
   1.152 -   }
   1.153 +   SDL_FreeSurface(compareSurface);
   1.154  
   1.155     return TEST_COMPLETED;
   1.156