1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (read_all): fptr->f may be NULL, if IO is closed in the

signal handler.

* io.c (io_read): ditto.

* string.c (get_pat): remove 1.8.0 warning code.

* string.c (rb_str_match): extend warning until 1.8.2.

* string.c (rb_str_match2): ditto.

* class.c (class_instance_method_list): remove 1.8.0 warnings.
  method_list now recurs.  [ruby-dev:21816]

* class.c (rb_obj_singleton_methods): ditto.

* array.c (rb_ary_select): remove select with block.
  [ruby-dev:21824]

* hash.c (rb_hash_select): ditto.

* hash.c (env_select): ditto.

* re.c (match_select): ditto.

* struct.c (rb_struct_select): ditto.

* process.c (check_uid_switch): remove duplicated error messages.

* process.c (check_gid_switch): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-11-04 09:13:57 +00:00
parent 89d1dff343
commit a4934a42cb
13 changed files with 92 additions and 151 deletions

View file

@ -1,3 +1,32 @@
Tue Nov 4 06:54:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (read_all): fptr->f may be NULL, if IO is closed in the
signal handler.
* io.c (io_read): ditto.
* string.c (get_pat): remove 1.8.0 warning code.
* string.c (rb_str_match): extend warning until 1.8.2.
* string.c (rb_str_match2): ditto.
* class.c (class_instance_method_list): remove 1.8.0 warnings.
method_list now recurs. [ruby-dev:21816]
* class.c (rb_obj_singleton_methods): ditto.
* array.c (rb_ary_select): remove select with block.
[ruby-dev:21824]
* hash.c (rb_hash_select): ditto.
* hash.c (env_select): ditto.
* re.c (match_select): ditto.
* struct.c (rb_struct_select): ditto.
Mon Nov 3 22:53:21 2003 Minero Aoki <aamine@loveruby.net> Mon Nov 3 22:53:21 2003 Minero Aoki <aamine@loveruby.net>
* lib/racc/parser.rb: synchronize with Racc 1.4.4. * lib/racc/parser.rb: synchronize with Racc 1.4.4.
@ -7,6 +36,12 @@ Mon Nov 3 22:53:21 2003 Minero Aoki <aamine@loveruby.net>
* ext/racc/cparse/cparse.c (parse_main): should abort when * ext/racc/cparse/cparse.c (parse_main): should abort when
the length of LR state stack <=1, not ==0. the length of LR state stack <=1, not ==0.
Mon Nov 3 08:50:47 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* process.c (check_uid_switch): remove duplicated error messages.
* process.c (check_gid_switch): ditto.
Sun Nov 2 02:28:33 2003 GOTOU Yuuzou <gotoyuzo@notwork.org> Sun Nov 2 02:28:33 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/ssl.rb: new option :SSLExtraChainCert. * lib/webrick/ssl.rb: new option :SSLExtraChainCert.

View file

@ -342,6 +342,7 @@ lib/test/unit/ui/fox/testrunner.rb
lib/test/unit/ui/gtk/testrunner.rb lib/test/unit/ui/gtk/testrunner.rb
lib/test/unit/ui/testrunnermediator.rb lib/test/unit/ui/testrunnermediator.rb
lib/test/unit/ui/testrunnerutilities.rb lib/test/unit/ui/testrunnerutilities.rb
lib/test/unit/ui/tk/testrunner.rb
lib/test/unit/util/backtracefilter.rb lib/test/unit/util/backtracefilter.rb
lib/test/unit/util/observable.rb lib/test/unit/util/observable.rb
lib/test/unit/util/procwrapper.rb lib/test/unit/util/procwrapper.rb

11
array.c
View file

