Bug 1050035 (part 4) - Make PL_DHashTableAdd() infallible by default, and add a fallible alternative. r=froydnj.

I kept all the existing PL_DHashTableAdd() calls fallible, in order to be
conservative, except for the ones in nsAtomTable.cpp which already were
followed immediately by an abort on failure.
This commit is contained in:
Nicholas Nethercote
2015-02-02 14:48:58 -08:00
parent 073c69e299
commit a3bf151ee6
39 changed files with 146 additions and 116 deletions

View File

@@ -94,7 +94,7 @@ nsHTMLEntities::AddRefTable(void)
// add to Entity->Unicode table
EntityNodeEntry* entry =
static_cast<EntityNodeEntry*>
(PL_DHashTableAdd(&gEntityToUnicode, node->mStr));
(PL_DHashTableAdd(&gEntityToUnicode, node->mStr, fallible));
NS_ASSERTION(entry, "Error adding an entry");
// Prefer earlier entries when we have duplication.
if (!entry->node)
@@ -103,7 +103,8 @@ nsHTMLEntities::AddRefTable(void)
// add to Unicode->Entity table
entry = static_cast<EntityNodeEntry*>
(PL_DHashTableAdd(&gUnicodeToEntity,
NS_INT32_TO_PTR(node->mUnicode)));
NS_INT32_TO_PTR(node->mUnicode),
fallible));
NS_ASSERTION(entry, "Error adding an entry");
// Prefer earlier entries when we have duplication.
if (!entry->node)