X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Fstructures%2Fhash_table.h;h=6423d41381f442b4b2d10ee1e5f94df71f35d629;hb=refs%2Fheads%2Frelease-2.140.133;hp=4eb0285620543af95183efef5737a5b1d49b11f3;hpb=3ea085ec301ed1399dfa1e9f3a240312dc95410b;p=feisty_meow.git diff --git a/nucleus/library/structures/hash_table.h b/nucleus/library/structures/hash_table.h index 4eb02856..6423d413 100644 --- a/nucleus/library/structures/hash_table.h +++ b/nucleus/library/structures/hash_table.h @@ -59,7 +59,7 @@ public: The buckets are currently simple lists, but if the hashing algorithm is well chosen, then that's not a major problem. This makes lookups a lot faster than a linear search, but no particular performance guarantees are made at - this time (hmmm). + this time. */ template @@ -123,14 +123,14 @@ public: destroy or otherwise damage the "item_found". */ contents *find(const key_type &key) const - { contents *c = NIL; return find(key, c)? c : NIL; } + { contents *c = NULL_POINTER; return find(key, c)? c : NULL_POINTER; } //!< simplified form of above find() method. contents *acquire(const key_type &key); //!< retrieves the contents held for "key" out of the table. /*!< afterwards, the contents pointer is the caller's responsibility; it is no longer in the table and must be destroyed externally. if no item - was found for the "key", then NIL is returned. */ + was found for the "key", then NULL_POINTER is returned. */ bool zap(const key_type &key); //!< removes the entry with the "key" specified. @@ -215,7 +215,7 @@ public: key_type *_id; contents *_data; - hash_wrapper(key_type *id = NIL, contents *data = NIL) + hash_wrapper(key_type *id = NULL_POINTER, contents *data = NULL_POINTER) : _id(id), _data(data) {} }; @@ -227,7 +227,7 @@ class bucket public virtual basis::root_object { public: - bucket() : basis::array >(0, NIL, + bucket() : basis::array >(0, NULL_POINTER, basis::byte_array::SIMPLE_COPY | basis::byte_array::EXPONE | basis::byte_array::FLUSH_INVISIBLE) {} @@ -464,7 +464,7 @@ bool hash_table::find(const key_type &key, FUNCDEF("find"); if (!verify()) deadly_error(class_name(), func, "state did not verify."); #endif - item_found = NIL; + item_found = NULL_POINTER; // get a hash value. basis::un_int hashed = _hasher->hash((const void *)&key, sizeof(key)); // make the value appropriate for our table. @@ -492,9 +492,9 @@ contents *hash_table::acquire(const key_type &key) hashed = hashed % _table->elements(); // see if the key exists in the bucket. bucket *buck = _table->borrow(hashed); - if (!buck) return NIL; + if (!buck) return NULL_POINTER; int indy = buck->find(key); - if (basis::negative(indy)) return NIL; // nope, not there. + if (basis::negative(indy)) return NULL_POINTER; // nope, not there. contents *to_return = (*buck)[indy]._data; basis::WHACK((*buck)[indy]._id); // clean the id. buck->zap(indy, indy); // toss the storage blob for the item.