Christoph Mallon: Replace strlen(x) == 0 (O(n)) by x[0] == '\0' (O(1)).
authorSam Lantinga <slouken@libsdl.org>
Thu, 29 Aug 2013 08:30:21 -0700
changeset 7721bdf8c2c84e14
parent 7720 f9a649383362
child 7722 ea5565d856a8
Christoph Mallon: Replace strlen(x) == 0 (O(n)) by x[0] == '\0' (O(1)).
src/test/SDL_test_harness.c
src/video/SDL_clipboard.c
src/video/SDL_video.c
src/video/bwindow/SDL_bclipboard.cc
src/video/cocoa/SDL_cocoaclipboard.m
src/video/windows/SDL_windowsclipboard.c
src/video/x11/SDL_x11clipboard.c
test/testautomation_audio.c
test/testautomation_clipboard.c
test/testautomation_pixels.c
test/testautomation_sdltest.c
test/testime.c
     1.1 --- a/src/test/SDL_test_harness.c	Thu Aug 29 08:29:51 2013 -0700
     1.2 +++ b/src/test/SDL_test_harness.c	Thu Aug 29 08:30:21 2013 -0700
     1.3 @@ -109,17 +109,17 @@
     1.4      Uint32 entireStringLength;
     1.5      char *buffer;
     1.6  
     1.7 -    if (runSeed == NULL || SDL_strlen(runSeed)==0) {
     1.8 +    if (runSeed == NULL || runSeed[0] == '\0') {
     1.9          SDLTest_LogError("Invalid runSeed string.");
    1.10          return -1;
    1.11      }
    1.12  
    1.13 -    if (suiteName == NULL || SDL_strlen(suiteName)==0) {
    1.14 +    if (suiteName == NULL || suiteName[0] == '\0') {
    1.15          SDLTest_LogError("Invalid suiteName string.");
    1.16          return -1;
    1.17      }
    1.18  
    1.19 -    if (testName == NULL || SDL_strlen(testName)==0) {
    1.20 +    if (testName == NULL || testName[0] == '\0') {
    1.21          SDLTest_LogError("Invalid testName string.");
    1.22          return -1;
    1.23      }
    1.24 @@ -399,7 +399,7 @@
    1.25      }
    1.26  
    1.27      /* Generate run see if we don't have one already */
    1.28 -    if (userRunSeed == NULL || SDL_strlen(userRunSeed) == 0) {
    1.29 +    if (userRunSeed == NULL || userRunSeed[0] == '\0') {
    1.30          runSeed = SDLTest_GenerateRunSeed(16);
    1.31          if (runSeed == NULL) {
    1.32              SDLTest_LogError("Generating a random seed failed");
    1.33 @@ -422,7 +422,7 @@
    1.34      SDLTest_Log("::::: Test Run /w seed '%s' started\n", runSeed);
    1.35  
    1.36      /* Initialize filtering */
    1.37 -    if (filter != NULL && SDL_strlen(filter) > 0) {
    1.38 +    if (filter != NULL && filter[0] != '\0') {
    1.39          /* Loop over all suites to check if we have a filter match */
    1.40          suiteCounter = 0;
    1.41          while (testSuites[suiteCounter] && suiteFilter == 0) {
    1.42 @@ -521,7 +521,7 @@
    1.43                          suiteCounter,
    1.44                          testCounter,
    1.45                          currentTestName);
    1.46 -                    if (testCase->description != NULL && SDL_strlen(testCase->description)>0) {
    1.47 +                    if (testCase->description != NULL && testCase->description[0] != '\0') {
    1.48                          SDLTest_Log("Test Description: '%s'",
    1.49                              (testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
    1.50                      }
     2.1 --- a/src/video/SDL_clipboard.c	Thu Aug 29 08:29:51 2013 -0700
     2.2 +++ b/src/video/SDL_clipboard.c	Thu Aug 29 08:30:21 2013 -0700
     2.3 @@ -65,7 +65,7 @@
     2.4      if (_this->HasClipboardText) {
     2.5          return _this->HasClipboardText(_this);
     2.6      } else {
     2.7 -        if ((_this->clipboard_text) && (SDL_strlen(_this->clipboard_text)>0)) {
     2.8 +        if (_this->clipboard_text && _this->clipboard_text[0] != '\0') {
     2.9              return SDL_TRUE;
    2.10          } else {
    2.11              return SDL_FALSE;
     3.1 --- a/src/video/SDL_video.c	Thu Aug 29 08:29:51 2013 -0700
     3.2 +++ b/src/video/SDL_video.c	Thu Aug 29 08:30:21 2013 -0700
     3.3 @@ -1453,7 +1453,7 @@
     3.4      CHECK_WINDOW_MAGIC(window, NULL);
     3.5  
     3.6      /* Input validation */
     3.7 -    if (name == NULL || SDL_strlen(name) == 0) {
     3.8 +    if (name == NULL || name[0] == '\0') {
     3.9        SDL_InvalidParamError("name");
    3.10        return NULL;
    3.11      }
    3.12 @@ -1500,7 +1500,7 @@
    3.13      CHECK_WINDOW_MAGIC(window, NULL);
    3.14  
    3.15      /* Input validation */
    3.16 -    if (name == NULL || SDL_strlen(name) == 0) {
    3.17 +    if (name == NULL || name[0] == '\0') {
    3.18        SDL_InvalidParamError("name");
    3.19        return NULL;
    3.20      }
     4.1 --- a/src/video/bwindow/SDL_bclipboard.cc	Thu Aug 29 08:29:51 2013 -0700
     4.2 +++ b/src/video/bwindow/SDL_bclipboard.cc	Thu Aug 29 08:30:21 2013 -0700
     4.3 @@ -82,7 +82,7 @@
     4.4  	SDL_bool result = SDL_FALSE;
     4.5  	char *text = BE_GetClipboardText(_this);
     4.6  	if (text) {
     4.7 -		result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
     4.8 +		result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
     4.9  		SDL_free(text);
    4.10  	} 
    4.11  	return result;
     5.1 --- a/src/video/cocoa/SDL_cocoaclipboard.m	Thu Aug 29 08:29:51 2013 -0700
     5.2 +++ b/src/video/cocoa/SDL_cocoaclipboard.m	Thu Aug 29 08:30:21 2013 -0700
     5.3 @@ -95,7 +95,7 @@
     5.4      SDL_bool result = SDL_FALSE;
     5.5      char *text = Cocoa_GetClipboardText(_this);
     5.6      if (text) {
     5.7 -    result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
     5.8 +        result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
     5.9      SDL_free(text);
    5.10      }
    5.11      return result;
     6.1 --- a/src/video/windows/SDL_windowsclipboard.c	Thu Aug 29 08:29:51 2013 -0700
     6.2 +++ b/src/video/windows/SDL_windowsclipboard.c	Thu Aug 29 08:30:21 2013 -0700
     6.3 @@ -137,7 +137,7 @@
     6.4      SDL_bool result = SDL_FALSE;
     6.5      char *text = WIN_GetClipboardText(_this);
     6.6      if (text) {
     6.7 -        result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
     6.8 +        result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
     6.9          SDL_free(text);
    6.10      }
    6.11      return result;
     7.1 --- a/src/video/x11/SDL_x11clipboard.c	Thu Aug 29 08:29:51 2013 -0700
     7.2 +++ b/src/video/x11/SDL_x11clipboard.c	Thu Aug 29 08:30:21 2013 -0700
     7.3 @@ -165,7 +165,7 @@
     7.4      SDL_bool result = SDL_FALSE;
     7.5      char *text = X11_GetClipboardText(_this);
     7.6      if (text) {
     7.7 -        result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
     7.8 +        result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
     7.9          SDL_free(text);
    7.10      }
    7.11      return result;
     8.1 --- a/test/testautomation_audio.c	Thu Aug 29 08:29:51 2013 -0700
     8.2 +++ b/test/testautomation_audio.c	Thu Aug 29 08:30:21 2013 -0700
     8.3 @@ -77,7 +77,7 @@
     8.4              audioDriver = SDL_GetAudioDriver(i);
     8.5              SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i);
     8.6              SDLTest_AssertCheck(audioDriver != NULL, "Audio driver name is not NULL");
     8.7 -            SDLTest_AssertCheck(SDL_strlen(audioDriver) > 0, "Audio driver name is not empty; got: %s", audioDriver);
     8.8 +            SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver);
     8.9  
    8.10              /* Call Init */
    8.11              result = SDL_AudioInit(audioDriver);
    8.12 @@ -134,7 +134,7 @@
    8.13              audioDriver = SDL_GetAudioDriver(i);
    8.14              SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i);
    8.15              SDLTest_AssertCheck(audioDriver != NULL, "Audio driver name is not NULL");
    8.16 -            SDLTest_AssertCheck(SDL_strlen(audioDriver) > 0, "Audio driver name is not empty; got: %s", audioDriver);
    8.17 +            SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver);
    8.18  
    8.19              /* Change specs */
    8.20              for (j = 0; j < 2; j++) {
    8.21 @@ -226,14 +226,14 @@
    8.22              SDLTest_AssertPass("Call to SDL_GetAudioDeviceName(%i, %i)", i, t);
    8.23              SDLTest_AssertCheck(name != NULL, "Verify result from SDL_GetAudioDeviceName(%i, %i) is not NULL", i, t);
    8.24              if (name != NULL) {
    8.25 -              SDLTest_AssertCheck(SDL_strlen(name)>0, "verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, t, name);
    8.26 +              SDLTest_AssertCheck(name[0] != '\0', "verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, t, name);
    8.27                if (t==1) {
    8.28                    /* Also try non-zero type */
    8.29                    tt = t + SDLTest_RandomIntegerInRange(1,10);
    8.30                    nameAgain = SDL_GetAudioDeviceName(i, tt);
    8.31                    SDLTest_AssertCheck(nameAgain != NULL, "Verify result from SDL_GetAudioDeviceName(%i, %i) is not NULL", i, tt);
    8.32                    if (nameAgain != NULL) {
    8.33 -                    SDLTest_AssertCheck(SDL_strlen(nameAgain)>0, "Verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, tt, nameAgain);
    8.34 +                    SDLTest_AssertCheck(nameAgain[0] != '\0', "Verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, tt, nameAgain);
    8.35                      SDLTest_AssertCheck(SDL_strcmp(name, nameAgain)==0,
    8.36                        "Verify SDL_GetAudioDeviceName(%i, %i) and SDL_GetAudioDeviceName(%i %i) return the same string",
    8.37                        i, t, i, tt);
    8.38 @@ -318,7 +318,7 @@
    8.39           SDLTest_AssertPass("Call to SDL_GetAudioDriver(%i)", i);
    8.40           SDLTest_AssertCheck(name != NULL, "Verify returned name is not NULL");
    8.41           if (name != NULL) {
    8.42 -            SDLTest_AssertCheck(SDL_strlen(name)>0, "Verify returned name is not empty, got: '%s'", name);
    8.43 +            SDLTest_AssertCheck(name[0] != '\0', "Verify returned name is not empty, got: '%s'", name);
    8.44           }
    8.45        }
    8.46     }
    8.47 @@ -339,7 +339,7 @@
    8.48     SDLTest_AssertPass("Call to SDL_GetCurrentAudioDriver()");
    8.49     SDLTest_AssertCheck(name != NULL, "Verify returned name is not NULL");
    8.50     if (name != NULL) {
    8.51 -      SDLTest_AssertCheck(SDL_strlen(name)>0, "Verify returned name is not empty, got: '%s'", name);
    8.52 +      SDLTest_AssertCheck(name[0] != '\0', "Verify returned name is not empty, got: '%s'", name);
    8.53     }
    8.54  
    8.55     return TEST_COMPLETED;
    8.56 @@ -509,7 +509,7 @@
    8.57      SDLTest_AssertCheck(result == -1, "Verify result value; expected: -1, got: %i", result);
    8.58      error = SDL_GetError();
    8.59      SDLTest_AssertPass("Call to SDL_GetError()");
    8.60 -    SDLTest_AssertCheck(error != NULL && SDL_strlen(error)>0, "Validate that error message was not NULL or empty");
    8.61 +    SDLTest_AssertCheck(error != NULL && error[0] != '\0', "Validate that error message was not NULL or empty");
    8.62    }
    8.63  
    8.64    SDL_ClearError();
     9.1 --- a/test/testautomation_clipboard.c	Thu Aug 29 08:29:51 2013 -0700
     9.2 +++ b/test/testautomation_clipboard.c	Thu Aug 29 08:30:21 2013 -0700
     9.3 @@ -118,7 +118,7 @@
     9.4          charResult != NULL,
     9.5          "Verify SDL_GetClipboardText did not return NULL");
     9.6      SDLTest_AssertCheck(
     9.7 -        SDL_strlen(charResult) == 0,
     9.8 +        charResult[0] == '\0',
     9.9          "Verify SDL_GetClipboardText returned string with length 0, got length %i",
    9.10          SDL_strlen(charResult));
    9.11      intResult = SDL_SetClipboardText((const char *)text);
    10.1 --- a/test/testautomation_pixels.c	Thu Aug 29 08:29:51 2013 -0700
    10.2 +++ b/test/testautomation_pixels.c	Thu Aug 29 08:30:21 2013 -0700
    10.3 @@ -242,7 +242,7 @@
    10.4    SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
    10.5    SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
    10.6    if (result != NULL) {
    10.7 -      SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
    10.8 +      SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
    10.9        SDLTest_AssertCheck(SDL_strcmp(result, unknownFormat) == 0,
   10.10          "Verify result text; expected: %s, got %s", unknownFormat, result);
   10.11    }
   10.12 @@ -257,7 +257,7 @@
   10.13      SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   10.14      SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   10.15      if (result != NULL) {
   10.16 -      SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
   10.17 +      SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
   10.18        SDLTest_AssertCheck(SDL_strcmp(result, _RGBPixelFormatsVerbose[i]) == 0,
   10.19          "Verify result text; expected: %s, got %s", _RGBPixelFormatsVerbose[i], result);
   10.20      }
   10.21 @@ -273,7 +273,7 @@
   10.22      SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   10.23      SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   10.24      if (result != NULL) {
   10.25 -      SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
   10.26 +      SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
   10.27        SDLTest_AssertCheck(SDL_strcmp(result, _nonRGBPixelFormatsVerbose[i]) == 0,
   10.28          "Verify result text; expected: %s, got %s", _nonRGBPixelFormatsVerbose[i], result);
   10.29      }
   10.30 @@ -290,14 +290,14 @@
   10.31      SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format);
   10.32      SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   10.33      if (result != NULL) {
   10.34 -      SDLTest_AssertCheck(SDL_strlen(result) > 0,
   10.35 +      SDLTest_AssertCheck(result[0] != '\0',
   10.36          "Verify result is non-empty; got: %s", result);
   10.37        SDLTest_AssertCheck(SDL_strcmp(result, _invalidPixelFormatsVerbose[i]) == 0,
   10.38          "Validate name is UNKNOWN, expected: '%s', got: '%s'", _invalidPixelFormatsVerbose[i], result);
   10.39      }
   10.40      error = SDL_GetError();
   10.41      SDLTest_AssertPass("Call to SDL_GetError()");
   10.42 -    SDLTest_AssertCheck(error != NULL && SDL_strlen(error) == 0, "Validate that error message is empty");
   10.43 +    SDLTest_AssertCheck(error != NULL && error[0] != '\0', "Validate that error message is empty");
   10.44    }
   10.45  
   10.46    return TEST_COMPLETED;
    11.1 --- a/test/testautomation_sdltest.c	Thu Aug 29 08:29:51 2013 -0700
    11.2 +++ b/test/testautomation_sdltest.c	Thu Aug 29 08:30:21 2013 -0700
    11.3 @@ -192,7 +192,7 @@
    11.4      "Validate result value for parameters (1,255,SDL_FALSE); expected: 0, got: %lld", uresult);
    11.5    lastError = (char *)SDL_GetError();
    11.6    SDLTest_AssertPass("SDL_GetError()");
    11.7 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
    11.8 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
    11.9  
   11.10    /* RandomUintXBoundaryValue(0, 0xfe, SDL_FALSE) returns 0xff (no error) */
   11.11    uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 254, SDL_FALSE);
   11.12 @@ -202,7 +202,7 @@
   11.13      "Validate result value for parameters (0,254,SDL_FALSE); expected: 0xff, got: %lld", uresult);
   11.14    lastError = (char *)SDL_GetError();
   11.15    SDLTest_AssertPass("SDL_GetError()");
   11.16 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.17 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.18  
   11.19    /* RandomUintXBoundaryValue(0, 0xff, SDL_FALSE) returns 0 (sets error) */
   11.20    uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 255, SDL_FALSE);
   11.21 @@ -302,7 +302,7 @@
   11.22      "Validate result value for parameters (1,0xffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   11.23    lastError = (char *)SDL_GetError();
   11.24    SDLTest_AssertPass("SDL_GetError()");
   11.25 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.26 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.27  
   11.28    /* RandomUintXBoundaryValue(0, 0xfffe, SDL_FALSE) returns 0xffff (no error) */
   11.29    uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xfffe, SDL_FALSE);
   11.30 @@ -312,7 +312,7 @@
   11.31      "Validate result value for parameters (0,0xfffe,SDL_FALSE); expected: 0xffff, got: %lld", uresult);
   11.32    lastError = (char *)SDL_GetError();
   11.33    SDLTest_AssertPass("SDL_GetError()");
   11.34 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.35 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.36  
   11.37    /* RandomUintXBoundaryValue(0, 0xffff, SDL_FALSE) returns 0 (sets error) */
   11.38    uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xffff, SDL_FALSE);
   11.39 @@ -412,7 +412,7 @@
   11.40      "Validate result value for parameters (1,0xffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   11.41    lastError = (char *)SDL_GetError();
   11.42    SDLTest_AssertPass("SDL_GetError()");
   11.43 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.44 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.45  
   11.46    /* RandomUintXBoundaryValue(0, 0xfffffffe, SDL_FALSE) returns 0xffffffff (no error) */
   11.47    uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xfffffffe, SDL_FALSE);
   11.48 @@ -422,7 +422,7 @@
   11.49      "Validate result value for parameters (0,0xfffffffe,SDL_FALSE); expected: 0xffffffff, got: %lld", uresult);
   11.50    lastError = (char *)SDL_GetError();
   11.51    SDLTest_AssertPass("SDL_GetError()");
   11.52 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.53 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.54  
   11.55    /* RandomUintXBoundaryValue(0, 0xffffffff, SDL_FALSE) returns 0 (sets error) */
   11.56    uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xffffffff, SDL_FALSE);
   11.57 @@ -522,7 +522,7 @@
   11.58      "Validate result value for parameters (1,0xffffffffffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   11.59    lastError = (char *)SDL_GetError();
   11.60    SDLTest_AssertPass("SDL_GetError()");
   11.61 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.62 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.63  
   11.64    /* RandomUintXBoundaryValue(0, 0xfffffffffffffffe, SDL_FALSE) returns 0xffffffffffffffff (no error) */
   11.65    uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xfffffffffffffffeULL, SDL_FALSE);
   11.66 @@ -532,7 +532,7 @@
   11.67      "Validate result value for parameters (0,0xfffffffffffffffe,SDL_FALSE); expected: 0xffffffffffffffff, got: %lld", uresult);
   11.68    lastError = (char *)SDL_GetError();
   11.69    SDLTest_AssertPass("SDL_GetError()");
   11.70 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.71 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.72  
   11.73    /* RandomUintXBoundaryValue(0, 0xffffffffffffffff, SDL_FALSE) returns 0 (sets error) */
   11.74    uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xffffffffffffffffULL, SDL_FALSE);
   11.75 @@ -632,7 +632,7 @@
   11.76      "Validate result value for parameters (SCHAR_MIN + 1,SCHAR_MAX,SDL_FALSE); expected: %d, got: %lld", SCHAR_MIN, sresult);
   11.77    lastError = (char *)SDL_GetError();
   11.78    SDLTest_AssertPass("SDL_GetError()");
   11.79 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.80 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.81  
   11.82    /* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX - 1, SDL_FALSE) returns SCHAR_MAX (no error) */
   11.83    sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX -1, SDL_FALSE);
   11.84 @@ -642,7 +642,7 @@
   11.85      "Validate result value for parameters (SCHAR_MIN,SCHAR_MAX - 1,SDL_FALSE); expected: %d, got: %lld", SCHAR_MAX, sresult);
   11.86    lastError = (char *)SDL_GetError();
   11.87    SDLTest_AssertPass("SDL_GetError()");
   11.88 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.89 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.90  
   11.91    /* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE) returns SCHAR_MIN (sets error) */
   11.92    sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE);
   11.93 @@ -742,7 +742,7 @@
   11.94      "Validate result value for parameters (SHRT_MIN+1,SHRT_MAX,SDL_FALSE); expected: %d, got: %lld", SHRT_MIN, sresult);
   11.95    lastError = (char *)SDL_GetError();
   11.96    SDLTest_AssertPass("SDL_GetError()");
   11.97 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   11.98 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   11.99  
  11.100    /* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE) returns SHRT_MAX (no error) */
  11.101    sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE);
  11.102 @@ -752,7 +752,7 @@
  11.103      "Validate result value for parameters (SHRT_MIN,SHRT_MAX - 1,SDL_FALSE); expected: %d, got: %lld", SHRT_MAX, sresult);
  11.104    lastError = (char *)SDL_GetError();
  11.105    SDLTest_AssertPass("SDL_GetError()");
  11.106 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
  11.107 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
  11.108  
  11.109    /* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE) returns 0 (sets error) */
  11.110    sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE);
  11.111 @@ -859,7 +859,7 @@
  11.112      "Validate result value for parameters (LONG_MIN+1,LONG_MAX,SDL_FALSE); expected: %d, got: %lld", long_min, sresult);
  11.113    lastError = (char *)SDL_GetError();
  11.114    SDLTest_AssertPass("SDL_GetError()");
  11.115 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
  11.116 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
  11.117  
  11.118    /* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX - 1, SDL_FALSE) returns LONG_MAX (no error) */
  11.119    sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max - 1, SDL_FALSE);
  11.120 @@ -869,7 +869,7 @@
  11.121      "Validate result value for parameters (LONG_MIN,LONG_MAX - 1,SDL_FALSE); expected: %d, got: %lld", long_max, sresult);
  11.122    lastError = (char *)SDL_GetError();
  11.123    SDLTest_AssertPass("SDL_GetError()");
  11.124 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
  11.125 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
  11.126  
  11.127    /* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX, SDL_FALSE) returns 0 (sets error) */
  11.128    sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max, SDL_FALSE);
  11.129 @@ -969,7 +969,7 @@
  11.130      "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %lld, got: %lld", LLONG_MIN, sresult);
  11.131    lastError = (char *)SDL_GetError();
  11.132    SDLTest_AssertPass("SDL_GetError()");
  11.133 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
  11.134 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
  11.135  
  11.136    /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE) returns LLONG_MAX (no error) */
  11.137    sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE);
  11.138 @@ -979,7 +979,7 @@
  11.139      "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %lld, got: %lld", LLONG_MAX, sresult);
  11.140    lastError = (char *)SDL_GetError();
  11.141    SDLTest_AssertPass("SDL_GetError()");
  11.142 -  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
  11.143 +  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
  11.144  
  11.145    /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE) returns 0 (sets error) */
  11.146    sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE);
    12.1 --- a/test/testime.c	Thu Aug 29 08:29:51 2013 -0700
    12.2 +++ b/test/testime.c	Thu Aug 29 08:30:21 2013 -0700
    12.3 @@ -331,7 +331,7 @@
    12.4                      break;
    12.5  
    12.6                  case SDL_TEXTINPUT:
    12.7 -                    if (SDL_strlen(event.text.text) == 0 || event.text.text[0] == '\n' ||
    12.8 +                    if (event.text.text[0] == '\0' || event.text.text[0] == '\n' ||
    12.9                          markedRect.w < 0)
   12.10                          break;
   12.11