Bug 1123151 (part 2) - Add PLDHashTable::IsInitialized(). r=froydnj.
This encapsulates most of the uses of PLDHashTable::ops.
This commit is contained in:
@@ -131,10 +131,10 @@ nsHTMLEntities::ReleaseTable(void)
|
||||
if (--gTableRefCnt != 0)
|
||||
return;
|
||||
|
||||
if (gEntityToUnicode.ops) {
|
||||
if (gEntityToUnicode.IsInitialized()) {
|
||||
PL_DHashTableFinish(&gEntityToUnicode);
|
||||
}
|
||||
if (gUnicodeToEntity.ops) {
|
||||
if (gUnicodeToEntity.IsInitialized()) {
|
||||
PL_DHashTableFinish(&gUnicodeToEntity);
|
||||
}
|
||||
}
|
||||
@@ -142,8 +142,9 @@ nsHTMLEntities::ReleaseTable(void)
|
||||
int32_t
|
||||
nsHTMLEntities::EntityToUnicode(const nsCString& aEntity)
|
||||
{
|
||||
NS_ASSERTION(gEntityToUnicode.ops, "no lookup table, needs addref");
|
||||
if (!gEntityToUnicode.ops)
|
||||
NS_ASSERTION(gEntityToUnicode.IsInitialized(),
|
||||
"no lookup table, needs addref");
|
||||
if (!gEntityToUnicode.IsInitialized())
|
||||
return -1;
|
||||
|
||||
//this little piece of code exists because entities may or may not have the terminating ';'.
|
||||
@@ -180,7 +181,8 @@ nsHTMLEntities::EntityToUnicode(const nsAString& aEntity) {
|
||||
const char*
|
||||
nsHTMLEntities::UnicodeToEntity(int32_t aUnicode)
|
||||
{
|
||||
NS_ASSERTION(gUnicodeToEntity.ops, "no lookup table, needs addref");
|
||||
NS_ASSERTION(gUnicodeToEntity.IsInitialized(),
|
||||
"no lookup table, needs addref");
|
||||
EntityNodeEntry* entry =
|
||||
static_cast<EntityNodeEntry*>
|
||||
(PL_DHashTableLookup(&gUnicodeToEntity, NS_INT32_TO_PTR(aUnicode)));
|
||||
|
||||
Reference in New Issue
Block a user