summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 7520b1d..43fb71c 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -566,15 +566,14 @@ int buffer_caseless_compare(const char *a, size_t a_len, const char *b, size_t b
max_ndx = ((a_len < b_len) ? a_len : b_len);
for (; ndx < max_ndx; ndx++) {
- char a1 = *a++, b1 = *b++;
+ int a1 = *a++, b1 = *b++;
if (a1 != b1) {
- if ((a1 >= 'A' && a1 <= 'Z') && (b1 >= 'a' && b1 <= 'z'))
- a1 |= 32;
- else if ((a1 >= 'a' && a1 <= 'z') && (b1 >= 'A' && b1 <= 'Z'))
- b1 |= 32;
- if ((a1 - b1) != 0) return (a1 - b1);
+ /* always lowercase for transitive results */
+ if (a1 >= 'A' && a1 <= 'Z') a1 |= 32;
+ if (b1 >= 'A' && b1 <= 'Z') b1 |= 32;
+ if ((a1 - b1) != 0) return (a1 - b1);
}
}