summaryrefslogtreecommitdiff
path: root/src/charset
diff options
context:
space:
mode:
authorAndrew Sidwell <andy@entai.co.uk>2008-08-09 15:37:38 +0000
committerAndrew Sidwell <andy@entai.co.uk>2008-08-09 15:37:38 +0000
commitfd0a6159099729c6a926f99d8601e2f442165a93 (patch)
treeca17f97682f227cedd74968d0e54f01b6f6add7f /src/charset
parentea5862718eaa728765ee0fb96e8c38a9aa4a653c (diff)
downloadlibparserutils-fd0a6159099729c6a926f99d8601e2f442165a93.tar.gz
libparserutils-fd0a6159099729c6a926f99d8601e2f442165a93.tar.bz2
Fix a logic error, and make a test clearer & more efficient as per jmb's review.
svn path=/trunk/libparserutils/; revision=4973
Diffstat (limited to 'src/charset')
-rw-r--r--src/charset/aliases.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/charset/aliases.c b/src/charset/aliases.c
index ce098fb..8ca24f4 100644
--- a/src/charset/aliases.c
+++ b/src/charset/aliases.c
@@ -278,14 +278,12 @@ int aliascmp(const char *s1, const char *s2, size_t s2_len)
while (IS_PUNCT_OR_SPACE(*s1))
s1++;
while (IS_PUNCT_OR_SPACE(s2[s2_pos]) &&
- s2_pos <= s2_len) {
+ s2_pos < s2_len) {
s2_pos++;
}
- if (s2_pos == s2_len && !*s1)
- return 0;
- else if (s2_pos == s2_len || !*s1)
- break;
+ if (s2_pos == s2_len)
+ return (*s1 != '\0') ? 1 : 0;
if (tolower(*s1) != tolower(s2[s2_pos]))
break;