aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-07-01 17:35:52 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-07-05 07:11:31 +0000
commit3c01766dc978858627cd1fd46c991fa93165667b (patch)
tree633942937a9490948b7866cf5bde0688c7d36854
parent38f8c5a39b9215961c4f7ff8d0833acdbddffc0d (diff)
downloadruby-rmatch-regs-is-never-null.tar.gz
re.c: RMATCH_REGS(x) is never NULLrmatch-regs-is-never-null
-rw-r--r--re.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/re.c b/re.c
index d0aa2a7..2ac1778 100644
--- a/re.c
+++ b/re.c
@@ -1265,11 +1265,8 @@ rb_match_busy(VALUE match)
int
rb_match_count(VALUE match)
{
- struct re_registers *regs;
if (NIL_P(match)) return -1;
- regs = RMATCH_REGS(match);
- if (!regs) return -1;
- return regs->num_regs;
+ return RMATCH_REGS(match)->num_regs;
}
int
@@ -1278,7 +1275,6 @@ rb_match_nth_defined(int nth, VALUE match)
struct re_registers *regs;
if (NIL_P(match)) return FALSE;
regs = RMATCH_REGS(match);
- if (!regs) return FALSE;
if (nth >= regs->num_regs) {
return FALSE;
}