diff options
author | Claudio Fontana <sick_soul@users.sourceforge.net> | 2006-01-06 04:52:00 +0000 |
---|---|---|
committer | Claudio Fontana <sick_soul@users.sourceforge.net> | 2006-01-06 04:52:00 +0000 |
commit | b5b7b0baf551299e058432d58d5ab2e21d16c312 (patch) | |
tree | f0535089c67a6d6fdd746532953007253dd08cdb /lib/strcasecmp.c | |
parent | a15c29c1a101a6bedc1a0ee5f6efd694a1ff4cad (diff) | |
download | idutils-b5b7b0baf551299e058432d58d5ab2e21d16c312.tar.gz idutils-b5b7b0baf551299e058432d58d5ab2e21d16c312.tar.bz2 idutils-b5b7b0baf551299e058432d58d5ab2e21d16c312.zip |
* s/id-utils/idutils/g;
* other small changes
Diffstat (limited to 'lib/strcasecmp.c')
-rw-r--r-- | lib/strcasecmp.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/strcasecmp.c b/lib/strcasecmp.c index 71f2eca..c1bac0a 100644 --- a/lib/strcasecmp.c +++ b/lib/strcasecmp.c @@ -25,6 +25,7 @@ #include "strcase.h" #include <ctype.h> +#include <limits.h> #if HAVE_MBRTOWC # include "mbuiter.h" @@ -93,6 +94,12 @@ strcasecmp (const char *s1, const char *s2) } while (c1 == c2); - return c1 - c2; + if (UCHAR_MAX <= INT_MAX) + return c1 - c2; + else + /* On machines where 'char' and 'int' are types of the same size, the + difference of two 'unsigned char' values - including the sign bit - + doesn't fit in an 'int'. */ + return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); } } |