summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-13 00:58:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-13 00:58:30 +0000
commitd70719b0614f8624020f8cdc561a426a45cdda1b (patch)
tree8b381f9b6e6e32f71c362ae83b91c634a264154b /marshal.c
parent4150c2c05dff1a034af010bb6a6c11ad9abd05ac (diff)
* marshal.c (r_ivar): should not set internal encoding ivar as an
ordinary ivar. [ruby-dev:38596] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/marshal.c b/marshal.c
index 807a0335a2..d67168db97 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1159,14 +1159,14 @@ r_ivar(VALUE obj, struct load_arg *arg)
len = r_long(arg);
if (len > 0) {
- while (len--) {
+ do {
ID id = r_symbol(arg);
VALUE val = r_object(arg);
if (id == rb_id_encoding()) {
int idx = rb_enc_find_index(StringValueCStr(val));
if (idx > 0) rb_enc_associate_index(obj, idx);
}
- if (id == rb_intern("E")) {
+ else if (id == rb_intern("E")) {
if (val == Qfalse) rb_enc_associate_index(obj, rb_usascii_encindex());
else if (val == Qtrue) rb_enc_associate_index(obj, rb_utf8_encindex());
/* bogus ignore */
@@ -1174,7 +1174,7 @@ r_ivar(VALUE obj, struct load_arg *arg)
else {
rb_ivar_set(obj, id, val);
}
- }
+ } while (--len > 0);
}
}