Bug 1050035 (part 2) - Remove the fallible version of PL_DHashTableInit(). r=froydnj,mrbkap.

Because it's no longer needed now that entry storage isn't allocated there.
(The other possible causes of failures are much less interesting and simply
crashing is a reasonable thing to do for them.)

This also makes PL_DNewHashTable() infallible.
This commit is contained in:
Nicholas Nethercote
2015-02-01 20:19:08 -08:00
parent 1b36fac50d
commit 071d261bc7
23 changed files with 137 additions and 362 deletions

View File

@@ -83,17 +83,10 @@ nsresult
nsHTMLEntities::AddRefTable(void)
{
if (!gTableRefCnt) {
if (!PL_DHashTableInit(&gEntityToUnicode, &EntityToUnicodeOps,
sizeof(EntityNodeEntry),
fallible, NS_HTML_ENTITY_COUNT)) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (!PL_DHashTableInit(&gUnicodeToEntity, &UnicodeToEntityOps,
sizeof(EntityNodeEntry),
fallible, NS_HTML_ENTITY_COUNT)) {
PL_DHashTableFinish(&gEntityToUnicode);
return NS_ERROR_OUT_OF_MEMORY;
}
PL_DHashTableInit(&gEntityToUnicode, &EntityToUnicodeOps,
sizeof(EntityNodeEntry), NS_HTML_ENTITY_COUNT);
PL_DHashTableInit(&gUnicodeToEntity, &UnicodeToEntityOps,
sizeof(EntityNodeEntry), NS_HTML_ENTITY_COUNT);
for (const EntityNode *node = gEntityArray,
*node_end = ArrayEnd(gEntityArray);
node < node_end; ++node) {