summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-22 08:09:58 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-22 08:09:58 +0000
commit7ff7bcbf9dbb0f22a9802a7b3474c59c9bbd0b70 (patch)
treefa6ca2b3d705a9ea9ea67442b20c2e432dc647d6 /eval.c
parent7cca6c25f0682053b861fa987fa5b415346d044f (diff)
* enum.c (inject_i): use rb_yield_values.
* enum.c (each_with_index_i): ditto. * eval.c (rb_yield_splat): new function to call "yield *values". * string.c (rb_str_scan): use rb_yield_splat(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index 6612bacb93..a82d2941c9 100644
--- a/eval.c
+++ b/eval.c
@@ -4230,7 +4230,7 @@ VALUE
#ifdef HAVE_STDARG_PROTOTYPES
rb_yield_values(int n, ...)
#else
-rb_yield_values(int n, va_alist)
+rb_yield_values(n, va_alist)
int n;
va_dcl
#endif
@@ -4250,6 +4250,16 @@ rb_yield_values(int n, va_alist)
return rb_yield_0(ary, 0, 0, Qfalse, Qtrue);
}
+VALUE
+rb_yield_splat(values)
+ VALUE values;
+{
+ if (RARRAY(value)->len == 0) {
+ return rb_yield_0(Qundef, 0, 0, Qfalse, Qfalse);
+ }
+ return rb_yield_0(values, 0, 0, Qfalse, Qtrue);
+}
+
static VALUE
rb_f_loop()
{
@@ -9375,7 +9385,7 @@ rb_thread_start_0(fn, arg, th_arg)
{
volatile rb_thread_t th = th_arg;
volatile VALUE thread = th->thread;
- struct BLOCK* saved_block = 0;
+ volatile struct BLOCK* saved_block = 0;
enum thread_status status;
int state;
@@ -9434,12 +9444,12 @@ rb_thread_start_0(fn, arg, th_arg)
rb_thread_remove(th);
while (saved_block) {
- struct BLOCK *tmp = saved_block;
+ volatile struct BLOCK *tmp = saved_block;
if (tmp->frame.argc > 0)
free(tmp->frame.argv);
saved_block = tmp->prev;
- free(tmp);
+ free((void*)tmp);
}
if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {