Commit dfe9b386 authored by Brad King's avatar Brad King

SystemTools: Re-implement Strucmp

The current implementation was added by commit 5c8693bc (remove
redundant function and eliminate need for strcasecmp, 2003-04-11).  The
code was taken from Graphviz in 2003 from a source file that at the time
was distributed under terms of the Common Public License, Version 1.0.
While the actual content is simple and likely not copyrightable, clarify
the licensing status by simply re-implementing the function from scratch
using another approach.

Change-Id: I44f72b215577af9e3de234b5ef03113c580a3bd6
parent 6cfcbede
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment