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

ruby-changes:54054

From: nobu <ko1@a...>
Date: Fri, 7 Dec 2018 20:45:08 +0900 (JST)
Subject: [ruby-changes:54054] nobu:r66273 (trunk): Should use the proper constant

nobu	2018-12-07 20:45:03 +0900 (Fri, 07 Dec 2018)

  New Revision: 66273

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66273

  Log:
    Should use the proper constant

  Modified files:
    trunk/hash.c
Index: hash.c
===================================================================
--- hash.c	(revision 66272)
+++ hash.c	(revision 66273)
@@ -340,13 +340,13 @@ clear_entry(li_table_entry* entry) https://github.com/ruby/ruby/blob/trunk/hash.c#L340
 {
     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 *fil https://github.com/ruby/ruby/blob/trunk/hash.c#L414
                 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) https://github.com/ruby/ruby/blob/trunk/hash.c#L610
 
     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 (*f https://github.com/ruby/ruby/blob/trunk/hash.c#L782
 
             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);

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

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