[前][次][番号順一覧][スレッド一覧]

ruby-changes:13627

From: nobu <ko1@a...>
Date: Tue, 20 Oct 2009 17:57:48 +0900 (JST)
Subject: [ruby-changes:13627] Ruby:r25411 (trunk): * marshal.c (w_symbol, r_symreal): fixed the order of symbol and

nobu	2009-10-20 17:57:33 +0900 (Tue, 20 Oct 2009)

  New Revision: 25411

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25411

  Log:
    * 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]

  Modified files:
    trunk/ChangeLog
    trunk/marshal.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25410)
+++ ChangeLog	(revision 25411)
@@ -1,3 +1,9 @@
+Tue Oct 20 17:57:31 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* include/ruby/win32.h (finite, scalb): inline'ed non-standard
Index: marshal.c
===================================================================
--- marshal.c	(revision 25410)
+++ marshal.c	(revision 25411)
@@ -431,13 +431,13 @@
 	}
 	w_byte(TYPE_SYMBOL, arg);
 	w_bytes(RSTRING_PTR(sym), RSTRING_LEN(sym), arg);
+	st_add_direct(arg->symbols, id, arg->symbols->num_entries);
 	if (encidx != -1) {
 	    struct dump_call_arg c_arg;
 	    c_arg.limit = 1;
 	    c_arg.arg = arg;
 	    w_encoding(sym, 0, &c_arg);
 	}
-	st_add_direct(arg->symbols, id, arg->symbols->num_entries);
     }
 }
 
@@ -1152,7 +1152,9 @@
     volatile VALUE s = r_bytes(arg);
     ID id;
     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) {
 	long num = r_long(arg);
 	while (num-- > 0) {
@@ -1163,7 +1165,7 @@
     if (idx < 0) idx = rb_usascii_encindex();
     rb_enc_associate_index(s, idx);
     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;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]