@ -254,8 +254,8 @@ rb_ary_initialize(argc, argv, ary)
if (rb_block_given_p()) { if (rb_block_given_p()) {
long i; long i;
if (argc > 1) { if (argc == 2) {
rb_raise(rb_eArgError, "wrong number of arguments"); rb_warn("block supersedes default value argument");
} }
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
RARRAY(ary)->ptr[i] = rb_yield(LONG2NUM(i)); RARRAY(ary)->ptr[i] = rb_yield(LONG2NUM(i));
@ -655,8 +655,7 @@ rb_ary_indexes(argc, argv, ary)
VALUE new_ary; VALUE new_ary;
long i; long i;
rb_warn("Array#%s is deprecated; use Array#values_at", rb_warn("Array#%s is deprecated; use Array#values_at", rb_id2name(rb_frame_last_func()));
rb_id2name(rb_frame_last_func()));
new_ary = rb_ary_new2(argc); new_ary = rb_ary_new2(argc);
for (i=0; i<argc; i++) { for (i=0; i<argc; i++) {
rb_ary_push(new_ary, rb_ary_aref(1, argv+i, ary)); rb_ary_push(new_ary, rb_ary_aref(1, argv+i, ary));
@ -1270,10 +1269,6 @@ rb_ary_select(argc, argv, ary)
VALUE result; VALUE result;
long i; long i;
if (!rb_block_given_p()) {
rb_warn("Array#select(index..) is deprecated; use Array#values_at");
return rb_ary_values_at(argc, argv, ary);
}
if (argc > 0) { if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments (%d for 0)", argc); rb_raise(rb_eArgError, "wrong number arguments (%d for 0)", argc);
} }

View file

@ -539,12 +539,7 @@ class_instance_method_list(argc, argv, mod, func)
st_table *list; st_table *list;
if (argc == 0) { if (argc == 0) {
#if RUBY_VERSION_CODE < 181
rb_warn("%s: parameter will default to 'true' as of 1.8.1", rb_id2name(rb_frame_last_func()));
recur = Qfalse;
#else
recur = Qtrue; recur = Qtrue;
#endif
} }
else { else {
VALUE r; VALUE r;
@ -613,11 +608,7 @@ rb_obj_singleton_methods(argc, argv, obj)
rb_scan_args(argc, argv, "01", &recur); rb_scan_args(argc, argv, "01", &recur);
if (argc == 0) { if (argc == 0) {
#if RUBY_VERSION_CODE < 181
rb_warn("singleton_methods: parameter will default to 'true' as of 1.8.1");
#else
recur = Qtrue; recur = Qtrue;
#endif
} }
klass = CLASS_OF(obj); klass = CLASS_OF(obj);
list = st_init_numtable(); list = st_init_numtable();

View file

@ -480,6 +480,7 @@ name_err_initialize(argc, argv, self)
VALUE self; VALUE self;
{ {
VALUE name = (argc > 1) ? argv[--argc] : Qnil; VALUE name = (argc > 1) ? argv[--argc] : Qnil;
exc_initialize(argc, argv, self); exc_initialize(argc, argv, self);
rb_iv_set(self, "name", name); rb_iv_set(self, "name", name);
return self; return self;

1
eval.c
View file

@ -4727,7 +4727,6 @@ rb_method_missing(argc, argv, obj)
id = SYM2ID(argv[0]); id = SYM2ID(argv[0]);
switch (TYPE(obj)) { switch (TYPE(obj)) {
case T_NIL: case T_NIL:
desc = "nil"; desc = "nil";

2
file.c
View file

@ -99,7 +99,7 @@ rb_file_path(obj)
fptr = RFILE(rb_io_taint_check(obj))->fptr; fptr = RFILE(rb_io_taint_check(obj))->fptr;
if (!fptr->path) return Qnil; if (!fptr->path) return Qnil;
return rb_str_new2(fptr->path); return rb_tainted_str_new2(fptr->path);
} }
static VALUE static VALUE

10
hash.c
View file

@ -529,12 +529,6 @@ rb_hash_select(argc, argv, hash)
{ {
VALUE result; VALUE result;
if (!rb_block_given_p()) {
#if RUBY_VERSION_CODE < 181
rb_warn("Hash#select(key..) is deprecated; use Hash#values_at");
#endif
return rb_hash_values_at(argc, argv, hash);
}
if (argc > 0) { if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc); rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
} }
@ -1454,10 +1448,6 @@ env_select(argc, argv)
VALUE result; VALUE result;
char **env; char **env;
if (!rb_block_given_p()) {
rb_warn("ENV.select(index..) is deprecated; use ENV.values_at");
return env_values_at(argc, argv);
}
if (argc > 0) { if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc); rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
} }

2
io.c
View file

@ -790,6 +790,7 @@ read_all(fptr, siz, str)
n = rb_io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f); n = rb_io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f);
if (pos > 0 && n == 0 && bytes == 0) { if (pos > 0 && n == 0 && bytes == 0) {
rb_str_resize(str,0); rb_str_resize(str,0);
if (!fptr->f) return Qnil;
if (feof(fptr->f)) return Qnil; if (feof(fptr->f)) return Qnil;
if (!ferror(fptr->f)) return str; if (!ferror(fptr->f)) return str;
rb_sys_fail(fptr->path); rb_sys_fail(fptr->path);
@ -843,6 +844,7 @@ io_read(argc, argv, io)
n = rb_io_fread(RSTRING(str)->ptr, len, fptr->f); n = rb_io_fread(RSTRING(str)->ptr, len, fptr->f);
if (n == 0) { if (n == 0) {
rb_str_resize(str,0); rb_str_resize(str,0);
if (!fptr->f) return Qnil;
if (feof(fptr->f)) return Qnil; if (feof(fptr->f)) return Qnil;
if (len > 0) rb_sys_fail(fptr->path); if (len > 0) rb_sys_fail(fptr->path);
} }

138
process.c
View file

@ -1238,17 +1238,31 @@ proc_setpriority(obj, which, who, prio)
} }
static int under_uid_switch = 0; static int under_uid_switch = 0;
static void
check_uid_switch()
{
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
}
static int under_gid_switch = 0; static int under_gid_switch = 0;
static void
check_gid_switch()
{
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::UID.switch method");
}
}
static VALUE static VALUE
p_sys_setuid(obj, id) p_sys_setuid(obj, id)
VALUE obj, id; VALUE obj, id;
{ {
#if defined HAVE_SETUID #if defined HAVE_SETUID
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
if (setuid(NUM2INT(id)) != 0) rb_sys_fail(0); if (setuid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1261,10 +1275,7 @@ p_sys_setruid(obj, id)
VALUE obj, id; VALUE obj, id;
{ {
#if defined HAVE_SETRUID #if defined HAVE_SETRUID
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
if (setruid(NUM2INT(id)) != 0) rb_sys_fail(0); if (setruid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1277,10 +1288,7 @@ p_sys_seteuid(obj, id)
VALUE obj, id; VALUE obj, id;
{ {
#if defined HAVE_SETEUID #if defined HAVE_SETEUID
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
if (seteuid(NUM2INT(id)) != 0) rb_sys_fail(0); if (seteuid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1293,10 +1301,7 @@ p_sys_setreuid(obj, rid, eid)
VALUE obj, rid, eid; VALUE obj, rid, eid;
{ {
#if defined HAVE_SETREUID #if defined HAVE_SETREUID
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
if (setreuid(NUM2INT(rid),NUM2INT(eid)) != 0) rb_sys_fail(0); if (setreuid(NUM2INT(rid),NUM2INT(eid)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1309,10 +1314,7 @@ p_sys_setresuid(obj, rid, eid, sid)
VALUE obj, rid, eid, sid; VALUE obj, rid, eid, sid;
{ {
#if defined HAVE_SETRESUID #if defined HAVE_SETRESUID
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
if (setresuid(NUM2INT(rid),NUM2INT(eid),NUM2INT(sid)) != 0) rb_sys_fail(0); if (setresuid(NUM2INT(rid),NUM2INT(eid),NUM2INT(sid)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1334,10 +1336,7 @@ proc_setuid(obj, id)
{ {
int uid = NUM2INT(id); int uid = NUM2INT(id);
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
#if defined(HAVE_SETRESUID) && !defined(__CHECKER__) #if defined(HAVE_SETRESUID) && !defined(__CHECKER__)
if (setresuid(uid, -1, -1) < 0) rb_sys_fail(0); if (setresuid(uid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREUID #elif defined HAVE_SETREUID
@ -1368,10 +1367,7 @@ p_uid_change_privilege(obj, id)
extern int errno; extern int errno;
int uid; int uid;
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
uid = NUM2INT(id); uid = NUM2INT(id);
@ -1509,10 +1505,7 @@ p_sys_setgid(obj, id)
VALUE obj, id; VALUE obj, id;
{ {
#if defined HAVE_SETGID #if defined HAVE_SETGID
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
if (setgid(NUM2INT(id)) != 0) rb_sys_fail(0); if (setgid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1525,10 +1518,7 @@ p_sys_setrgid(obj, id)
VALUE obj, id; VALUE obj, id;
{ {
#if defined HAVE_SETRGID #if defined HAVE_SETRGID
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
if (setrgid(NUM2INT(id)) != 0) rb_sys_fail(0); if (setrgid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1541,10 +1531,7 @@ p_sys_setegid(obj, id)
VALUE obj, id; VALUE obj, id;
{ {
#if defined HAVE_SETEGID #if defined HAVE_SETEGID
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
if (setegid(NUM2INT(id)) != 0) rb_sys_fail(0); if (setegid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1557,10 +1544,7 @@ p_sys_setregid(obj, rid, eid)
VALUE obj, rid, eid; VALUE obj, rid, eid;
{ {
#if defined HAVE_SETREGID #if defined HAVE_SETREGID
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
if (setregid(NUM2INT(rid),NUM2INT(eid)) != 0) rb_sys_fail(0); if (setregid(NUM2INT(rid),NUM2INT(eid)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1573,10 +1557,7 @@ p_sys_setresgid(obj, rid, eid, sid)
VALUE obj, rid, eid, sid; VALUE obj, rid, eid, sid;
{ {
#if defined HAVE_SETRESGID #if defined HAVE_SETRESGID
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
if (setresgid(NUM2INT(rid),NUM2INT(eid),NUM2INT(sid)) != 0) rb_sys_fail(0); if (setresgid(NUM2INT(rid),NUM2INT(eid),NUM2INT(sid)) != 0) rb_sys_fail(0);
#else #else
rb_notimplement(); rb_notimplement();
@ -1614,10 +1595,7 @@ proc_setgid(obj, id)
{ {
int gid = NUM2INT(id); int gid = NUM2INT(id);
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
#if defined(HAVE_SETRESGID) && !defined(__CHECKER__) #if defined(HAVE_SETRESGID) && !defined(__CHECKER__)
if (setresgid(gid, -1, -1) < 0) rb_sys_fail(0); if (setresgid(gid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID #elif defined HAVE_SETREGID
@ -1763,10 +1741,7 @@ p_gid_change_privilege(obj, id)
extern int errno; extern int errno;
int gid; int gid;
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
gid = NUM2INT(id); gid = NUM2INT(id);
@ -1912,10 +1887,7 @@ static VALUE
proc_seteuid(obj, euid) proc_seteuid(obj, euid)
VALUE obj, euid; VALUE obj, euid;
{ {
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
#if defined(HAVE_SETRESUID) && !defined(__CHECKER__) #if defined(HAVE_SETRESUID) && !defined(__CHECKER__)
if (setresuid(-1, NUM2INT(euid), -1) < 0) rb_sys_fail(0); if (setresuid(-1, NUM2INT(euid), -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREUID #elif defined HAVE_SETREUID
@ -1942,10 +1914,7 @@ rb_seteuid_core(euid)
{ {
int uid; int uid;
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
uid = getuid(); uid = getuid();
@ -1994,10 +1963,8 @@ static VALUE
proc_setegid(obj, egid) proc_setegid(obj, egid)
VALUE obj, egid; VALUE obj, egid;
{ {
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
#if defined(HAVE_SETRESGID) && !defined(__CHECKER__) #if defined(HAVE_SETRESGID) && !defined(__CHECKER__)
if (setresgid(-1, NUM2INT(egid), -1) < 0) rb_sys_fail(0); if (setresgid(-1, NUM2INT(egid), -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID #elif defined HAVE_SETREGID
@ -2024,10 +1991,7 @@ rb_setegid_core(egid)
{ {
int gid; int gid;
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
gid = getgid(); gid = getgid();
@ -2081,10 +2045,7 @@ p_uid_exchange(obj)
{ {
int uid, euid; int uid, euid;
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
uid = getuid(); uid = getuid();
euid = geteuid(); euid = geteuid();
@ -2119,10 +2080,7 @@ p_gid_exchange(obj)
{ {
int gid, egid; int gid, egid;
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
gid = getgid(); gid = getgid();
egid = getegid(); egid = getegid();
@ -2166,10 +2124,7 @@ p_uid_switch(obj)
extern int errno; extern int errno;
int uid, euid; int uid, euid;
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
uid = getuid(); uid = getuid();
euid = geteuid(); euid = geteuid();
@ -2211,10 +2166,7 @@ p_uid_switch(obj)
extern int errno; extern int errno;
int uid, euid; int uid, euid;
rb_secure(2); check_uid_switch();
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
uid = getuid(); uid = getuid();
euid = geteuid(); euid = geteuid();
@ -2259,10 +2211,7 @@ p_gid_switch(obj)
extern int errno; extern int errno;
int gid, egid; int gid, egid;
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
gid = getgid(); gid = getgid();
egid = getegid(); egid = getegid();
@ -2303,10 +2252,7 @@ p_gid_switch(obj)
extern int errno; extern int errno;
int gid, egid; int gid, egid;
rb_secure(2); check_gid_switch();
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
gid = getgid(); gid = getgid();
egid = getegid(); egid = getegid();

4
re.c
View file

@ -992,10 +992,6 @@ match_select(argc, argv, match)
VALUE *argv; VALUE *argv;
VALUE match; VALUE match;
{ {
if (!rb_block_given_p()) {
rb_warn("MatchData#select(index..) is deprecated; use MatchData#values_at");
return match_values_at(argc, argv, match);
}
if (argc > 0) { if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc); rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
} }

View file

@ -1056,19 +1056,14 @@ rb_str_match(x, y)
long start; long start;
switch (TYPE(y)) { switch (TYPE(y)) {
case T_REGEXP:
return rb_reg_match(y, x);
case T_STRING: case T_STRING:
#if RUBY_VERSION_CODE < 181 #if RUBY_VERSION_CODE < 182
rb_warn("string =~ string will be obsolete; use explicit regexp"); rb_warn("string =~ string will be obsolete; use explicit regexp");
#endif #endif
reg = rb_reg_regcomp(y); y = rb_reg_regcomp(y);
start = rb_reg_search(reg, x, 0, 0); /* fall through */
if (start == -1) { case T_REGEXP:
return Qnil; return rb_reg_match(y, x);
}
return INT2NUM(start);
default: default:
return rb_funcall(y, rb_intern("=~"), 1, x); return rb_funcall(y, rb_intern("=~"), 1, x);
@ -1080,7 +1075,7 @@ rb_str_match2(str)
VALUE str; VALUE str;
{ {
StringValue(str); StringValue(str);
#if RUBY_VERSION_CODE < 181 #if RUBY_VERSION_CODE < 182
rb_warn("~string will be obsolete; use explicit regexp"); rb_warn("~string will be obsolete; use explicit regexp");
#endif #endif
return rb_reg_match2(rb_reg_regcomp(rb_reg_quote(str))); return rb_reg_match2(rb_reg_regcomp(rb_reg_quote(str)));
@ -1501,13 +1496,7 @@ get_pat(pat, quote)
} }
if (quote) { if (quote) {
val = rb_reg_quote(pat); pat = rb_reg_quote(pat);
#if RUBY_VERSION_CODE < 181
if (val != pat && rb_str_cmp(val, pat) != 0) {
rb_warn("string pattern instead of regexp; metacharacters no longer effective");
}
#endif
pat = val;
} }
return rb_reg_regcomp(pat); return rb_reg_regcomp(pat);

View file

@ -544,10 +544,6 @@ rb_struct_select(argc, argv, s)
VALUE result; VALUE result;
long i; long i;
if (!rb_block_given_p()) {
rb_warn("Struct#select(index..) is deprecated; use Struct#values_at");
return rb_struct_values_at(argc, argv, s);
}
if (argc > 0) { if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc); rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
} }