summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-08 06:48:34 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-08 06:48:34 +0000
commitea2dd2e805fbaf1f5ee491397db9a16eb1d4dbe3 (patch)
treebdf638f9cb52fc497e5b39a639a639bc3712f12e
parent9c574383a430c815406fb343e9adba18e348b5a3 (diff)
* process.c: fix to use rb_status_line_set/get/clear().
* eval_intern.h: fix line break. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--eval_intern.h2
-rw-r--r--process.c30
3 files changed, 26 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 62ea4dcff1..368dc555ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Feb 8 15:43:05 2007 Koichi Sasada <ko1@atdot.net>
+
+ * process.c: fix to use rb_status_line_set/get/clear().
+
+ * eval_intern.h: fix line break.
+
Thu Feb 8 15:00:14 2007 Koichi Sasada <ko1@atdot.net>
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
diff --git a/eval_intern.h b/eval_intern.h
index 5c811d9639..33386a0eab 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -183,10 +183,10 @@ char *strrchr _((const char *, const char));
{ \
ruby_cref()->nd_visi = (f); \
}
+
extern VALUE exception_error;
extern VALUE sysstack_error;
-
void rb_thread_cleanup _((void));
void rb_thread_wait_other_threads _((void));
diff --git a/process.c b/process.c
index f87041e3a2..6d6024cb66 100644
--- a/process.c
+++ b/process.c
@@ -197,6 +197,12 @@ get_ppid(void)
static VALUE rb_cProcStatus;
+VALUE
+rb_last_status_get(void)
+{
+ return GET_VM()->last_status;
+}
+
void
rb_last_status_set(int status, rb_pid_t pid)
{
@@ -206,10 +212,11 @@ rb_last_status_set(int status, rb_pid_t pid)
rb_iv_set(vm->last_status, "pid", INT2FIX(pid));
}
-VALUE
-rb_last_status_get(void)
+static void
+rb_last_status_clear(void)
{
- return GET_VM()->last_status;
+ rb_vm_t *vm = GET_VM();
+ vm->last_status = Qnil;
}
/*
@@ -643,7 +650,7 @@ static int
waitall_each(int pid, int status, VALUE ary)
{
rb_last_status_set(status, pid);
- rb_ary_push(ary, rb_assoc_new(INT2NUM(pid), GET_VM()->last_status));
+ rb_ary_push(ary, rb_assoc_new(INT2NUM(pid), rb_last_status_get());
return ST_DELETE;
}
#endif
@@ -728,7 +735,8 @@ proc_wait(int argc, VALUE *argv)
if ((pid = rb_waitpid(pid, &status, flags)) < 0)
rb_sys_fail(0);
if (pid == 0) {
- return GET_VM()->last_status = Qnil;
+ rb_last_status_clear();
+ return Qnil;
}
return INT2FIX(pid);
}
@@ -756,7 +764,7 @@ proc_wait2(int argc, VALUE *argv)
{
VALUE pid = proc_wait(argc, argv);
if (NIL_P(pid)) return Qnil;
- return rb_assoc_new(pid, GET_VM()->last_status);
+ return rb_assoc_new(pid, rb_last_status_get());
}
@@ -805,10 +813,10 @@ proc_waitall(void)
rb_sys_fail(0);
}
rb_last_status_set(status, pid);
- rb_ary_push(result, rb_assoc_new(INT2NUM(pid), GET_VM()->last_status));
+ rb_ary_push(result, rb_assoc_new(INT2NUM(pid), rb_last_status_get()));
}
#else
- GET_VM()->last_status = Qnil;
+ rb_last_status_clear();
for (pid = -1;;) {
pid = rb_waitpid(-1, &status, 0);
if (pid == -1) {
@@ -816,7 +824,7 @@ proc_waitall(void)
break;
rb_sys_fail(0);
}
- rb_ary_push(result, rb_assoc_new(INT2NUM(pid), GET_VM()->last_status));
+ rb_ary_push(result, rb_assoc_new(INT2NUM(pid), rb_last_status_get()));
}
#endif
return result;
@@ -829,7 +837,7 @@ detach_process_watcher(int *pid_p)
for (;;) {
cpid = rb_waitpid(*pid_p, &status, WNOHANG);
- if (cpid != 0) return GET_VM()->last_status;
+ if (cpid != 0) return rb_last_status_get();
rb_thread_sleep(1);
}
}
@@ -1610,7 +1618,7 @@ rb_f_system(int argc, VALUE *argv)
if (status < 0) {
rb_sys_fail(RSTRING_PTR(argv[0]));
}
- status = NUM2INT(GET_VM()->last_status);
+ status = NUM2INT(rb_last_status_get());
if (status == EXIT_SUCCESS) return Qtrue;
return Qfalse;
}