Bug 1121304 (part 2, attempt 2) - Remove PLDHashTableOps::{alloc,free}Table. r=froydnj.

--HG--
extra : rebase_source : bc119bd0d3b6944e8c5a000950e0c4052cb70aef
This commit is contained in:
Nicholas Nethercote 2015-01-14 14:35:56 -08:00
parent 09c7443b86
commit 5a62e7fcbf
33 changed files with 13 additions and 145 deletions

View File

@ -208,8 +208,6 @@ NS_GetContentList(nsINode* aRootNode,
static const PLDHashTableOps hash_table_ops = static const PLDHashTableOps hash_table_ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
ContentListHashtableHashKey, ContentListHashtableHashKey,
ContentListHashtableMatchEntry, ContentListHashtableMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -320,8 +318,6 @@ GetFuncStringContentList(nsINode* aRootNode,
static const PLDHashTableOps hash_table_ops = static const PLDHashTableOps hash_table_ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
FuncStringContentListHashtableHashKey, FuncStringContentListHashtableHashKey,
FuncStringContentListHashtableMatchEntry, FuncStringContentListHashtableMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -479,8 +479,6 @@ nsContentUtils::Init()
if (!sEventListenerManagersHash.ops) { if (!sEventListenerManagersHash.ops) {
static const PLDHashTableOps hash_table_ops = static const PLDHashTableOps hash_table_ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
PL_DHashMatchEntryStub, PL_DHashMatchEntryStub,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -3972,8 +3972,6 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
static const PLDHashTableOps hash_table_ops = static const PLDHashTableOps hash_table_ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
PL_DHashMatchEntryStub, PL_DHashMatchEntryStub,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -320,8 +320,6 @@ nsScriptNameSpaceManager::Init()
{ {
static const PLDHashTableOps hash_table_ops = static const PLDHashTableOps hash_table_ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
GlobalNameHashHashKey, GlobalNameHashHashKey,
GlobalNameHashMatchEntry, GlobalNameHashMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -760,8 +760,6 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
} }
static const PLDHashTableOps gOps = { static const PLDHashTableOps gOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
PL_DHashMatchEntryStub, PL_DHashMatchEntryStub,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -16,8 +16,6 @@ using namespace mozilla;
const PLDHashTableOps nsCommandParams::sHashOps = const PLDHashTableOps nsCommandParams::sHashOps =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
HashKey, HashKey,
HashMatchEntry, HashMatchEntry,
HashMoveEntry, HashMoveEntry,

View File

@ -622,8 +622,6 @@ public:
: mWriteNeeded(false) : mWriteNeeded(false)
{ {
mOps = (PLDHashTableOps) { mOps = (PLDHashTableOps) {
PL_DHashAllocTable,
PL_DHashFreeTable,
StringHash, StringHash,
HashMatchEntry, HashMatchEntry,
MoveEntry, MoveEntry,

View File

@ -212,8 +212,6 @@ Native2WrappedNativeMap::SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr,
const struct PLDHashTableOps IID2WrappedJSClassMap::Entry::sOps = const struct PLDHashTableOps IID2WrappedJSClassMap::Entry::sOps =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
HashIIDPtrKey, HashIIDPtrKey,
MatchIIDPtrKey, MatchIIDPtrKey,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -248,8 +246,6 @@ IID2WrappedJSClassMap::~IID2WrappedJSClassMap()
const struct PLDHashTableOps IID2NativeInterfaceMap::Entry::sOps = const struct PLDHashTableOps IID2NativeInterfaceMap::Entry::sOps =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
HashIIDPtrKey, HashIIDPtrKey,
MatchIIDPtrKey, MatchIIDPtrKey,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -452,8 +448,6 @@ NativeSetMap::Entry::Match(PLDHashTable *table,
const struct PLDHashTableOps NativeSetMap::Entry::sOps = const struct PLDHashTableOps NativeSetMap::Entry::sOps =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
HashNativeKey, HashNativeKey,
Match, Match,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -518,8 +512,6 @@ IID2ThisTranslatorMap::Entry::Clear(PLDHashTable *table, PLDHashEntryHdr *entry)
const struct PLDHashTableOps IID2ThisTranslatorMap::Entry::sOps = const struct PLDHashTableOps IID2ThisTranslatorMap::Entry::sOps =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
HashIIDPtrKey, HashIIDPtrKey,
Match, Match,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -596,8 +588,6 @@ XPCNativeScriptableSharedMap::Entry::Match(PLDHashTable *table,
const struct PLDHashTableOps XPCNativeScriptableSharedMap::Entry::sOps = const struct PLDHashTableOps XPCNativeScriptableSharedMap::Entry::sOps =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
Hash, Hash,
Match, Match,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -69,8 +69,6 @@ PlaceholderMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
} }
static const PLDHashTableOps PlaceholderMapOps = { static const PLDHashTableOps PlaceholderMapOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
PlaceholderMapMatchEntry, PlaceholderMapMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -362,8 +362,6 @@ RuleHash_NameSpaceTable_MatchEntry(PLDHashTable *table,
} }
static const PLDHashTableOps RuleHash_TagTable_Ops = { static const PLDHashTableOps RuleHash_TagTable_Ops = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
RuleHash_TagTable_MatchEntry, RuleHash_TagTable_MatchEntry,
RuleHash_TagTable_MoveEntry, RuleHash_TagTable_MoveEntry,
@ -374,8 +372,6 @@ static const PLDHashTableOps RuleHash_TagTable_Ops = {
// Case-sensitive ops. // Case-sensitive ops.
static const RuleHashTableOps RuleHash_ClassTable_CSOps = { static const RuleHashTableOps RuleHash_ClassTable_CSOps = {
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
RuleHash_CSMatchEntry, RuleHash_CSMatchEntry,
RuleHash_MoveEntry, RuleHash_MoveEntry,
@ -388,8 +384,6 @@ static const RuleHashTableOps RuleHash_ClassTable_CSOps = {
// Case-insensitive ops. // Case-insensitive ops.
static const RuleHashTableOps RuleHash_ClassTable_CIOps = { static const RuleHashTableOps RuleHash_ClassTable_CIOps = {
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
RuleHash_CIHashKey, RuleHash_CIHashKey,
RuleHash_CIMatchEntry, RuleHash_CIMatchEntry,
RuleHash_MoveEntry, RuleHash_MoveEntry,
@ -402,8 +396,6 @@ static const RuleHashTableOps RuleHash_ClassTable_CIOps = {
// Case-sensitive ops. // Case-sensitive ops.
static const RuleHashTableOps RuleHash_IdTable_CSOps = { static const RuleHashTableOps RuleHash_IdTable_CSOps = {
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
RuleHash_CSMatchEntry, RuleHash_CSMatchEntry,
RuleHash_MoveEntry, RuleHash_MoveEntry,
@ -416,8 +408,6 @@ static const RuleHashTableOps RuleHash_IdTable_CSOps = {
// Case-insensitive ops. // Case-insensitive ops.
static const RuleHashTableOps RuleHash_IdTable_CIOps = { static const RuleHashTableOps RuleHash_IdTable_CIOps = {
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
RuleHash_CIHashKey, RuleHash_CIHashKey,
RuleHash_CIMatchEntry, RuleHash_CIMatchEntry,
RuleHash_MoveEntry, RuleHash_MoveEntry,
@ -428,8 +418,6 @@ static const RuleHashTableOps RuleHash_IdTable_CIOps = {
}; };
static const PLDHashTableOps RuleHash_NameSpaceTable_Ops = { static const PLDHashTableOps RuleHash_NameSpaceTable_Ops = {
PL_DHashAllocTable,
PL_DHashFreeTable,
RuleHash_NameSpaceTable_HashKey, RuleHash_NameSpaceTable_HashKey,
RuleHash_NameSpaceTable_MatchEntry, RuleHash_NameSpaceTable_MatchEntry,
RuleHash_MoveEntry, RuleHash_MoveEntry,
@ -887,8 +875,6 @@ AtomSelector_GetKey(PLDHashTable *table, const PLDHashEntryHdr *hdr)
// Case-sensitive ops. // Case-sensitive ops.
static const PLDHashTableOps AtomSelector_CSOps = { static const PLDHashTableOps AtomSelector_CSOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
PL_DHashMatchEntryStub, PL_DHashMatchEntryStub,
AtomSelector_MoveEntry, AtomSelector_MoveEntry,
@ -899,8 +885,6 @@ static const PLDHashTableOps AtomSelector_CSOps = {
// Case-insensitive ops. // Case-insensitive ops.
static const RuleHashTableOps AtomSelector_CIOps = { static const RuleHashTableOps AtomSelector_CIOps = {
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
RuleHash_CIHashKey, RuleHash_CIHashKey,
RuleHash_CIMatchEntry, RuleHash_CIMatchEntry,
AtomSelector_MoveEntry, AtomSelector_MoveEntry,
@ -3337,8 +3321,6 @@ InitWeightEntry(PLDHashTable *table, PLDHashEntryHdr *hdr,
} }
static const PLDHashTableOps gRulesByWeightOps = { static const PLDHashTableOps gRulesByWeightOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
HashIntKey, HashIntKey,
MatchWeightEntry, MatchWeightEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -169,8 +169,6 @@ MappedAttrTable_MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
} }
static const PLDHashTableOps MappedAttrTable_Ops = { static const PLDHashTableOps MappedAttrTable_Ops = {
PL_DHashAllocTable,
PL_DHashFreeTable,
MappedAttrTable_HashKey, MappedAttrTable_HashKey,
MappedAttrTable_MatchEntry, MappedAttrTable_MatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -225,8 +223,6 @@ LangRuleTable_InitEntry(PLDHashTable *table, PLDHashEntryHdr *hdr,
} }
static const PLDHashTableOps LangRuleTable_Ops = { static const PLDHashTableOps LangRuleTable_Ops = {
PL_DHashAllocTable,
PL_DHashFreeTable,
LangRuleTable_HashKey, LangRuleTable_HashKey,
LangRuleTable_MatchEntry, LangRuleTable_MatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -114,8 +114,6 @@ nsRuleNode::ChildrenHashOps = {
// free rather than the pres shell's arena because the table doesn't // free rather than the pres shell's arena because the table doesn't
// grow very often and the pres shell's arena doesn't recycle very // grow very often and the pres shell's arena doesn't recycle very
// large size allocations. // large size allocations.
PL_DHashAllocTable,
PL_DHashFreeTable,
ChildrenHashHashKey, ChildrenHashHashKey,
ChildrenHashMatchEntry, ChildrenHashMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -33,8 +33,6 @@ SpanningCellSorter::~SpanningCellSorter()
/* static */ const PLDHashTableOps /* static */ const PLDHashTableOps
SpanningCellSorter::HashTableOps = { SpanningCellSorter::HashTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
HashTableHashKey, HashTableHashKey,
HashTableMatchEntry, HashTableMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -77,8 +77,6 @@ static bool gShouldCleanupDeadNodes = false;
static PLDHashTableOps pref_HashTableOps = { static PLDHashTableOps pref_HashTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashStringKey, PL_DHashStringKey,
matchPrefEntry, matchPrefEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -1156,8 +1156,6 @@ nsresult nsLoadGroup::Init()
{ {
static const PLDHashTableOps hash_table_ops = static const PLDHashTableOps hash_table_ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
RequestHashMatchEntry, RequestHashMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -377,8 +377,6 @@ nsCacheEntryInfo::IsStreamBased(bool * result)
const PLDHashTableOps const PLDHashTableOps
nsCacheEntryHashTable::ops = nsCacheEntryHashTable::ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
HashKey, HashKey,
MatchEntry, MatchEntry,
MoveEntry, MoveEntry,

View File

@ -124,8 +124,6 @@ nsDiskCacheBinding::EnsureStreamIO()
const PLDHashTableOps nsDiskCacheBindery::ops = const PLDHashTableOps nsDiskCacheBindery::ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
HashKey, HashKey,
MatchEntry, MatchEntry,
MoveEntry, MoveEntry,

View File

@ -463,8 +463,6 @@ HostDB_InitEntry(PLDHashTable *table,
static const PLDHashTableOps gHostDB_ops = static const PLDHashTableOps gHostDB_ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
HostDB_HashKey, HostDB_HashKey,
HostDB_MatchEntry, HostDB_MatchEntry,
HostDB_MoveEntry, HostDB_MoveEntry,

View File

@ -85,8 +85,6 @@ StringCompare(PLDHashTable *table, const PLDHashEntryHdr *entry,
} }
static const PLDHashTableOps ops = { static const PLDHashTableOps ops = {
PL_DHashAllocTable,
PL_DHashFreeTable,
StringHash, StringHash,
StringCompare, StringCompare,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -52,8 +52,6 @@ static PLDHashNumber
static const PLDHashTableOps EntityToUnicodeOps = { static const PLDHashTableOps EntityToUnicodeOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashStringKey, PL_DHashStringKey,
matchNodeString, matchNodeString,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -62,8 +60,6 @@ static const PLDHashTableOps EntityToUnicodeOps = {
}; };
static const PLDHashTableOps UnicodeToEntityOps = { static const PLDHashTableOps UnicodeToEntityOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
hashUnicodeValue, hashUnicodeValue,
matchNodeUnicode, matchNodeUnicode,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -140,8 +140,6 @@ struct ResourceHashEntry : public PLDHashEntryHdr {
}; };
static const PLDHashTableOps gResourceTableOps = { static const PLDHashTableOps gResourceTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
ResourceHashEntry::HashKey, ResourceHashEntry::HashKey,
ResourceHashEntry::MatchEntry, ResourceHashEntry::MatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -177,8 +175,6 @@ struct LiteralHashEntry : public PLDHashEntryHdr {
}; };
static const PLDHashTableOps gLiteralTableOps = { static const PLDHashTableOps gLiteralTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
LiteralHashEntry::HashKey, LiteralHashEntry::HashKey,
LiteralHashEntry::MatchEntry, LiteralHashEntry::MatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -213,8 +209,6 @@ struct IntHashEntry : public PLDHashEntryHdr {
}; };
static const PLDHashTableOps gIntTableOps = { static const PLDHashTableOps gIntTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
IntHashEntry::HashKey, IntHashEntry::HashKey,
IntHashEntry::MatchEntry, IntHashEntry::MatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -253,8 +247,6 @@ struct DateHashEntry : public PLDHashEntryHdr {
}; };
static const PLDHashTableOps gDateTableOps = { static const PLDHashTableOps gDateTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
DateHashEntry::HashKey, DateHashEntry::HashKey,
DateHashEntry::MatchEntry, DateHashEntry::MatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -372,8 +364,6 @@ struct BlobHashEntry : public PLDHashEntryHdr {
}; };
static const PLDHashTableOps gBlobTableOps = { static const PLDHashTableOps gBlobTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
BlobHashEntry::HashKey, BlobHashEntry::HashKey,
BlobHashEntry::MatchEntry, BlobHashEntry::MatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -80,8 +80,6 @@ RequestMapInitEntry(PLDHashTable *table, PLDHashEntryHdr *hdr,
} }
static const PLDHashTableOps gMapOps = { static const PLDHashTableOps gMapOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
RequestMapMatchEntry, RequestMapMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -92,8 +92,6 @@ CompareCacheClearEntry(PLDHashTable *table, PLDHashEntryHdr *hdr)
} }
static const PLDHashTableOps gMapOps = { static const PLDHashTableOps gMapOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
CompareCacheMatchEntry, CompareCacheMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -33,8 +33,6 @@ ObjectSetInitEntry(PLDHashTable *table, PLDHashEntryHdr *hdr,
} }
static const PLDHashTableOps gSetOps = { static const PLDHashTableOps gSetOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
ObjectSetMatchEntry, ObjectSetMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -114,8 +114,6 @@ nsDocLoader::nsDocLoader()
static const PLDHashTableOps hash_table_ops = static const PLDHashTableOps hash_table_ops =
{ {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
PL_DHashMatchEntryStub, PL_DHashMatchEntryStub,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -801,8 +801,6 @@ PtrToNodeMatchEntry(PLDHashTable* aTable,
} }
static PLDHashTableOps PtrNodeOps = { static PLDHashTableOps PtrNodeOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
PtrToNodeMatchEntry, PtrToNodeMatchEntry,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -288,8 +288,6 @@ AtomTableInitEntry(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
static const PLDHashTableOps AtomTableOps = { static const PLDHashTableOps AtomTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
AtomTableGetHash, AtomTableGetHash,
AtomTableMatchKey, AtomTableMatchKey,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -50,8 +50,6 @@ ArenaStrdup(const nsAFlatCString& aString, PLArenaPool* aArena)
} }
static const struct PLDHashTableOps property_HashTableOps = { static const struct PLDHashTableOps property_HashTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashStringKey, PL_DHashStringKey,
PL_DHashMatchStringKey, PL_DHashMatchStringKey,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -94,8 +94,6 @@ caseInsensitiveStringHashKey(PLDHashTable* aTable, const void* aKey)
} }
static const struct PLDHashTableOps nametable_CaseInsensitiveHashTableOps = { static const struct PLDHashTableOps nametable_CaseInsensitiveHashTableOps = {
PL_DHashAllocTable,
PL_DHashFreeTable,
caseInsensitiveStringHashKey, caseInsensitiveStringHashKey,
matchNameKeysCaseInsensitive, matchNameKeysCaseInsensitive,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,

View File

@ -419,8 +419,6 @@ nsTHashtable<EntryType>::Init(uint32_t aInitLength)
{ {
static const PLDHashTableOps sOps = static const PLDHashTableOps sOps =
{ {
::PL_DHashAllocTable,
::PL_DHashFreeTable,
s_HashKey, s_HashKey,
s_MatchEntry, s_MatchEntry,
EntryType::ALLOW_MEMMOVE ? ::PL_DHashMoveEntryStub : s_CopyEntry, EntryType::ALLOW_MEMMOVE ? ::PL_DHashMoveEntryStub : s_CopyEntry,

View File

@ -68,18 +68,6 @@
using namespace mozilla; using namespace mozilla;
void*
PL_DHashAllocTable(PLDHashTable* aTable, uint32_t aNBytes)
{
return malloc(aNBytes);
}
void
PL_DHashFreeTable(PLDHashTable* aTable, void* aPtr)
{
free(aPtr);
}
PLDHashNumber PLDHashNumber
PL_DHashStringKey(PLDHashTable* aTable, const void* aKey) PL_DHashStringKey(PLDHashTable* aTable, const void* aKey)
{ {
@ -158,8 +146,6 @@ PL_DHashFreeStringKey(PLDHashTable* aTable, PLDHashEntryHdr* aEntry)
} }
static const PLDHashTableOps stub_ops = { static const PLDHashTableOps stub_ops = {
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
PL_DHashMatchEntryStub, PL_DHashMatchEntryStub,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
@ -185,13 +171,13 @@ PLDHashTable*
PL_NewDHashTable(const PLDHashTableOps* aOps, uint32_t aEntrySize, PL_NewDHashTable(const PLDHashTableOps* aOps, uint32_t aEntrySize,
uint32_t aLength) uint32_t aLength)
{ {
PLDHashTable* table = (PLDHashTable*)aOps->allocTable(NULL, sizeof(*table)); PLDHashTable* table = (PLDHashTable*)malloc(sizeof(*table));
if (!table) { if (!table) {
return nullptr; return nullptr;
} }
if (!PL_DHashTableInit(table, aOps, aEntrySize, fallible_t(), aLength)) { if (!PL_DHashTableInit(table, aOps, aEntrySize, fallible_t(), aLength)) {
aOps->freeTable(NULL, table); free(table);
return nullptr; return nullptr;
} }
return table; return table;
@ -201,7 +187,7 @@ void
PL_DHashTableDestroy(PLDHashTable* aTable) PL_DHashTableDestroy(PLDHashTable* aTable)
{ {
PL_DHashTableFinish(aTable); PL_DHashTableFinish(aTable);
aTable->ops->freeTable(NULL, aTable); free(aTable);
} }
/* /*
@ -263,7 +249,7 @@ PLDHashTable::Init(const PLDHashTableOps* aOps,
return false; // overflowed return false; // overflowed
} }
mEntryStore = (char*)aOps->allocTable(this, nbytes); mEntryStore = (char*)malloc(nbytes);
if (!mEntryStore) { if (!mEntryStore) {
return false; return false;
} }
@ -352,7 +338,7 @@ PLDHashTable::Finish()
MOZ_ASSERT(RECURSION_LEVEL_SAFE_TO_FINISH(this)); MOZ_ASSERT(RECURSION_LEVEL_SAFE_TO_FINISH(this));
/* Free entry storage last. */ /* Free entry storage last. */
ops->freeTable(this, mEntryStore); free(mEntryStore);
} }
void void
@ -495,7 +481,7 @@ PLDHashTable::ChangeTable(int aDeltaLog2)
return false; // overflowed return false; // overflowed
} }
char* newEntryStore = (char*)ops->allocTable(this, nbytes); char* newEntryStore = (char*)malloc(nbytes);
if (!newEntryStore) { if (!newEntryStore) {
return false; return false;
} }
@ -534,7 +520,7 @@ PLDHashTable::ChangeTable(int aDeltaLog2)
oldEntryAddr += mEntrySize; oldEntryAddr += mEntrySize;
} }
ops->freeTable(this, oldEntryStore); free(oldEntryStore);
return true; return true;
} }

View File

@ -299,15 +299,6 @@ private:
bool ChangeTable(int aDeltaLog2); bool ChangeTable(int aDeltaLog2);
}; };
/*
* Table space at mEntryStore is allocated and freed using these callbacks.
* The allocator should return null on error only (not if called with aNBytes
* equal to 0; but note that pldhash.c code will never call with 0 aNBytes).
*/
typedef void* (*PLDHashAllocTable)(PLDHashTable* aTable, uint32_t aNBytes);
typedef void (*PLDHashFreeTable)(PLDHashTable* aTable, void* aPtr);
/* /*
* Compute the hash code for a given key to be looked up, added, or removed * Compute the hash code for a given key to be looked up, added, or removed
* from aTable. A hash code may have any PLDHashNumber value. * from aTable. A hash code may have any PLDHashNumber value.
@ -352,13 +343,11 @@ typedef bool (*PLDHashInitEntry)(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
const void* aKey); const void* aKey);
/* /*
* Finally, the "vtable" structure for PLDHashTable. The first six hooks * Finally, the "vtable" structure for PLDHashTable. The first four hooks
* must be provided by implementations; they're called unconditionally by the * must be provided by implementations; they're called unconditionally by the
* generic pldhash.c code. Hooks after these may be null. * generic pldhash.c code. Hooks after these may be null.
* *
* Summary of allocation-related hook usage with C++ placement new emphasis: * Summary of allocation-related hook usage with C++ placement new emphasis:
* allocTable Allocate raw bytes with malloc, no ctors run.
* freeTable Free raw bytes with free, no dtors run.
* initEntry Call placement new using default key-based ctor. * initEntry Call placement new using default key-based ctor.
* Return true on success, false on error. * Return true on success, false on error.
* moveEntry Call placement new using copy ctor, run dtor on old * moveEntry Call placement new using copy ctor, run dtor on old
@ -379,8 +368,6 @@ typedef bool (*PLDHashInitEntry)(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
struct PLDHashTableOps struct PLDHashTableOps
{ {
/* Mandatory hooks. All implementations must provide these. */ /* Mandatory hooks. All implementations must provide these. */
PLDHashAllocTable allocTable;
PLDHashFreeTable freeTable;
PLDHashHashKey hashKey; PLDHashHashKey hashKey;
PLDHashMatchEntry matchEntry; PLDHashMatchEntry matchEntry;
PLDHashMoveEntry moveEntry; PLDHashMoveEntry moveEntry;
@ -393,9 +380,6 @@ struct PLDHashTableOps
/* /*
* Default implementations for the above ops. * Default implementations for the above ops.
*/ */
void* PL_DHashAllocTable(PLDHashTable* aTable, uint32_t aNBytes);
void PL_DHashFreeTable(PLDHashTable* aTable, void* aPtr);
PLDHashNumber PL_DHashStringKey(PLDHashTable* aTable, const void* aKey); PLDHashNumber PL_DHashStringKey(PLDHashTable* aTable, const void* aKey);
@ -433,10 +417,8 @@ void PL_DHashFreeStringKey(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);
const PLDHashTableOps* PL_DHashGetStubOps(void); const PLDHashTableOps* PL_DHashGetStubOps(void);
/* /*
* Dynamically allocate a new PLDHashTable using malloc, initialize it using * Dynamically allocate a new PLDHashTable, initialize it using
* PL_DHashTableInit, and return its address. Return null on malloc failure. * PL_DHashTableInit, and return its address. Return null on allocation failure.
* Note that the entry storage at aTable->mEntryStore will be allocated using
* the aOps->allocTable callback.
*/ */
PLDHashTable* PL_NewDHashTable( PLDHashTable* PL_NewDHashTable(
const PLDHashTableOps* aOps, uint32_t aEntrySize, const PLDHashTableOps* aOps, uint32_t aEntrySize,
@ -490,9 +472,9 @@ void PL_DHashTableFinish(PLDHashTable* aTable);
* entry = PL_DHashTableOperate(table, key, PL_DHASH_ADD); * entry = PL_DHashTableOperate(table, key, PL_DHASH_ADD);
* *
* If entry is null upon return, then either the table is severely overloaded, * If entry is null upon return, then either the table is severely overloaded,
* and memory can't be allocated for entry storage via aTable->ops->allocTable; * and memory can't be allocated for entry storage. Or if
* Or if aTable->ops->initEntry is non-null, the aTable->ops->initEntry op may * aTable->ops->initEntry is non-null, the aTable->ops->initEntry op may have
* have returned false. * returned false.
* *
* Otherwise, aEntry->keyHash has been set so that PL_DHASH_ENTRY_IS_BUSY(entry) * Otherwise, aEntry->keyHash has been set so that PL_DHASH_ENTRY_IS_BUSY(entry)
* is true, and it is up to the caller to initialize the key and value parts * is true, and it is up to the caller to initialize the key and value parts

View File

@ -80,8 +80,6 @@ hash(PLDHashTable *table, const void *key)
static bool test_pldhash_grow_to_max_capacity() static bool test_pldhash_grow_to_max_capacity()
{ {
static const PLDHashTableOps ops = { static const PLDHashTableOps ops = {
PL_DHashAllocTable,
PL_DHashFreeTable,
hash, hash,
PL_DHashMatchEntryStub, PL_DHashMatchEntryStub,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,