summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/re.c b/re.c
index c334397f00..1561c58e31 100644
--- a/re.c
+++ b/re.c
@@ -718,13 +718,11 @@ reg_match(re, str)
{
int start;
- if (NIL_P(str)) return FALSE;
+ if (NIL_P(str)) return Qnil;
str = str_to_str(str);
start = reg_search(re, str, 0, 0);
- if (start < 0) {
- return FALSE;
- }
- return INT2FIX(start);
+ if (start >= 0) return INT2FIX(start);
+ return Qnil;
}
VALUE
@@ -734,14 +732,10 @@ reg_match2(re)
int start;
VALUE line = lastline_get();
- if (TYPE(line) != T_STRING)
- return FALSE;
-
+ if (TYPE(line) != T_STRING) return Qnil;
start = reg_search(re, line, 0, 0);
- if (start < 0) {
- return FALSE;
- }
- return INT2FIX(start);
+ if (start >= 0) return INT2FIX(start);
+ return Qnil;
}
static VALUE