summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-25 08:22:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-25 08:22:11 +0000
commitf547c1150cf0cb9fe2477e6aeb4ff7b724fc44c7 (patch)
treebdf1c6377a12f1405ac48b2819ac59fbeb4c12a5 /eval.c
parenteb9708f38671aa6446a89acc755f3341f5cb59b6 (diff)
* class.c (rb_include_module): detect cyclic module inclusion.
* eval.c (rb_thread_cleanup): need not to free thread stacks at process termination. * array.c (rb_ary_fetch): use the block to get the default value if the block is given. * eval.c (rb_thread_schedule): should check time only if BOTH WAIT_SELECT and WAIT_TIME. * eval.c (umethod_bind): should update rklass field. * hash.c (rb_hash_update): if a block is given, yields [key, value1, value2] to the block to resolve conflict. * string.c (rb_str_split_m): no need to consider KANJI characters, if the length of separator is 1 (byte). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index 13f656cdc6..cd0e719461 100644
--- a/eval.c
+++ b/eval.c
@@ -166,7 +166,7 @@ print_undef(klass, id)
{
rb_name_error(id, "undefined method `%s' for %s `%s'",
rb_id2name(id),
- (TYPE(klass) == T_MODULE)?"module":"class",
+ (TYPE(klass) == T_MODULE) ? "module" : "class",
rb_class2name(klass));
}
@@ -4262,8 +4262,8 @@ rb_f_missing(argc, argv, obj)
char buf[BUFSIZ];
snprintf(buf, BUFSIZ, format, rb_id2name(id),
- desc, desc[0]=='#'?"":":",
- desc[0]=='#'?"":rb_class2name(CLASS_OF(obj)));
+ desc, desc[0]=='#' ? "" : ":",
+ desc[0]=='#' ? "" : rb_class2name(CLASS_OF(obj)));
exc = rb_exc_new2(exc, buf);
rb_iv_set(exc, "name", argv[0]);
rb_iv_set(exc, "args", rb_ary_new4(argc-1, argv+1));
@@ -6866,6 +6866,7 @@ umethod_bind(method, recv)
method = Data_Make_Struct(rb_cMethod,struct METHOD,bm_mark,free,bound);
*bound = *data;
bound->recv = recv;
+ bound->rklass = CLASS_OF(recv);
return method;
}
@@ -7319,7 +7320,7 @@ static rb_thread_t
rb_thread_check(data)
VALUE data;
{
- if (TYPE(data) != T_DATA || RDATA(data)->dfree != (RUBY_DATA_FUNC)thread_free) {
+ if (TYPE(data) != T_DATA || RDATA(data)->dmark != (RUBY_DATA_FUNC)thread_mark) {
rb_raise(rb_eTypeError, "wrong argument type %s (expected Thread)",
rb_class2name(CLASS_OF(data)));
}
@@ -7744,7 +7745,8 @@ rb_thread_schedule()
if (select_timeout && n == 0) {
if (now < 0.0) now = timeofday();
FOREACH_THREAD_FROM(curr, th) {
- if ((th->wait_for & (WAIT_SELECT|WAIT_TIME)) && th->delay <= now) {
+ if (((th->wait_for&(WAIT_SELECT|WAIT_TIME)) == (WAIT_SELECT|WAIT_TIME)) &&
+ th->delay <= now) {
th->status = THREAD_RUNNABLE;
th->wait_for = 0;
th->select_value = 0;
@@ -7810,7 +7812,7 @@ rb_thread_schedule()
FOREACH_THREAD_FROM(curr, th) {
fprintf(stderr, "deadlock 0x%lx: %d:%d %s - %s:%d\n",
th->thread, th->status,
- th->wait_for, th==main_thread?"(main)":"",
+ th->wait_for, th==main_thread ? "(main)" : "",
th->file, th->line);
}
END_FOREACH_FROM(curr, th);
@@ -8664,6 +8666,7 @@ rb_thread_cleanup()
th->gid = 0;
th->priority = 0;
th->status = THREAD_TO_KILL;
+ RDATA(th->thread)->dfree = NULL;
}
}
END_FOREACH(th);