diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-20 09:34:36 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-20 09:34:36 +0000 |
| commit | 9e771f28973be01a29dd3a865c97b953520a822d (patch) | |
| tree | 6ba64d567e1ca399fa3abb2d73b66bf574076417 /struct.c | |
| parent | 0bd58466f1026a6a12e7e9b72823138fb09cb5db (diff) | |
| download | ruby-9e771f28973be01a29dd3a865c97b953520a822d.tar.gz ruby-9e771f28973be01a29dd3a865c97b953520a822d.tar.xz ruby-9e771f28973be01a29dd3a865c97b953520a822d.zip | |
* string.c (rb_str_new4): should propagate taintedness.
* struct.c (rb_struct_set): use original method name, not callee
name, to retrieve member slot. [ruby-core:04268]
* time.c (time_strftime): protect from format modification from GC
finalizers.
* gc.c (rb_data_object_alloc): klass may be NULL.
[ruby-list:40498]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'struct.c')
| -rw-r--r-- | struct.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -11,6 +11,7 @@ **********************************************************************/ #include "ruby.h" +#include "env.h" VALUE rb_cStruct; @@ -118,7 +119,7 @@ static VALUE rb_struct_ref(obj) VALUE obj; { - return rb_struct_getmember(obj, rb_frame_last_func()); + return rb_struct_getmember(obj, ruby_frame->orig_func); } static VALUE rb_struct_ref0(obj) VALUE obj; {return RSTRUCT(obj)->ptr[0];} @@ -159,18 +160,20 @@ rb_struct_set(obj, val) VALUE obj, val; { VALUE members, slot; + ID id; long i; members = rb_struct_members(obj); rb_struct_modify(obj); + id = ruby_frame->orig_func; for (i=0; i<RARRAY(members)->len; i++) { slot = RARRAY(members)->ptr[i]; - if (rb_id_attrset(SYM2ID(slot)) == rb_frame_last_func()) { + if (rb_id_attrset(SYM2ID(slot)) == id) { return RSTRUCT(obj)->ptr[i] = val; } } - rb_name_error(rb_frame_last_func(), "`%s' is not a struct member", - rb_id2name(rb_frame_last_func())); + rb_name_error(ruby_frame->last_func, "`%s' is not a struct member", + rb_id2name(id)); return Qnil; /* not reached */ } |
