diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-25 13:57:01 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-25 13:57:01 +0000 |
commit | b134b912780e0fd84fbc107a9362e45f04391b47 (patch) | |
tree | 3aad53ec0421149c8fb9e163379bba8efb2ab42e /st.c | |
parent | 4ec25bdd63c8cb9acf70880666c1d113ae0cb51e (diff) | |
download | ruby-b134b912780e0fd84fbc107a9362e45f04391b47.tar.gz |
* various files: macro fix-up by Michal Rokos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -233,16 +233,17 @@ st_free_table(table) #define COLLISION #endif -#define FIND_ENTRY(table, ptr, hash_val, bin_pos) \ -bin_pos = hash_val%(table)->num_bins;\ -ptr = (table)->bins[bin_pos];\ -if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {\ - COLLISION;\ - while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\ +#define FIND_ENTRY(table, ptr, hash_val, bin_pos) do {\ + bin_pos = hash_val%(table)->num_bins;\ + ptr = (table)->bins[bin_pos];\ + if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {\ + COLLISION;\ + while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\ + ptr = ptr->next;\ + }\ ptr = ptr->next;\ }\ - ptr = ptr->next;\ -} +} while (0) int st_lookup(table, key, value) @@ -266,7 +267,7 @@ st_lookup(table, key, value) } #define ADD_DIRECT(table, key, value, hash_val, bin_pos)\ -{\ +do {\ st_table_entry *entry;\ if (table->num_entries/(table->num_bins) > ST_DEFAULT_MAX_DENSITY) {\ rehash(table);\ @@ -281,7 +282,7 @@ st_lookup(table, key, value) entry->next = table->bins[bin_pos];\ table->bins[bin_pos] = entry;\ table->num_entries++;\ -} +} while (0) int st_insert(table, key, value) |