summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-11-09 09:11:52 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-11-09 09:11:52 +0000
commitee5ab9cc136baf18756abc6bd5d136a0231f973e (patch)
treeabdc351cbffd7b67f63f41ea08f544819af0a28b /re.c
parentdc8da69e7cbc54f020ef1182fd28e57bbaa40fc3 (diff)
1.1c7
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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