mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_eval.c: Check_TypedStruct
* vm_eval.c (eval_string_with_cref): check by Check_TypedStruct instead of rb_obj_is_kind_of. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
62b8b4df78
commit
03813f6dac
4 changed files with 11 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Jul 22 16:32:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (eval_string_with_cref): check by Check_TypedStruct
|
||||
instead of rb_obj_is_kind_of.
|
||||
|
||||
Mon Jul 22 13:19:22 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* array.c (ary_resize_capa): use RARRAY_RAWPTR() because
|
||||
|
|
4
proc.c
4
proc.c
|
@ -269,7 +269,7 @@ binding_memsize(const void *ptr)
|
|||
return ptr ? sizeof(rb_binding_t) : 0;
|
||||
}
|
||||
|
||||
static const rb_data_type_t binding_data_type = {
|
||||
const rb_data_type_t ruby_binding_data_type = {
|
||||
"binding",
|
||||
{
|
||||
binding_mark,
|
||||
|
@ -283,7 +283,7 @@ binding_alloc(VALUE klass)
|
|||
{
|
||||
VALUE obj;
|
||||
rb_binding_t *bind;
|
||||
obj = TypedData_Make_Struct(klass, rb_binding_t, &binding_data_type, bind);
|
||||
obj = TypedData_Make_Struct(klass, rb_binding_t, &ruby_binding_data_type, bind);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -688,6 +688,8 @@ typedef struct {
|
|||
rb_block_t block;
|
||||
} rb_env_t;
|
||||
|
||||
extern const rb_data_type_t ruby_binding_data_type;
|
||||
|
||||
#define GetBindingPtr(obj, ptr) \
|
||||
GetCoreDataFromValue((obj), rb_binding_t, (ptr))
|
||||
|
||||
|
|
|
@ -1202,8 +1202,8 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
|
|||
VALUE absolute_path = Qnil;
|
||||
|
||||
if (scope != Qnil) {
|
||||
if (rb_obj_is_kind_of(scope, rb_cBinding)) {
|
||||
GetBindingPtr(scope, bind);
|
||||
bind = Check_TypedStruct(scope, &ruby_binding_data_type);
|
||||
{
|
||||
envval = bind->env;
|
||||
if (strcmp(file, "(eval)") != 0) {
|
||||
absolute_path = rb_str_new_cstr(file);
|
||||
|
@ -1214,11 +1214,6 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
|
|||
absolute_path = rb_current_realfilepath();
|
||||
}
|
||||
}
|
||||
else {
|
||||
rb_raise(rb_eTypeError,
|
||||
"wrong argument type %s (expected Binding)",
|
||||
rb_obj_classname(scope));
|
||||
}
|
||||
GetEnvPtr(envval, env);
|
||||
base_block = &env->block;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue