summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog24
-rw-r--r--class.c2
-rw-r--r--eval.c11
-rw-r--r--ext/dl/dl.c2
-rw-r--r--ext/win32ole/win32ole.c2
-rw-r--r--gc.c40
-rw-r--r--hash.c2
-rw-r--r--intern.h1
-rw-r--r--ruby.h1
-rw-r--r--signal.c2
-rw-r--r--variable.c2
11 files changed, 53 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index ea243a0cffa..f96cd29481a 100644
--- a/ChangeLog
+++ b/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):
diff --git a/class.c b/class.c
index b690cb0a734..2c802f819c9 100644
--- a/class.c
+++ b/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;
diff --git a/eval.c b/eval.c
index 7a8d1d5ea99..13c9dcb86bc 100644
--- a/eval.c
+++ b/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();
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
index 95bc780e074..7a639ac77a6 100644
--- a/ext/dl/dl.c
+++ b/ext/dl/dl.c
@@ -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;
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 6e0d3ddc3c0..ecffa485ea2 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -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;
}
diff --git a/gc.c b/gc.c
index cc1e93bef8d..01f59dac945 100644
--- a/gc.c
+++ b/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
diff --git a/hash.c b/hash.c
index 6207bacdb87..26a4fe5ace0 100644
--- a/hash.c
+++ b/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 {
diff --git a/intern.h b/intern.h
index 53c8673d71f..a93f5e61cf2 100644
--- a/intern.h
+++ b/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*));
diff --git a/ruby.h b/ruby.h
index 76ea5d8b7c8..ae8a661f54f 100644
--- a/ruby.h
+++ b/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;
diff --git a/signal.c b/signal.c
index 9815bd4bcdd..719fb4cb9ff 100644
--- a/signal.c
+++ b/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];
diff --git a/variable.c b/variable.c
index 11a931fa39b..3d558829543 100644
--- a/variable.c
+++ b/variable.c
@@ -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);