diff --git a/SystemTools.cxx b/SystemTools.cxx
index c97af251443f002132a321e88fabae885801e0e8..5da715f48a49413e21b72e3359fbf0add0b3b282 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -2716,17 +2716,15 @@ unsigned long SystemTools::FileLength(const std::string& filename)
   return length;
 }
 
-int SystemTools::Strucmp(const char *s1, const char *s2)
-{
-  // lifted from Graphvis http://www.graphviz.org
-  while ((*s1 != '\0')
-         && (tolower(*s1) == tolower(*s2)))
-    {
-      s1++;
-      s2++;
-    }
-
-  return tolower(*s1) - tolower(*s2);
+int SystemTools::Strucmp(const char* l, const char* r)
+{
+  int lc;
+  int rc;
+  do {
+    lc = tolower(*l++);
+    rc = tolower(*r++);
+  } while(lc == rc && lc);
+  return lc - rc;
 }
 
 // return file's modified time