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 7721 bdf8c2c84e14
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
--- a/src/test/SDL_test_harness.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/src/test/SDL_test_harness.c	Thu Aug 29 08:30:21 2013 -0700
@@ -109,17 +109,17 @@
     Uint32 entireStringLength;
     char *buffer;
 
-    if (runSeed == NULL || SDL_strlen(runSeed)==0) {
+    if (runSeed == NULL || runSeed[0] == '\0') {
         SDLTest_LogError("Invalid runSeed string.");
         return -1;
     }
 
-    if (suiteName == NULL || SDL_strlen(suiteName)==0) {
+    if (suiteName == NULL || suiteName[0] == '\0') {
         SDLTest_LogError("Invalid suiteName string.");
         return -1;
     }
 
-    if (testName == NULL || SDL_strlen(testName)==0) {
+    if (testName == NULL || testName[0] == '\0') {
         SDLTest_LogError("Invalid testName string.");
         return -1;
     }
@@ -399,7 +399,7 @@
     }
 
     /* Generate run see if we don't have one already */
-    if (userRunSeed == NULL || SDL_strlen(userRunSeed) == 0) {
+    if (userRunSeed == NULL || userRunSeed[0] == '\0') {
         runSeed = SDLTest_GenerateRunSeed(16);
         if (runSeed == NULL) {
             SDLTest_LogError("Generating a random seed failed");
@@ -422,7 +422,7 @@
     SDLTest_Log("::::: Test Run /w seed '%s' started\n", runSeed);
 
     /* Initialize filtering */
-    if (filter != NULL && SDL_strlen(filter) > 0) {
+    if (filter != NULL && filter[0] != '\0') {
         /* Loop over all suites to check if we have a filter match */
         suiteCounter = 0;
         while (testSuites[suiteCounter] && suiteFilter == 0) {
@@ -521,7 +521,7 @@
                         suiteCounter,
                         testCounter,
                         currentTestName);
-                    if (testCase->description != NULL && SDL_strlen(testCase->description)>0) {
+                    if (testCase->description != NULL && testCase->description[0] != '\0') {
                         SDLTest_Log("Test Description: '%s'",
                             (testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
                     }
--- a/src/video/SDL_clipboard.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/src/video/SDL_clipboard.c	Thu Aug 29 08:30:21 2013 -0700
@@ -65,7 +65,7 @@
     if (_this->HasClipboardText) {
         return _this->HasClipboardText(_this);
     } else {
-        if ((_this->clipboard_text) && (SDL_strlen(_this->clipboard_text)>0)) {
+        if (_this->clipboard_text && _this->clipboard_text[0] != '\0') {
             return SDL_TRUE;
         } else {
             return SDL_FALSE;
--- a/src/video/SDL_video.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/src/video/SDL_video.c	Thu Aug 29 08:30:21 2013 -0700
@@ -1453,7 +1453,7 @@
     CHECK_WINDOW_MAGIC(window, NULL);
 
     /* Input validation */
-    if (name == NULL || SDL_strlen(name) == 0) {
+    if (name == NULL || name[0] == '\0') {
       SDL_InvalidParamError("name");
       return NULL;
     }
@@ -1500,7 +1500,7 @@
     CHECK_WINDOW_MAGIC(window, NULL);
 
     /* Input validation */
-    if (name == NULL || SDL_strlen(name) == 0) {
+    if (name == NULL || name[0] == '\0') {
       SDL_InvalidParamError("name");
       return NULL;
     }
--- a/src/video/bwindow/SDL_bclipboard.cc	Thu Aug 29 08:29:51 2013 -0700
+++ b/src/video/bwindow/SDL_bclipboard.cc	Thu Aug 29 08:30:21 2013 -0700
@@ -82,7 +82,7 @@
 	SDL_bool result = SDL_FALSE;
 	char *text = BE_GetClipboardText(_this);
 	if (text) {
-		result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
+		result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
 		SDL_free(text);
 	} 
 	return result;
--- a/src/video/cocoa/SDL_cocoaclipboard.m	Thu Aug 29 08:29:51 2013 -0700
+++ b/src/video/cocoa/SDL_cocoaclipboard.m	Thu Aug 29 08:30:21 2013 -0700
@@ -95,7 +95,7 @@
     SDL_bool result = SDL_FALSE;
     char *text = Cocoa_GetClipboardText(_this);
     if (text) {
-    result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
+        result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
     SDL_free(text);
     }
     return result;
--- a/src/video/windows/SDL_windowsclipboard.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/src/video/windows/SDL_windowsclipboard.c	Thu Aug 29 08:30:21 2013 -0700
@@ -137,7 +137,7 @@
     SDL_bool result = SDL_FALSE;
     char *text = WIN_GetClipboardText(_this);
     if (text) {
-        result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
+        result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
         SDL_free(text);
     }
     return result;
--- a/src/video/x11/SDL_x11clipboard.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/src/video/x11/SDL_x11clipboard.c	Thu Aug 29 08:30:21 2013 -0700
@@ -165,7 +165,7 @@
     SDL_bool result = SDL_FALSE;
     char *text = X11_GetClipboardText(_this);
     if (text) {
-        result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
+        result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
         SDL_free(text);
     }
     return result;
--- a/test/testautomation_audio.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/test/testautomation_audio.c	Thu Aug 29 08:30:21 2013 -0700
@@ -77,7 +77,7 @@
             audioDriver = SDL_GetAudioDriver(i);
             SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i);
             SDLTest_AssertCheck(audioDriver != NULL, "Audio driver name is not NULL");
-            SDLTest_AssertCheck(SDL_strlen(audioDriver) > 0, "Audio driver name is not empty; got: %s", audioDriver);
+            SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver);
 
             /* Call Init */
             result = SDL_AudioInit(audioDriver);
@@ -134,7 +134,7 @@
             audioDriver = SDL_GetAudioDriver(i);
             SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i);
             SDLTest_AssertCheck(audioDriver != NULL, "Audio driver name is not NULL");
-            SDLTest_AssertCheck(SDL_strlen(audioDriver) > 0, "Audio driver name is not empty; got: %s", audioDriver);
+            SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver);
 
             /* Change specs */
             for (j = 0; j < 2; j++) {
@@ -226,14 +226,14 @@
             SDLTest_AssertPass("Call to SDL_GetAudioDeviceName(%i, %i)", i, t);
             SDLTest_AssertCheck(name != NULL, "Verify result from SDL_GetAudioDeviceName(%i, %i) is not NULL", i, t);
             if (name != NULL) {
-              SDLTest_AssertCheck(SDL_strlen(name)>0, "verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, t, name);
+              SDLTest_AssertCheck(name[0] != '\0', "verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, t, name);
               if (t==1) {
                   /* Also try non-zero type */
                   tt = t + SDLTest_RandomIntegerInRange(1,10);
                   nameAgain = SDL_GetAudioDeviceName(i, tt);
                   SDLTest_AssertCheck(nameAgain != NULL, "Verify result from SDL_GetAudioDeviceName(%i, %i) is not NULL", i, tt);
                   if (nameAgain != NULL) {
-                    SDLTest_AssertCheck(SDL_strlen(nameAgain)>0, "Verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, tt, nameAgain);
+                    SDLTest_AssertCheck(nameAgain[0] != '\0', "Verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, tt, nameAgain);
                     SDLTest_AssertCheck(SDL_strcmp(name, nameAgain)==0,
                       "Verify SDL_GetAudioDeviceName(%i, %i) and SDL_GetAudioDeviceName(%i %i) return the same string",
                       i, t, i, tt);
@@ -318,7 +318,7 @@
          SDLTest_AssertPass("Call to SDL_GetAudioDriver(%i)", i);
          SDLTest_AssertCheck(name != NULL, "Verify returned name is not NULL");
          if (name != NULL) {
-            SDLTest_AssertCheck(SDL_strlen(name)>0, "Verify returned name is not empty, got: '%s'", name);
+            SDLTest_AssertCheck(name[0] != '\0', "Verify returned name is not empty, got: '%s'", name);
          }
       }
    }
@@ -339,7 +339,7 @@
    SDLTest_AssertPass("Call to SDL_GetCurrentAudioDriver()");
    SDLTest_AssertCheck(name != NULL, "Verify returned name is not NULL");
    if (name != NULL) {
-      SDLTest_AssertCheck(SDL_strlen(name)>0, "Verify returned name is not empty, got: '%s'", name);
+      SDLTest_AssertCheck(name[0] != '\0', "Verify returned name is not empty, got: '%s'", name);
    }
 
    return TEST_COMPLETED;
@@ -509,7 +509,7 @@
     SDLTest_AssertCheck(result == -1, "Verify result value; expected: -1, got: %i", result);
     error = SDL_GetError();
     SDLTest_AssertPass("Call to SDL_GetError()");
-    SDLTest_AssertCheck(error != NULL && SDL_strlen(error)>0, "Validate that error message was not NULL or empty");
+    SDLTest_AssertCheck(error != NULL && error[0] != '\0', "Validate that error message was not NULL or empty");
   }
 
   SDL_ClearError();
--- a/test/testautomation_clipboard.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/test/testautomation_clipboard.c	Thu Aug 29 08:30:21 2013 -0700
@@ -118,7 +118,7 @@
         charResult != NULL,
         "Verify SDL_GetClipboardText did not return NULL");
     SDLTest_AssertCheck(
-        SDL_strlen(charResult) == 0,
+        charResult[0] == '\0',
         "Verify SDL_GetClipboardText returned string with length 0, got length %i",
         SDL_strlen(charResult));
     intResult = SDL_SetClipboardText((const char *)text);
--- a/test/testautomation_pixels.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/test/testautomation_pixels.c	Thu Aug 29 08:30:21 2013 -0700
@@ -242,7 +242,7 @@
   SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   if (result != NULL) {
-      SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
+      SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
       SDLTest_AssertCheck(SDL_strcmp(result, unknownFormat) == 0,
         "Verify result text; expected: %s, got %s", unknownFormat, result);
   }
@@ -257,7 +257,7 @@
     SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
     if (result != NULL) {
-      SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
+      SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
       SDLTest_AssertCheck(SDL_strcmp(result, _RGBPixelFormatsVerbose[i]) == 0,
         "Verify result text; expected: %s, got %s", _RGBPixelFormatsVerbose[i], result);
     }
@@ -273,7 +273,7 @@
     SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
     if (result != NULL) {
-      SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
+      SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
       SDLTest_AssertCheck(SDL_strcmp(result, _nonRGBPixelFormatsVerbose[i]) == 0,
         "Verify result text; expected: %s, got %s", _nonRGBPixelFormatsVerbose[i], result);
     }
@@ -290,14 +290,14 @@
     SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format);
     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
     if (result != NULL) {
-      SDLTest_AssertCheck(SDL_strlen(result) > 0,
+      SDLTest_AssertCheck(result[0] != '\0',
         "Verify result is non-empty; got: %s", result);
       SDLTest_AssertCheck(SDL_strcmp(result, _invalidPixelFormatsVerbose[i]) == 0,
         "Validate name is UNKNOWN, expected: '%s', got: '%s'", _invalidPixelFormatsVerbose[i], result);
     }
     error = SDL_GetError();
     SDLTest_AssertPass("Call to SDL_GetError()");
-    SDLTest_AssertCheck(error != NULL && SDL_strlen(error) == 0, "Validate that error message is empty");
+    SDLTest_AssertCheck(error != NULL && error[0] != '\0', "Validate that error message is empty");
   }
 
   return TEST_COMPLETED;
--- a/test/testautomation_sdltest.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/test/testautomation_sdltest.c	Thu Aug 29 08:30:21 2013 -0700
@@ -192,7 +192,7 @@
     "Validate result value for parameters (1,255,SDL_FALSE); expected: 0, got: %lld", uresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomUintXBoundaryValue(0, 0xfe, SDL_FALSE) returns 0xff (no error) */
   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 254, SDL_FALSE);
@@ -202,7 +202,7 @@
     "Validate result value for parameters (0,254,SDL_FALSE); expected: 0xff, got: %lld", uresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomUintXBoundaryValue(0, 0xff, SDL_FALSE) returns 0 (sets error) */
   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 255, SDL_FALSE);
@@ -302,7 +302,7 @@
     "Validate result value for parameters (1,0xffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomUintXBoundaryValue(0, 0xfffe, SDL_FALSE) returns 0xffff (no error) */
   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xfffe, SDL_FALSE);
@@ -312,7 +312,7 @@
     "Validate result value for parameters (0,0xfffe,SDL_FALSE); expected: 0xffff, got: %lld", uresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomUintXBoundaryValue(0, 0xffff, SDL_FALSE) returns 0 (sets error) */
   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xffff, SDL_FALSE);
@@ -412,7 +412,7 @@
     "Validate result value for parameters (1,0xffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomUintXBoundaryValue(0, 0xfffffffe, SDL_FALSE) returns 0xffffffff (no error) */
   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xfffffffe, SDL_FALSE);
@@ -422,7 +422,7 @@
     "Validate result value for parameters (0,0xfffffffe,SDL_FALSE); expected: 0xffffffff, got: %lld", uresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomUintXBoundaryValue(0, 0xffffffff, SDL_FALSE) returns 0 (sets error) */
   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xffffffff, SDL_FALSE);
@@ -522,7 +522,7 @@
     "Validate result value for parameters (1,0xffffffffffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomUintXBoundaryValue(0, 0xfffffffffffffffe, SDL_FALSE) returns 0xffffffffffffffff (no error) */
   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xfffffffffffffffeULL, SDL_FALSE);
@@ -532,7 +532,7 @@
     "Validate result value for parameters (0,0xfffffffffffffffe,SDL_FALSE); expected: 0xffffffffffffffff, got: %lld", uresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomUintXBoundaryValue(0, 0xffffffffffffffff, SDL_FALSE) returns 0 (sets error) */
   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xffffffffffffffffULL, SDL_FALSE);
@@ -632,7 +632,7 @@
     "Validate result value for parameters (SCHAR_MIN + 1,SCHAR_MAX,SDL_FALSE); expected: %d, got: %lld", SCHAR_MIN, sresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX - 1, SDL_FALSE) returns SCHAR_MAX (no error) */
   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX -1, SDL_FALSE);
@@ -642,7 +642,7 @@
     "Validate result value for parameters (SCHAR_MIN,SCHAR_MAX - 1,SDL_FALSE); expected: %d, got: %lld", SCHAR_MAX, sresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE) returns SCHAR_MIN (sets error) */
   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE);
@@ -742,7 +742,7 @@
     "Validate result value for parameters (SHRT_MIN+1,SHRT_MAX,SDL_FALSE); expected: %d, got: %lld", SHRT_MIN, sresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE) returns SHRT_MAX (no error) */
   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE);
