Browse Source

putil: Fix SimpleHashMap error reporting at static init time

rdb 2 years ago
parent
commit
914993f31b
1 changed files with 6 additions and 9 deletions
  1. 6 9
      panda/src/putil/simpleHashMap.I

+ 6 - 9
panda/src/putil/simpleHashMap.I

@@ -532,11 +532,10 @@ validate() const {
       size_t index = (size_t)index_array[slot];
       size_t index = (size_t)index_array[slot];
       ++count;
       ++count;
       if (index >= _num_entries) {
       if (index >= _num_entries) {
-        util_cat.error()
+        write(util_cat->error()
           << "SimpleHashMap " << this << " is invalid: slot " << slot
           << "SimpleHashMap " << this << " is invalid: slot " << slot
           << " contains index " << index << " which is past the end of the"
           << " contains index " << index << " which is past the end of the"
-             " table\n";
-        write(util_cat.error(false));
+             " table\n");
         return false;
         return false;
       }
       }
       nassertd(index < _num_entries) continue;
       nassertd(index < _num_entries) continue;
@@ -546,21 +545,19 @@ validate() const {
         wants_slot = next_hash(wants_slot);
         wants_slot = next_hash(wants_slot);
       }
       }
       if (wants_slot != slot) {
       if (wants_slot != slot) {
-        util_cat.error()
+        write(util_cat->error()
           << "SimpleHashMap " << this << " is invalid: key "
           << "SimpleHashMap " << this << " is invalid: key "
           << _table[index]._key << " should be in slot " << wants_slot
           << _table[index]._key << " should be in slot " << wants_slot
-          << " instead of " << slot << " (ideal is " << ideal_slot << ")\n";
-        write(util_cat.error(false));
+          << " instead of " << slot << " (ideal is " << ideal_slot << ")\n");
         return false;
         return false;
       }
       }
     }
     }
   }
   }
 
 
   if (count != _num_entries) {
   if (count != _num_entries) {
-    util_cat.error()
+    write(util_cat->error()
       << "SimpleHashMap " << this << " is invalid: reports " << _num_entries
       << "SimpleHashMap " << this << " is invalid: reports " << _num_entries
-      << " entries, actually has " << count << "\n";
-    write(util_cat.error(false));
+      << " entries, actually has " << count << "\n");
     return false;
     return false;
   }
   }