summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2016-10-07 17:41:32 (GMT)
committerBrad King <brad.king@kitware.com>2016-10-08 09:25:34 (GMT)
commitbf28a3873d633d233991f14e8e4d10c76f410deb (patch)
tree949a260eb308199ad1eef5a68137da80eecdfe67
parent0ab471adf18924a3a85a81fec79052e191bfcf94 (diff)
downloadCMake-bf28a3873d633d233991f14e8e4d10c76f410deb.zip
CMake-bf28a3873d633d233991f14e8e4d10c76f410deb.tar.gz
CMake-bf28a3873d633d233991f14e8e4d10c76f410deb.tar.bz2
KWSys 2016-10-07 (dfe9b386)
Code extracted from: http://public.kitware.com/KWSys.git at commit dfe9b38635d80cb5253187c1ddf90923e1b9effd (master). Upstream Shortlog ----------------- Brad King (1): dfe9b386 SystemTools: Re-implement Strucmp
-rw-r--r--SystemTools.cxx20
1 files changed, 9 insertions, 11 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx
index c97af25..5da715f 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