ruby-changes:22265
From: shyouhei <ko1@a...>
Date: Mon, 16 Jan 2012 00:47:50 +0900 (JST)
Subject: [ruby-changes:22265] shyouhei:r34313 (trunk): st refactor add_packed_direct a bit
shyouhei 2012-01-16 00:46:41 +0900 (Mon, 16 Jan 2012) New Revision: 34313 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34313 Log: st refactor add_packed_direct a bit Modified files: trunk/st.c Index: st.c =================================================================== --- st.c (revision 34312) +++ st.c (revision 34313) @@ -469,10 +469,9 @@ *table = tmp_table; } -static int +static void add_packed_direct(st_table *table, st_data_t key, st_data_t value) { - int res = 1; if (table->num_entries < MAX_PACKED_NUMHASH) { st_index_t i = table->num_entries++; PKEY_SET(table, i, key); @@ -480,9 +479,8 @@ } else { unpack_entries(table); - res = 0; + add_direct(table, key, value, key, key % table->num_bins); } - return res; } @@ -498,9 +496,8 @@ PVAL_SET(table, i, value); return 1; } - if (add_packed_direct(table, key, value)) { - return 0; - } + add_packed_direct(table, key, value); + return 0; } hash_val = do_hash(key, table); @@ -530,9 +527,8 @@ PVAL_SET(table, i, value); return 1; } - if (add_packed_direct(table, key, value)) { - return 0; - } + add_packed_direct(table, key, value); + return 0; } hash_val = do_hash(key, table); @@ -556,9 +552,8 @@ st_index_t hash_val, bin_pos; if (table->entries_packed) { - if (add_packed_direct(table, key, value)) { - return; - } + add_packed_direct(table, key, value); + return; } hash_val = do_hash(key, table); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/