Reviewed by Anders.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jan 2006 04:33:55 +0000 (04:33 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jan 2006 04:33:55 +0000 (04:33 +0000)
commit8b1890229a26dada925b966ac8a4d41d3711f697
treee9dab36fba34c9444f66a8d691b23b679df686d8
parenta1b40b44c05d911c985b8cbab2549f0e51c506c3
    Reviewed by Anders.

        - http://bugzilla.opendarwin.org/show_bug.cgi?id=6611
          add assertions to check correct use of hash table iterators

        * kxmlcore/HashTable.h:
        (KXMLCore::addIterator): Added. Helper function that adds an iterator to the list
        maintained by the specified hash table.
        (KXMLCore::removeIterator): Added. Helper function that removes an iterator from
        the list maintained by the hash table it's in.
        (KXMLCore::HashTableConstIterator::HashTableConstIterator): Added a HashTable
        parameter, ignored when not debugging. Call addIterator.
        (KXMLCore::HashTableConstIterator::~HashTableConstIterator):
        (KXMLCore::HashTableConstIterator::operator=): Call removeIterator.
        (KXMLCore::HashTableConstIterator::operator*): Call checkValidity.
        (KXMLCore::HashTableConstIterator::operator->): Ditto.
        (KXMLCore::HashTableConstIterator::operator++): Ditto.
        (KXMLCore::HashTableConstIterator::operator==): Ditto.
        (KXMLCore::HashTableConstIterator::operator!=): Ditto.
        (KXMLCore::HashTableConstIterator::checkValidity): Checks that the hash table
        pointer is not 0 and if there are two iterators that both point at the same table.
        (KXMLCore::HashTableIterator::HashTableIterator): Changed to use the const iterator
        as an implementation detail, to avoid having two separate iterator implementations.
        (KXMLCore::HashTableIterator::operator*): Ditto.
        (KXMLCore::HashTableIterator::operator->): Ditto.
        (KXMLCore::HashTableIterator::operator++): Ditto.
        (KXMLCore::HashTableIterator::operator==): Ditto.
        (KXMLCore::HashTableIterator::operator!=): Ditto.
        (KXMLCore::HashTable::HashTable): Initialize pointer to head of iterators list.
        (KXMLCore::HashTable::~HashTable): Added call to invalidateIterators.
        (KXMLCore::HashTable::makeIterator): Pass this pointer.
        (KXMLCore::HashTable::makeConstIterator): Ditto.
        (KXMLCore::HashTable::insert): Call invalidateIterators, since this is a public
        entry point that modifies the hash table.
        (KXMLCore::HashTable::remove): Ditto.
        (KXMLCore::HashTable::clear): Ditto.
        (KXMLCore::HashTable::swap): Ditto.
        (KXMLCore::HashTable::invalidateIterators): Added. Walks the iterators list and
        clears out the table, next, and previous pointers in all of them, and then clears
        the head so we have an empty list.
        (KXMLCore::addIterator): Added. Adds the iterator the the linked list in the
        passed-in table, and points the iterator at the table.
        (KXMLCore::removeIterator): Added. Removes the iterator from the linked list in
        the passed-in table.

        * kxmlcore/HashTraits.h: A bit of tweaking and formatting.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@12162 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore/ChangeLog
JavaScriptCore/kxmlcore/HashTable.h
JavaScriptCore/kxmlcore/HashTraits.h