summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-26 08:56:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-26 08:56:08 +0000
commita4918f7cc5205671e60082f949aaf3a0fcafd733 (patch)
tree8f79f4a9565b3e67c774304fc25d82dbd6cbb107 /eval.c
parent784626121b7afc215675097e8db3f46302fca6d4 (diff)
* eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
* eval.c (ev_const_defined): should ignore toplevel cbase (Object). * eval.c (ev_const_get): ditto. * ext/curses/curses.c: curses on Mac OS X public beta does not have _maxx etc. * marshal.c (w_object): should truncate trailing zero short for bignums. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/eval.c b/eval.c
index 9da8d6130a..db647983b2 100644
--- a/eval.c
+++ b/eval.c
@@ -1427,7 +1427,7 @@ ev_const_defined(cref, id, self)
{
NODE *cbase = cref;
- while (cbase) {
+ while (cbase && cbase->nd_next) {
struct RClass *klass = RCLASS(cbase->nd_clss);
if (NIL_P(klass)) return rb_const_defined(CLASS_OF(self), id);
@@ -1448,7 +1448,7 @@ ev_const_get(cref, id, self)
NODE *cbase = cref;
VALUE result;
- while (cbase) {
+ while (cbase && cbase->nd_next) {
struct RClass *klass = RCLASS(cbase->nd_clss);
if (NIL_P(klass)) return rb_const_get(CLASS_OF(self), id);
@@ -1466,7 +1466,7 @@ rb_mod_nesting()
NODE *cbase = RNODE(ruby_frame->cbase);
VALUE ary = rb_ary_new();
- while (cbase && cbase->nd_clss != rb_cObject) {
+ while (cbase && cbase->nd_next) {
rb_ary_push(ary, cbase->nd_clss);
cbase = cbase->nd_next;
}
@@ -1479,7 +1479,7 @@ rb_mod_s_constants()
NODE *cbase = RNODE(ruby_frame->cbase);
VALUE ary = rb_ary_new();
- while (cbase && cbase->nd_clss != rb_cObject) {
+ while (cbase) {
rb_mod_const_at(cbase->nd_clss, ary);
cbase = cbase->nd_next;
}
@@ -1611,16 +1611,9 @@ rb_mod_alias_method(mod, newname, oldname)
(tmp__protect_tmp = rb_node_newnode(NODE_ALLOCA, \
ALLOC_N(VALUE,n),tmp__protect_tmp,n), \
(void*)tmp__protect_tmp->nd_head)
-# define TMP_PROTECT_END do {\
- if (tmp__protect_tmp) {\
- rb_gc_force_recycle((VALUE)tmp__protect_tmp);\
- alloca(0);\
- }\
-} while (0)
#else
# define TMP_PROTECT typedef int foobazzz
# define TMP_ALLOC(n) ALLOCA_N(VALUE,n)
-# define TMP_PROTECT_END
#endif
#define SETUP_ARGS(anode) {\
@@ -2489,7 +2482,6 @@ rb_eval(self, n)
END_CALLARGS;
result = rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,0);
- TMP_PROTECT_END;
}
break;
@@ -2503,7 +2495,6 @@ rb_eval(self, n)
END_CALLARGS;
result = rb_call(CLASS_OF(self),self,node->nd_mid,argc,argv,1);
- TMP_PROTECT_END;
}
break;
@@ -2536,7 +2527,6 @@ rb_eval(self, n)
ruby_frame->self, ruby_frame->last_func,
argc, argv, 3);
POP_ITER();
- TMP_PROTECT_END;
}
break;
@@ -2598,7 +2588,6 @@ rb_eval(self, n)
argv[argc-1] = val;
val = rb_funcall2(recv, aset, argc, argv);
result = val;
- TMP_PROTECT_END;
}
break;
@@ -3232,7 +3221,6 @@ module_setup(module, n)
call_trace_func("end", file, line, 0,
ruby_frame->last_func, ruby_frame->last_class);
}
- TMP_PROTECT_END;
if (state) JUMP_TAG(state);
return result;
@@ -3868,7 +3856,6 @@ handle_rescue(self, node)
if (rb_obj_is_kind_of(ruby_errinfo, argv[0])) return 1;
argv++;
}
- TMP_PROTECT_END;
return 0;
}
@@ -4451,7 +4438,6 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
}
POP_FRAME();
POP_ITER();
- TMP_PROTECT_END;
return result;
}
@@ -5165,7 +5151,6 @@ rb_load(fname, wrap)
ruby_nerrs = 0;
rb_exc_raise(ruby_errinfo);
}
- TMP_PROTECT_END;
if (state) jump_tag_but_local_jump(state);
if (!NIL_P(ruby_errinfo)) /* exception during load */
rb_exc_raise(ruby_errinfo);