summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-07 11:45:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-07 11:45:03 +0000
commit1e9eb839280b8398d693c86c1b7ce4db93bff380 (patch)
treea82ce39a31d7baeaf169f9a040b1bd6f444b632a /hash.c
parenta610b1f0d16d9397dc9c36684a7f58652d276f68 (diff)
Should use the proper constant
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hash.c b/hash.c
index 6bd59eb45c..c41b8e7387 100644
--- a/hash.c
+++ b/hash.c
@@ -340,13 +340,13 @@ clear_entry(li_table_entry* entry)
{
SET_KEY(entry, Qundef);
SET_RECORD(entry, Qundef);
- SET_HASH(entry, 0);
+ SET_HASH(entry, RESERVED_HASH_VAL);
}
static inline int
empty_entry(li_table_entry *entry)
{
- return entry->hash == 0;
+ return entry->hash == RESERVED_HASH_VAL;
}
#define RHASH_ARRAY_SIZE(h) (HASH_ASSERT(RHASH_ARRAY_P(h)), \
@@ -414,7 +414,7 @@ hash_verify_(VALUE hash, const char *file, int line)
h = cur_entry->hash;
k = cur_entry->key;
v = cur_entry->record;
- HASH_ASSERT(h != 0);
+ HASH_ASSERT(h != RESERVED_HASH_VAL);
HASH_ASSERT(k != Qundef);
HASH_ASSERT(v != Qundef);
n++;
@@ -610,7 +610,7 @@ linear_try_convert_table(VALUE hash)
for (i = 0; i < RHASH_ARRAY_MAX_BOUND; i++) {
entry = RHASH_ARRAY_REF(hash, i);
- HASH_ASSERT(entry->hash != 0);
+ HASH_ASSERT(entry->hash != RESERVED_HASH_VAL);
st_add_direct_with_hash(new_tab, entry->key, entry->record, entry->hash);
}
@@ -782,7 +782,8 @@ linear_foreach_check(VALUE hash, int (*func)(ANYARGS), st_data_t arg,
switch (retval) {
case ST_CHECK: {
- if (cur_entry->key == never && cur_entry->hash == 0) break;
+ if (cur_entry->key == never && cur_entry->hash == RESERVED_HASH_VAL)
+ break;
ret = find_entry(hash, hash_value, key);
if (ret == RHASH_ARRAY_MAX_BOUND) {
retval = (*func)(0, 0, arg, 1);