@@ -752,7 +752,7 @@
     "Validate result value for parameters (SHRT_MIN,SHRT_MAX - 1,SDL_FALSE); expected: %d, got: %lld", SHRT_MAX, sresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE) returns 0 (sets error) */
   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE);
@@ -859,7 +859,7 @@
     "Validate result value for parameters (LONG_MIN+1,LONG_MAX,SDL_FALSE); expected: %d, got: %lld", long_min, sresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX - 1, SDL_FALSE) returns LONG_MAX (no error) */
   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max - 1, SDL_FALSE);
@@ -869,7 +869,7 @@
     "Validate result value for parameters (LONG_MIN,LONG_MAX - 1,SDL_FALSE); expected: %d, got: %lld", long_max, sresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX, SDL_FALSE) returns 0 (sets error) */
   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max, SDL_FALSE);
@@ -969,7 +969,7 @@
     "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %lld, got: %lld", LLONG_MIN, sresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE) returns LLONG_MAX (no error) */
   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE);
@@ -979,7 +979,7 @@
     "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %lld, got: %lld", LLONG_MAX, sresult);
   lastError = (char *)SDL_GetError();
   SDLTest_AssertPass("SDL_GetError()");
-  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
+  SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
 
   /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE) returns 0 (sets error) */
   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE);
--- a/test/testime.c	Thu Aug 29 08:29:51 2013 -0700
+++ b/test/testime.c	Thu Aug 29 08:30:21 2013 -0700
@@ -331,7 +331,7 @@
                     break;
 
                 case SDL_TEXTINPUT:
-                    if (SDL_strlen(event.text.text) == 0 || event.text.text[0] == '\n' ||
+                    if (event.text.text[0] == '\0' || event.text.text[0] == '\n' ||
                         markedRect.w < 0)
                         break;