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

ruby-changes:13750

From: yugui <ko1@a...>
Date: Thu, 29 Oct 2009 01:06:45 +0900 (JST)
Subject: [ruby-changes:13750] Ruby:r25543 (ruby_1_9_1): merges r24637 from trunk into ruby_1_9_1.

yugui	2009-10-29 01:06:26 +0900 (Thu, 29 Oct 2009)

  New Revision: 25543

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

  Log:
    merges r24637 from trunk into ruby_1_9_1.
    --
    * st.c (st_delete_safe): deals with packed entries.
      [ruby-core:25080]
    
    * st.c (st_cleanup_safe): ditto.  [ruby-core:25081]

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/st.c
    branches/ruby_1_9_1/version.h

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 25542)
+++ ruby_1_9_1/ChangeLog	(revision 25543)
@@ -1,3 +1,10 @@
+Mon Aug 24 16:35:57 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* st.c (st_delete_safe): deals with packed entries.
+	  [ruby-core:25080]
+
+	* st.c (st_cleanup_safe): ditto.  [ruby-core:25081]
+
 Sun Aug 23 00:56:13 2009  Tanaka Akira  <akr@f...>
 
 	* thread.c (rb_thread_schedule): don't recur infinitely.
Index: ruby_1_9_1/st.c
===================================================================
--- ruby_1_9_1/st.c	(revision 25542)
+++ ruby_1_9_1/st.c	(revision 25543)
@@ -573,6 +573,19 @@
     unsigned int hash_val;
     register st_table_entry *ptr;
 
+    if (table->entries_packed) {
+	st_index_t i;
+	for (i = 0; i < table->num_entries; i++) {
+	    if ((st_data_t)table->bins[i*2] == *key) {
+		if (value != 0) *value = (st_data_t)table->bins[i*2+1];
+		table->bins[i*2] = (void *)never;
+		return 1;
+	    }
+	}
+	if (value != 0) *value = 0;
+	return 0;
+    }
+
     hash_val = do_hash_bin(*key, table);
     ptr = table->bins[hash_val];
 
@@ -596,6 +609,21 @@
     st_table_entry *ptr, **last, *tmp;
     int i;
 
+    if (table->entries_packed) {
+	st_index_t i = 0, j = 0;
+	while ((st_data_t)table->bins[i*2] != never) {
+	    if (i++ == table->num_entries) return;
+	}
+	for (j = i; ++i < table->num_entries;) {
+	    if ((st_data_t)table->bins[i*2] == never) continue;
+	    table->bins[j*2] = table->bins[i*2];
+	    table->bins[j*2+1] = table->bins[i*2+1];
+	    j++;
+	}
+	table->num_entries = j;
+	return;
+    }
+
     for (i = 0; i < table->num_bins; i++) {
 	ptr = *(last = &table->bins[i]);
 	while (ptr != 0) {
Index: ruby_1_9_1/version.h
===================================================================
--- ruby_1_9_1/version.h	(revision 25542)
+++ ruby_1_9_1/version.h	(revision 25543)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.1"
-#define RUBY_PATCHLEVEL 302
+#define RUBY_PATCHLEVEL 303
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1

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

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