2006-07-22 Bruno Haible <bruno@clisp.org>
+ * c-strcasecmp.c: Update from gnulib. Don't assume that
+ UCHAR_MAX <= INT_MAX.
+ * c-strncasecmp.c: Likewise.
+
* copy-file.c: Update from gnulib.
* atexit.c: Update from gnulib.
/* Specification. */
#include "c-strcase.h"
+#include <limits.h>
+
#include "c-ctype.h"
int
}
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);
}
/* Specification. */
#include "c-strcase.h"
+#include <limits.h>
+
#include "c-ctype.h"
int
}
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);
}