diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-10-16 15:17:10 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-10-16 15:17:10 +0000 |
| commit | 08746a0313c42c983a6d652f0c69efeff28c4581 (patch) | |
| tree | 929c602060f75a983db86db4e642701756f413f8 /eval.c | |
| parent | 3c6103a2ecf37e8c9e885d9aacdefb965f4ebabb (diff) | |
| download | ruby-08746a0313c42c983a6d652f0c69efeff28c4581.tar.gz ruby-08746a0313c42c983a6d652f0c69efeff28c4581.tar.xz ruby-08746a0313c42c983a6d652f0c69efeff28c4581.zip | |
* eval.c (rb_f_missing): check stack level with rb_stack_check().
* eval.c (rb_call0): ditto.
* eval.c, intern.h (rb_stack_check): added. [new]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
| -rw-r--r-- | eval.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -4150,6 +4150,8 @@ rb_f_missing(argc, argv, obj) rb_raise(rb_eArgError, "no id given"); } + rb_stack_check(); + id = SYM2ID(argv[0]); switch (TYPE(obj)) { @@ -4282,6 +4284,14 @@ stack_length(p) #endif } +void +rb_stack_check() +{ + if (stack_length(0) > STACK_LEVEL_MAX) { + rb_raise(rb_eSysStackError, "stack level too deep"); + } +} + static VALUE call_cfunc(func, recv, len, argc, argv) VALUE (*func)(); @@ -4397,9 +4407,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper) if ((++tick & 0xff) == 0) { CHECK_INTS; /* better than nothing */ - if (stack_length(0) > STACK_LEVEL_MAX) { - rb_raise(rb_eSysStackError, "stack level too deep"); - } + rb_stack_check(); } PUSH_ITER(itr); PUSH_FRAME(); |
