summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-08 05:06:52 (GMT)
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-08 05:06:52 (GMT)
commit24fff7504595dcbc5466d209485b13074fb33a3d (patch)
tree7e833bfc999d8f79c3a575b762f02a40747cceac /st.c
parentf4a2170ec27ca623d127353d5b19212a35fe9d70 (diff)
avoid (size_t)--
The decrements overflow and these variables remain ~0 when leaving the while loops. They are not fatal by accident, but better replace with ordinal for loops. See also: https://travis-ci.org/ruby/ruby/jobs/452218871#L3246 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'st.c')
-rw-r--r--st.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/st.c b/st.c
index ee3dbb1..6a943b8 100644
--- a/st.c
+++ b/st.c
@@ -2036,8 +2036,9 @@ int
st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n)
{
char c1, c2;
+ int i;
- while (n--) {
+ for (i = 0; i < n; i++) {
c1 = *s1++;
c2 = *s2++;
if (c1 == '\0' || c2 == '\0') {