* marshal.c (w_symbol, r_symreal): fixed the order of symbol and

its encoding modifier, in order to make the dump readable from
  1.8.  [ruby-dev:39515]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-10-20 08:57:33 +00:00
Родитель a07dbf0ee9
Коммит f25fd72a0a
2 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Tue Oct 20 17:57:31 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* marshal.c (w_symbol, r_symreal): fixed the order of symbol and
its encoding modifier, in order to make the dump readable from
1.8. [ruby-dev:39515]
Tue Oct 20 16:41:18 2009 NAKAMURA Usaku <usa@ruby-lang.org> Tue Oct 20 16:41:18 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* include/ruby/win32.h (finite, scalb): inline'ed non-standard * include/ruby/win32.h (finite, scalb): inline'ed non-standard

Просмотреть файл

@ -431,13 +431,13 @@ w_symbol(ID id, struct dump_arg *arg)
} }
w_byte(TYPE_SYMBOL, arg); w_byte(TYPE_SYMBOL, arg);
w_bytes(RSTRING_PTR(sym), RSTRING_LEN(sym), arg); w_bytes(RSTRING_PTR(sym), RSTRING_LEN(sym), arg);
st_add_direct(arg->symbols, id, arg->symbols->num_entries);
if (encidx != -1) { if (encidx != -1) {
struct dump_call_arg c_arg; struct dump_call_arg c_arg;
c_arg.limit = 1; c_arg.limit = 1;
c_arg.arg = arg; c_arg.arg = arg;
w_encoding(sym, 0, &c_arg); w_encoding(sym, 0, &c_arg);
} }
st_add_direct(arg->symbols, id, arg->symbols->num_entries);
} }
} }
@ -1152,7 +1152,9 @@ r_symreal(struct load_arg *arg, int ivar)
volatile VALUE s = r_bytes(arg); volatile VALUE s = r_bytes(arg);
ID id; ID id;
int idx = -1; int idx = -1;
st_index_t n = arg->symbols->num_entries;
st_insert(arg->symbols, (st_data_t)n, (st_data_t)0);
if (ivar) { if (ivar) {
long num = r_long(arg); long num = r_long(arg);
while (num-- > 0) { while (num-- > 0) {
@ -1163,7 +1165,7 @@ r_symreal(struct load_arg *arg, int ivar)
if (idx < 0) idx = rb_usascii_encindex(); if (idx < 0) idx = rb_usascii_encindex();
rb_enc_associate_index(s, idx); rb_enc_associate_index(s, idx);
id = rb_intern_str(s); id = rb_intern_str(s);
st_insert(arg->symbols, arg->symbols->num_entries, id); st_insert(arg->symbols, (st_data_t)n, (st_data_t)id);
return id; return id;
} }