summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-07 06:54:40 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-07 06:54:40 +0000
commitb97aa9b90e0156923c138a22b9b1ce3dacd6e2f7 (patch)
treed59772230dd2034045c9a8fb7aa06a2f9c1e4549 /string.c
parent03e766f2c33913cd13953ddc5e17785fe5a402b9 (diff)
* string.c (rb_str_match): raise TypeError when both arguments are
strings. [ruby-dev:22869] (backported from HEAD) * string.c (rb_str_match2): removed. * Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub (string.c): now not depend on version.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/string.c b/string.c
index d8a4748..e2dc44e 100644
--- a/string.c
+++ b/string.c
@@ -14,7 +14,6 @@
#include "ruby.h"
#include "re.h"
-#include "version.h"
#define BEG(no) regs->beg[no]
#define END(no) regs->end[no]
@@ -1248,11 +1247,8 @@ rb_str_match(x, y)
switch (TYPE(y)) {
case T_STRING:
-#if RUBY_VERSION_CODE < 182
- rb_warn("string =~ string will be obsolete; use explicit regexp");
-#endif
- y = rb_reg_regcomp(y);
- /* fall through */
+ rb_raise(rb_eTypeError, "type mismatch: String given");
+
case T_REGEXP:
return rb_reg_match(y, x);
@@ -1262,24 +1258,6 @@ rb_str_match(x, y)
}
-/*
- * call-seq:
- * ~str => fixnum or nil
- *
- * Equivalent to <code>$_</code><code>=~ <i>str</i></code>.
- */
-
-static VALUE
-rb_str_match2(str)
- VALUE str;
-{
- StringValue(str);
-#if RUBY_VERSION_CODE < 182
- rb_warn("~string will be obsolete; use explicit regexp");
-#endif
- return rb_reg_match2(rb_reg_regcomp(rb_reg_quote(str)));
-}
-
static VALUE get_pat _((VALUE, int));
@@ -4594,7 +4572,6 @@ Init_String()
rb_define_method(rb_cString, "size", rb_str_length, 0);
rb_define_method(rb_cString, "empty?", rb_str_empty, 0);
rb_define_method(rb_cString, "=~", rb_str_match, 1);
- rb_define_method(rb_cString, "~", rb_str_match2, 0);
rb_define_method(rb_cString, "match", rb_str_match_m, 1);
rb_define_method(rb_cString, "succ", rb_str_succ, 0);
rb_define_method(rb_cString, "succ!", rb_str_succ_bang, 0);