Closed Bug 760337 Opened 8 years ago Closed 8 years ago

Add JS_ASSERT(initialized()) where appropriate in HashTable.h

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: njn, Assigned: njn)

Details

Attachments

(1 file)

Bug 710922 was caused by calling all() on a hash table that hadn't had init() called on it.  A |JS_ASSERT(initialized())| assertion inside all() would have caught it immediately.  There are probably other places where that assertion would also be helpful.
Attached patch patchSplinter Review
This patch adds JS_ASSERT(table) to two sets of HashTable methods.  

- The first set definitely need it: findFreeEntry(), add(), two versions of
  remove(), all().

- The second set don't need it, but it seems like a good idea just to
  encourage people to init() their HashTables immediately:  empty(), 
  count(), capacity(), generation, sizeOf{In,Ex}cludingThis().
Attachment #629675 - Flags: review?(luke)
Comment on attachment 629675 [details] [diff] [review]
patch

Looks good
Attachment #629675 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/03a85aeeed14
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.