aboutsummaryrefslogtreecommitdiffstats
path: root/ruby.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-07-14 21:56:39 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-07-14 21:58:22 +0900
commit085d0e5ccb7cecb1f761c1d3c72caeeedafc7d04 (patch)
treebf622488e19d28d18202f5efaba5be8d4afee22f /ruby.c
parenta3493521a55e32081520be805a764fd2ad43fe7b (diff)
downloadruby-085d0e5ccb7cecb1f761c1d3c72caeeedafc7d04.tar.gz
ruby.c (name_match_p): remove unnecessary condition
It always returns immediately when len was decremented to zero. So len is always positive. This change will suppress Coverity Scan warning.
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ruby.c b/ruby.c
index c32055a203..2610cf2387 100644
--- a/ruby.c
+++ b/ruby.c
@@ -834,7 +834,7 @@ static int
name_match_p(const char *name, const char *str, size_t len)
{
if (len == 0) return 0;
- do {
+ while (1) {
while (TOLOWER(*str) == *name) {
if (!--len || !*++str) return 1;
++name;
@@ -844,8 +844,7 @@ name_match_p(const char *name, const char *str, size_t len)
if (*name != '-' && *name != '_') return 0;
++name;
++str;
- } while (len > 0);
- return !*name;
+ }
}
#define NAME_MATCH_P(name, str, len) \