[llvm-commits] [llvm] r50823 - /llvm/trunk/include/llvm/ADT/StringExtras.h

Ted Kremenek kremenek at apple.com
Wed May 7 11:49:31 PDT 2008


Author: kremenek
Date: Wed May  7 13:49:31 2008
New Revision: 50823

URL: http://llvm.org/viewvc/llvm-project?rev=50823&view=rev
Log:
Guard for empty strings in CStrInCStrNoCase.

Modified:
    llvm/trunk/include/llvm/ADT/StringExtras.h

Modified: llvm/trunk/include/llvm/ADT/StringExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringExtras.h?rev=50823&r1=50822&r2=50823&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/StringExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/StringExtras.h Wed May  7 13:49:31 2008
@@ -147,8 +147,8 @@
 ///  NULL if 's1' cannot be found.
 static inline const char* CStrInCStrNoCase(const char *s1, const char *s2) {
 
-  // Are either strings NULL?
-  if (!s1 || !s2)
+  // Are either strings NULL or empty?
+  if (!s1 || !s2 || s1[0] == '\0' || s2[0] == '\0')
     return 0;
   
   const char *I1=s1, *I2=s2;





More information about the llvm-commits mailing list