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

ruby-changes:22851

From: nobu <ko1@a...>
Date: Mon, 5 Mar 2012 12:43:55 +0900 (JST)
Subject: [ruby-changes:22851] nobu:r34900 (trunk): * st.c (unpack_entries): reallocate bins if packed array size

nobu	2012-03-05 12:43:45 +0900 (Mon, 05 Mar 2012)

  New Revision: 34900

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

  Log:
    * st.c (unpack_entries): reallocate bins if packed array size
      is not same as initial bins size.  based on a patch by
      Sokolov Yura <funny.falcon AT gmail.com>.

  Modified files:
    trunk/ChangeLog
    trunk/st.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34899)
+++ ChangeLog	(revision 34900)
@@ -1,3 +1,9 @@
+Mon Mar  5 12:43:43 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* st.c (unpack_entries): reallocate bins if packed array size
+	  is not same as initial bins size.  based on a patch by
+	  Sokolov Yura <funny.falcon AT gmail.com>.
+
 Mon Mar  5 11:51:48 2012  NARUSE, Yui  <naruse@r...>
 
 	* ext/bigdecimal/lib/bigdecimal/math.rb: remove description about
Index: st.c
===================================================================
--- st.c	(revision 34899)
+++ st.c	(revision 34900)
@@ -478,7 +478,12 @@
     table->bins = (st_table_entry **)&packed_bins;
     tmp_table.entries_packed = 0;
     tmp_table.num_entries = 0;
+#if ST_DEFAULT_INIT_TABLE_SIZE == ST_DEFAULT_PACKED_TABLE_SIZE
     MEMZERO(tmp_table.bins, st_table_entry*, tmp_table.num_bins);
+#else
+    tmp_table.bins = st_realloc_bins(tmp_table.bins, ST_DEFAULT_INIT_TABLE_SIZE, tmp_table.num_bins);
+    tmp_table.num_bins = ST_DEFAULT_INIT_TABLE_SIZE;
+#endif
     for (i = 0; i < table->num_entries; i++) {
 	/* packed table should be numhash */
 	st_index_t key = PKEY(table, i), value = PVAL(table, i);

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

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