[cfe-commits] r93114 - /cfe/trunk/lib/Lex/HeaderMap.cpp

Benjamin Kramer benny.kra at googlemail.com
Sun Jan 10 01:51:01 PST 2010


Author: d0k
Date: Sun Jan 10 03:51:00 2010
New Revision: 93114

URL: http://llvm.org/viewvc/llvm-project?rev=93114&view=rev
Log:
Simplify code. No functionality change.

Modified:
    cfe/trunk/lib/Lex/HeaderMap.cpp

Modified: cfe/trunk/lib/Lex/HeaderMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp?rev=93114&r1=93113&r2=93114&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/HeaderMap.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderMap.cpp Sun Jan 10 03:51:00 2010
@@ -173,17 +173,6 @@
   return FileBuffer->getBufferStart()+StrTabIdx;
 }
 
-/// StringsEqualWithoutCase - Compare the specified two strings for case-
-/// insensitive equality, returning true if they are equal.  Both strings are
-/// known to have the same length.
-static bool StringsEqualWithoutCase(const char *S1, const char *S2,
-                                    unsigned Len) {
-  for (; Len; ++S1, ++S2, --Len)
-    if (tolower(*S1) != tolower(*S2))
-      return false;
-  return true;
-}
-
 //===----------------------------------------------------------------------===//
 // The Main Drivers
 //===----------------------------------------------------------------------===//
@@ -226,13 +215,7 @@
     if (B.Key == HMAP_EmptyBucketKey) return 0; // Hash miss.
 
     // See if the key matches.  If not, probe on.
-    const char *Key = getString(B.Key);
-    unsigned BucketKeyLen = strlen(Key);
-    if (BucketKeyLen != unsigned(Filename.size()))
-      continue;
-
-    // See if the actual strings equal.
-    if (!StringsEqualWithoutCase(Filename.begin(), Key, BucketKeyLen))
+    if (!Filename.equals_lower(getString(B.Key)))
       continue;
 
     // If so, we have a match in the hash table.  Construct the destination





More information about the cfe-commits mailing list