зеркало из https://github.com/github/ruby.git
* gc.c (define_final): eliminate rb_f_lambda() call.
* class.c (rb_scan_args): ditto. * signal.c (sig_trap): ditto. * hash.c (rb_hash_initialize): ditto. * variable.c (rb_f_trace_var): ditto. * ext/dl/dl.c (rb_dl_callback): ditto. * ext/win32ole/win32ole.c (ev_on_event): ditto. * eval.c (ruby_cleanup): $SAFE is turned off in the finalization. Each END proc should preserve its own $SAFE level. [ruby-core:01119] * marshal.c (marshal_load): remove unused variable "hash". [ruby-core:01120] * hash.c (env_str_new): freeze strings from ENV. [ruby-talk:72860] * array.c (rb_ary_first): optional argument to retrieve first n elements. * array.c (rb_ary_last): optional argument to retrieve last n elements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9e77e91a13
Коммит
bad7546f15
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
Fri Jun 6 18:33:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* gc.c (define_final): eliminate rb_f_lambda() call.
|
||||
|
||||
* class.c (rb_scan_args): ditto.
|
||||
|
||||
* signal.c (sig_trap): ditto.
|
||||
|
||||
* hash.c (rb_hash_initialize): ditto.
|
||||
|
||||
* variable.c (rb_f_trace_var): ditto.
|
||||
|
||||
* ext/dl/dl.c (rb_dl_callback): ditto.
|
||||
|
||||
* ext/win32ole/win32ole.c (ev_on_event): ditto.
|
||||
|
||||
Fri Jun 6 16:10:01 2003 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* lib/net/http.rb: define Net::HTTPResponse#to_ary for backward
|
||||
|
@ -5,10 +21,6 @@ Fri Jun 6 16:10:01 2003 Minero Aoki <aamine@loveruby.net>
|
|||
|
||||
* lib/net/protocol.rb: add warning.
|
||||
|
||||
Thu Jun 5 21:31:55 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
|
||||
|
||||
* wince/stdlib.c: add mblen().
|
||||
|
||||
Fri Jun 6 13:30:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (ruby_cleanup): $SAFE is turned off in the finalization.
|
||||
|
@ -25,6 +37,10 @@ Fri Jun 6 13:30:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
* array.c (rb_ary_last): optional argument to retrieve last n
|
||||
elements.
|
||||
|
||||
Thu Jun 5 21:31:55 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
|
||||
|
||||
* wince/stdlib.c: add mblen().
|
||||
|
||||
Thu Jun 5 18:33:46 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* ext/curses/curses.c (window_s_allocate,curses_finalize):
|
||||
|
|
2
class.c
2
class.c
|
@ -879,7 +879,7 @@ rb_scan_args(argc, argv, fmt, va_alist)
|
|||
if (*p == '&') {
|
||||
var = va_arg(vargs, VALUE*);
|
||||
if (rb_block_given_p()) {
|
||||
*var = rb_f_lambda();
|
||||
*var = rb_block_new();
|
||||
}
|
||||
else {
|
||||
*var = Qnil;
|
||||
|
|
11
eval.c
11
eval.c
|
@ -96,7 +96,6 @@ char *strrchr _((const char*,const char));
|
|||
VALUE rb_cBlock, rb_cProc;
|
||||
static VALUE rb_cBinding;
|
||||
static VALUE block_invoke _((VALUE,VALUE,VALUE,VALUE));
|
||||
static VALUE block_new _((void));
|
||||
static VALUE rb_f_binding _((VALUE));
|
||||
static void rb_f_END _((void));
|
||||
static VALUE rb_f_block_given_p _((void));
|
||||
|
@ -3223,7 +3222,7 @@ rb_eval(self, n)
|
|||
if (ruby_scope->local_vars == 0)
|
||||
rb_bug("unexpected block argument");
|
||||
if (rb_block_given_p()) {
|
||||
result = block_new();
|
||||
result = rb_block_new();
|
||||
ruby_scope->local_vars[node->nd_cnt] = result;
|
||||
}
|
||||
else {
|
||||
|
@ -6377,7 +6376,7 @@ rb_f_END()
|
|||
{
|
||||
PUSH_FRAME();
|
||||
ruby_frame->argc = 0;
|
||||
rb_set_end_proc(call_end_proc, rb_f_lambda());
|
||||
rb_set_end_proc(call_end_proc, rb_block_new());
|
||||
POP_FRAME();
|
||||
}
|
||||
|
||||
|
@ -6880,8 +6879,8 @@ block_s_new(argc, argv, klass)
|
|||
return block;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
block_new()
|
||||
VALUE
|
||||
rb_block_new()
|
||||
{
|
||||
if (ruby_block->flags & BLOCK_PROC) {
|
||||
return block_alloc(rb_cProc, Qtrue);
|
||||
|
@ -7504,7 +7503,7 @@ mblock(method)
|
|||
/* emulate ruby's method call */
|
||||
PUSH_ITER(ITER_CUR);
|
||||
PUSH_FRAME();
|
||||
proc = rb_f_lambda();
|
||||
proc = rb_block_new();
|
||||
POP_FRAME();
|
||||
POP_ITER();
|
||||
|
||||
|
|
|
@ -585,7 +585,7 @@ rb_dl_callback(int argc, VALUE argv[], VALUE self)
|
|||
switch (rb_scan_args(argc, argv, "11", &type, &proc)) {
|
||||
case 1:
|
||||
if (rb_block_given_p()) {
|
||||
proc = rb_f_lambda();
|
||||
proc = rb_block_new();
|
||||
}
|
||||
else{
|
||||
proc = Qnil;
|
||||
|
|
|
@ -5224,7 +5224,7 @@ ev_on_event(argc, argv, self, is_ary_arg)
|
|||
if(!NIL_P(event)) {
|
||||
Check_SafeStr(event);
|
||||
}
|
||||
data = rb_ary_new3(4, rb_f_lambda(), event, args, is_ary_arg);
|
||||
data = rb_ary_new3(4, rb_block_new(), event, args, is_ary_arg);
|
||||
add_event_call_back(self, data);
|
||||
return Qnil;
|
||||
}
|
||||
|
|
40
gc.c
40
gc.c
|
@ -1411,25 +1411,25 @@ os_each_obj(argc, argv)
|
|||
static VALUE finalizers;
|
||||
|
||||
static VALUE
|
||||
add_final(os, proc)
|
||||
VALUE os, proc;
|
||||
add_final(os, block)
|
||||
VALUE os, block;
|
||||
{
|
||||
rb_warn("ObjectSpace::add_finalizer is deprecated; use define_finalizer");
|
||||
if (!rb_obj_is_kind_of(proc, rb_cProc)) {
|
||||
rb_raise(rb_eArgError, "wrong type argument %s (Proc required)",
|
||||
rb_obj_classname(proc));
|
||||
if (!rb_obj_is_kind_of(block, rb_cBlock)) {
|
||||
rb_raise(rb_eArgError, "wrong type argument %s (Block required)",
|
||||
rb_obj_classname(block));
|
||||
}
|
||||
rb_ary_push(finalizers, proc);
|
||||
return proc;
|
||||
rb_ary_push(finalizers, block);
|
||||
return block;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rm_final(os, proc)
|
||||
VALUE os, proc;
|
||||
rm_final(os, block)
|
||||
VALUE os, block;
|
||||
{
|
||||
rb_warn("ObjectSpace::remove_finalizer is deprecated; use undefine_finalizer");
|
||||
rb_ary_delete(finalizers, proc);
|
||||
return proc;
|
||||
rb_ary_delete(finalizers, block);
|
||||
return block;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1465,15 +1465,15 @@ define_final(argc, argv, os)
|
|||
VALUE *argv;
|
||||
VALUE os;
|
||||
{
|
||||
VALUE obj, proc, table;
|
||||
VALUE obj, block, table;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &obj, &proc);
|
||||
rb_scan_args(argc, argv, "11", &obj, &block);
|
||||
if (argc == 1) {
|
||||
proc = rb_f_lambda();
|
||||
block = rb_block_new();
|
||||
}
|
||||
else if (!rb_obj_is_kind_of(proc, rb_cProc)) {
|
||||
rb_raise(rb_eArgError, "wrong type argument %s (Proc required)",
|
||||
rb_obj_classname(proc));
|
||||
else if (!rb_obj_is_kind_of(block, rb_cBlock)) {
|
||||
rb_raise(rb_eArgError, "wrong type argument %s (Block required)",
|
||||
rb_obj_classname(block));
|
||||
}
|
||||
need_call_final = 1;
|
||||
FL_SET(obj, FL_FINALIZE);
|
||||
|
@ -1482,12 +1482,12 @@ define_final(argc, argv, os)
|
|||
finalizer_table = st_init_numtable();
|
||||
}
|
||||
if (st_lookup(finalizer_table, obj, &table)) {
|
||||
rb_ary_push(table, proc);
|
||||
rb_ary_push(table, block);
|
||||
}
|
||||
else {
|
||||
st_add_direct(finalizer_table, obj, rb_ary_new3(1, proc));
|
||||
st_add_direct(finalizer_table, obj, rb_ary_new3(1, block));
|
||||
}
|
||||
return proc;
|
||||
return block;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
2
hash.c
2
hash.c
|
@ -209,7 +209,7 @@ rb_hash_initialize(argc, argv, hash)
|
|||
if (argc > 0) {
|
||||
rb_raise(rb_eArgError, "wrong number of arguments");
|
||||
}
|
||||
RHASH(hash)->ifnone = rb_f_lambda();
|
||||
RHASH(hash)->ifnone = rb_block_new();
|
||||
FL_SET(hash, HASH_PROC_DEFAULT);
|
||||
}
|
||||
else {
|
||||
|
|
1
intern.h
1
intern.h
|
@ -176,6 +176,7 @@ void rb_provide _((const char*));
|
|||
VALUE rb_f_require _((VALUE, VALUE));
|
||||
void rb_obj_call_init _((VALUE, int, VALUE*));
|
||||
VALUE rb_class_new_instance _((int, VALUE*, VALUE));
|
||||
VALUE rb_block_new _((void));
|
||||
VALUE rb_f_lambda _((void));
|
||||
VALUE rb_proc_new _((VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE));
|
||||
VALUE rb_protect _((VALUE (*)(VALUE), VALUE, int*));
|
||||
|
|
1
ruby.h
1
ruby.h
|
@ -575,6 +575,7 @@ RUBY_EXTERN VALUE rb_cIO;
|
|||
RUBY_EXTERN VALUE rb_cModule;
|
||||
RUBY_EXTERN VALUE rb_cNilClass;
|
||||
RUBY_EXTERN VALUE rb_cNumeric;
|
||||
RUBY_EXTERN VALUE rb_cBlock;
|
||||
RUBY_EXTERN VALUE rb_cProc;
|
||||
RUBY_EXTERN VALUE rb_cRange;
|
||||
RUBY_EXTERN VALUE rb_cRegexp;
|
||||
|
|
2
signal.c
2
signal.c
|
@ -650,7 +650,7 @@ sig_trap(argc, argv)
|
|||
|
||||
arg.sig = argv[0];
|
||||
if (argc == 1) {
|
||||
arg.cmd = rb_f_lambda();
|
||||
arg.cmd = rb_block_new();
|
||||
}
|
||||
else if (argc == 2) {
|
||||
arg.cmd = argv[1];
|
||||
|
|
|
@ -540,7 +540,7 @@ rb_f_trace_var(argc, argv)
|
|||
|
||||
rb_secure(4);
|
||||
if (rb_scan_args(argc, argv, "11", &var, &cmd) == 1) {
|
||||
cmd = rb_f_lambda();
|
||||
cmd = rb_block_new();
|
||||
}
|
||||
if (NIL_P(cmd)) {
|
||||
return rb_f_untrace_var(argc, argv);
|
||||
|
|
Загрузка…
Ссылка в новой задаче