summaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-01 13:19:21 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-01 13:19:21 +0000
commite2cc8d466b0849cae859bd10de5a44d6115bcdf4 (patch)
tree6ab92d85c8f2d0a08c6c96201f48db7d9aac9066 /st.c
parent074d482414640ea2ca4190ae3f902820d32fcd8d (diff)
downloadruby-e2cc8d466b0849cae859bd10de5a44d6115bcdf4.tar.gz
ruby-e2cc8d466b0849cae859bd10de5a44d6115bcdf4.tar.xz
ruby-e2cc8d466b0849cae859bd10de5a44d6115bcdf4.zip
abolish warnings by previous change.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'st.c')
-rw-r--r--st.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/st.c b/st.c
index 4af67caf5..1d04f605a 100644
--- a/st.c
+++ b/st.c
@@ -869,8 +869,11 @@ st_strcasecmp(const char *s1, const char *s2)
while (1) {
c1 = (unsigned char)*s1++;
c2 = (unsigned char)*s2++;
- if (!c1) break;
- if (!c2) break;
+ if (c1 == '\0' || c2 == '\0') {
+ if (c1 != '\0') return 1;
+ if (c2 != '\0') return -1;
+ return 0;
+ }
if ((unsigned int)(c1 - 'A') <= ('Z' - 'A')) c1 += 'a' - 'A';
if ((unsigned int)(c2 - 'A') <= ('Z' - 'A')) c2 += 'a' - 'A';
if (c1 != c2) {
@@ -880,11 +883,6 @@ st_strcasecmp(const char *s1, const char *s2)
return -1;
}
}
- if (c1 != '\0')
- return 1;
- if (c2 != '\0')
- return -1;
- return 0;
}
int
@@ -895,8 +893,11 @@ st_strncasecmp(const char *s1, const char *s2, size_t n)
while (n--) {
c1 = (unsigned char)*s1++;
c2 = (unsigned char)*s2++;
- if (!c1) break;
- if (!c2) break;
+ if (c1 == '\0' || c2 == '\0') {
+ if (c1 != '\0') return 1;
+ if (c2 != '\0') return -1;
+ return 0;
+ }
if ((unsigned int)(c1 - 'A') <= ('Z' - 'A')) c1 += 'a' - 'A';
if ((unsigned int)(c2 - 'A') <= ('Z' - 'A')) c2 += 'a' - 'A';
if (c1 != c2) {
@@ -906,12 +907,6 @@ st_strncasecmp(const char *s1, const char *s2, size_t n)
return -1;
}
}
- if (n == 0)
- return 0;
- if (c1 != '\0')
- return 1;
- if (c2 != '\0')
- return -1;
return 0;
}