From 43fc26b69913e53849a855f2fadf40ed70052f01 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 13 Jan 2015 19:02:35 -0800 Subject: [PATCH] Bug 1120476 (part 4) - Remove PLDHashTableOps::finalize. r=froydnj. --- dom/base/nsContentList.cpp | 6 ++--- dom/base/nsContentUtils.cpp | 1 - dom/base/nsDocument.cpp | 1 - dom/base/nsScriptNameSpaceManager.cpp | 1 - dom/xul/XULDocument.cpp | 1 - .../commandhandler/nsCommandParams.cpp | 3 +-- gfx/thebes/gfxFT2FontList.cpp | 1 - js/xpconnect/src/XPCMaps.cpp | 15 ++++------- layout/base/nsFrameManager.cpp | 1 - layout/style/nsCSSRuleProcessor.cpp | 9 ------- layout/style/nsHTMLStyleSheet.cpp | 2 -- layout/style/nsRuleNode.cpp | 1 - layout/tables/SpanningCellSorter.cpp | 1 - modules/libpref/prefapi.cpp | 1 - netwerk/base/src/nsLoadGroup.cpp | 1 - netwerk/cache/nsCacheEntry.cpp | 3 +-- netwerk/cache/nsDiskCacheBinding.cpp | 3 +-- netwerk/dns/nsHostResolver.cpp | 1 - netwerk/protocol/http/nsHttp.cpp | 1 - parser/htmlparser/nsHTMLEntities.cpp | 2 -- rdf/base/nsRDFService.cpp | 5 ---- .../boot/src/nsSecureBrowserUIImpl.cpp | 1 - security/manager/ssl/src/nsCertTree.cpp | 1 - security/manager/ssl/src/nsNSSShutDown.cpp | 1 - uriloader/base/nsDocLoader.cpp | 1 - xpcom/base/nsCycleCollector.cpp | 1 - xpcom/ds/nsAtomTable.cpp | 1 - xpcom/ds/nsPersistentProperties.cpp | 1 - xpcom/ds/nsStaticNameTable.cpp | 1 - xpcom/glue/nsTHashtable.h | 1 - xpcom/glue/pldhash.cpp | 9 ------- xpcom/glue/pldhash.h | 26 +++++-------------- xpcom/tests/TestPLDHash.cpp | 1 - 33 files changed, 17 insertions(+), 88 deletions(-) diff --git a/dom/base/nsContentList.cpp b/dom/base/nsContentList.cpp index 3398e16769b3..0021011bdb43 100644 --- a/dom/base/nsContentList.cpp +++ b/dom/base/nsContentList.cpp @@ -213,8 +213,7 @@ NS_GetContentList(nsINode* aRootNode, ContentListHashtableHashKey, ContentListHashtableMatchEntry, PL_DHashMoveEntryStub, - PL_DHashClearEntryStub, - PL_DHashFinalizeStub + PL_DHashClearEntryStub }; // Initialize the hashtable if needed. @@ -326,8 +325,7 @@ GetFuncStringContentList(nsINode* aRootNode, FuncStringContentListHashtableHashKey, FuncStringContentListHashtableMatchEntry, PL_DHashMoveEntryStub, - PL_DHashClearEntryStub, - PL_DHashFinalizeStub + PL_DHashClearEntryStub }; // Initialize the hashtable if needed. diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index b135d4b184c6..ac4bb1d93e32 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -485,7 +485,6 @@ nsContentUtils::Init() PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, EventListenerManagerHashClearEntry, - PL_DHashFinalizeStub, EventListenerManagerHashInitEntry }; diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 794dbfdc9a33..483465c0b256 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -3978,7 +3978,6 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc) PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, SubDocClearEntry, - PL_DHashFinalizeStub, SubDocInitEntry }; diff --git a/dom/base/nsScriptNameSpaceManager.cpp b/dom/base/nsScriptNameSpaceManager.cpp index c3b6a34582e5..61693bd1e9fd 100644 --- a/dom/base/nsScriptNameSpaceManager.cpp +++ b/dom/base/nsScriptNameSpaceManager.cpp @@ -326,7 +326,6 @@ nsScriptNameSpaceManager::Init() GlobalNameHashMatchEntry, PL_DHashMoveEntryStub, GlobalNameHashClearEntry, - PL_DHashFinalizeStub, GlobalNameHashInitEntry }; diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index d1b948a16d29..dd5f816ba7ee 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -766,7 +766,6 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, ClearBroadcasterMapEntry, - PL_DHashFinalizeStub, nullptr }; diff --git a/embedding/components/commandhandler/nsCommandParams.cpp b/embedding/components/commandhandler/nsCommandParams.cpp index 931446e8c33a..e476b3e72f4f 100644 --- a/embedding/components/commandhandler/nsCommandParams.cpp +++ b/embedding/components/commandhandler/nsCommandParams.cpp @@ -21,8 +21,7 @@ const PLDHashTableOps nsCommandParams::sHashOps = HashKey, HashMatchEntry, HashMoveEntry, - HashClearEntry, - PL_DHashFinalizeStub + HashClearEntry }; NS_IMPL_ISUPPORTS(nsCommandParams, nsICommandParams) diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 718cc3457def..6c2f8c7a990e 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -628,7 +628,6 @@ public: HashMatchEntry, MoveEntry, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; diff --git a/js/xpconnect/src/XPCMaps.cpp b/js/xpconnect/src/XPCMaps.cpp index 372180342848..342f9ea8d8bd 100644 --- a/js/xpconnect/src/XPCMaps.cpp +++ b/js/xpconnect/src/XPCMaps.cpp @@ -217,8 +217,7 @@ const struct PLDHashTableOps IID2WrappedJSClassMap::Entry::sOps = HashIIDPtrKey, MatchIIDPtrKey, PL_DHashMoveEntryStub, - PL_DHashClearEntryStub, - PL_DHashFinalizeStub + PL_DHashClearEntryStub }; // static @@ -254,8 +253,7 @@ const struct PLDHashTableOps IID2NativeInterfaceMap::Entry::sOps = HashIIDPtrKey, MatchIIDPtrKey, PL_DHashMoveEntryStub, - PL_DHashClearEntryStub, - PL_DHashFinalizeStub + PL_DHashClearEntryStub }; // static @@ -459,8 +457,7 @@ const struct PLDHashTableOps NativeSetMap::Entry::sOps = HashNativeKey, Match, PL_DHashMoveEntryStub, - PL_DHashClearEntryStub, - PL_DHashFinalizeStub + PL_DHashClearEntryStub }; // static @@ -526,8 +523,7 @@ const struct PLDHashTableOps IID2ThisTranslatorMap::Entry::sOps = HashIIDPtrKey, Match, PL_DHashMoveEntryStub, - Clear, - PL_DHashFinalizeStub + Clear }; // static @@ -605,8 +601,7 @@ const struct PLDHashTableOps XPCNativeScriptableSharedMap::Entry::sOps = Hash, Match, PL_DHashMoveEntryStub, - PL_DHashClearEntryStub, - PL_DHashFinalizeStub + PL_DHashClearEntryStub }; // static diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index 6f96f1331ef9..027396731127 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -75,7 +75,6 @@ static const PLDHashTableOps PlaceholderMapOps = { PlaceholderMapMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 527507f5d2b7..c8fedcfc48bd 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -368,7 +368,6 @@ static const PLDHashTableOps RuleHash_TagTable_Ops = { RuleHash_TagTable_MatchEntry, RuleHash_TagTable_MoveEntry, RuleHash_TagTable_ClearEntry, - PL_DHashFinalizeStub, RuleHash_TagTable_InitEntry }; @@ -381,7 +380,6 @@ static const RuleHashTableOps RuleHash_ClassTable_CSOps = { RuleHash_CSMatchEntry, RuleHash_MoveEntry, RuleHash_ClearEntry, - PL_DHashFinalizeStub, RuleHash_InitEntry }, RuleHash_ClassTable_GetKey @@ -396,7 +394,6 @@ static const RuleHashTableOps RuleHash_ClassTable_CIOps = { RuleHash_CIMatchEntry, RuleHash_MoveEntry, RuleHash_ClearEntry, - PL_DHashFinalizeStub, RuleHash_InitEntry }, RuleHash_ClassTable_GetKey @@ -411,7 +408,6 @@ static const RuleHashTableOps RuleHash_IdTable_CSOps = { RuleHash_CSMatchEntry, RuleHash_MoveEntry, RuleHash_ClearEntry, - PL_DHashFinalizeStub, RuleHash_InitEntry }, RuleHash_IdTable_GetKey @@ -426,7 +422,6 @@ static const RuleHashTableOps RuleHash_IdTable_CIOps = { RuleHash_CIMatchEntry, RuleHash_MoveEntry, RuleHash_ClearEntry, - PL_DHashFinalizeStub, RuleHash_InitEntry }, RuleHash_IdTable_GetKey @@ -439,7 +434,6 @@ static const PLDHashTableOps RuleHash_NameSpaceTable_Ops = { RuleHash_NameSpaceTable_MatchEntry, RuleHash_MoveEntry, RuleHash_ClearEntry, - PL_DHashFinalizeStub, RuleHash_InitEntry }; @@ -899,7 +893,6 @@ static const PLDHashTableOps AtomSelector_CSOps = { PL_DHashMatchEntryStub, AtomSelector_MoveEntry, AtomSelector_ClearEntry, - PL_DHashFinalizeStub, AtomSelector_InitEntry }; @@ -912,7 +905,6 @@ static const RuleHashTableOps AtomSelector_CIOps = { RuleHash_CIMatchEntry, AtomSelector_MoveEntry, AtomSelector_ClearEntry, - PL_DHashFinalizeStub, AtomSelector_InitEntry }, AtomSelector_GetKey @@ -3351,7 +3343,6 @@ static const PLDHashTableOps gRulesByWeightOps = { MatchWeightEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, InitWeightEntry }; diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index 4a9ce63092e7..1184501ac7c2 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -175,7 +175,6 @@ static const PLDHashTableOps MappedAttrTable_Ops = { MappedAttrTable_MatchEntry, PL_DHashMoveEntryStub, MappedAttrTable_ClearEntry, - PL_DHashFinalizeStub, nullptr }; @@ -232,7 +231,6 @@ static const PLDHashTableOps LangRuleTable_Ops = { LangRuleTable_MatchEntry, PL_DHashMoveEntryStub, LangRuleTable_ClearEntry, - PL_DHashFinalizeStub, LangRuleTable_InitEntry }; diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index c06cdf859181..eb63ba2306e0 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -120,7 +120,6 @@ nsRuleNode::ChildrenHashOps = { ChildrenHashMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; diff --git a/layout/tables/SpanningCellSorter.cpp b/layout/tables/SpanningCellSorter.cpp index 5454195652da..28c68e53da67 100644 --- a/layout/tables/SpanningCellSorter.cpp +++ b/layout/tables/SpanningCellSorter.cpp @@ -39,7 +39,6 @@ SpanningCellSorter::HashTableOps = { HashTableMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; diff --git a/modules/libpref/prefapi.cpp b/modules/libpref/prefapi.cpp index 8ab57e104803..51424ff285df 100644 --- a/modules/libpref/prefapi.cpp +++ b/modules/libpref/prefapi.cpp @@ -83,7 +83,6 @@ static PLDHashTableOps pref_HashTableOps = { matchPrefEntry, PL_DHashMoveEntryStub, clearPrefEntry, - PL_DHashFinalizeStub, nullptr, }; diff --git a/netwerk/base/src/nsLoadGroup.cpp b/netwerk/base/src/nsLoadGroup.cpp index 8719f0e95b34..153590baae6e 100644 --- a/netwerk/base/src/nsLoadGroup.cpp +++ b/netwerk/base/src/nsLoadGroup.cpp @@ -1162,7 +1162,6 @@ nsresult nsLoadGroup::Init() RequestHashMatchEntry, PL_DHashMoveEntryStub, RequestHashClearEntry, - PL_DHashFinalizeStub, RequestHashInitEntry }; diff --git a/netwerk/cache/nsCacheEntry.cpp b/netwerk/cache/nsCacheEntry.cpp index fb10f7d0c57b..bd8b8a24c558 100644 --- a/netwerk/cache/nsCacheEntry.cpp +++ b/netwerk/cache/nsCacheEntry.cpp @@ -382,8 +382,7 @@ nsCacheEntryHashTable::ops = HashKey, MatchEntry, MoveEntry, - ClearEntry, - PL_DHashFinalizeStub + ClearEntry }; diff --git a/netwerk/cache/nsDiskCacheBinding.cpp b/netwerk/cache/nsDiskCacheBinding.cpp index d6377e104365..24b6c48831f7 100644 --- a/netwerk/cache/nsDiskCacheBinding.cpp +++ b/netwerk/cache/nsDiskCacheBinding.cpp @@ -129,8 +129,7 @@ const PLDHashTableOps nsDiskCacheBindery::ops = HashKey, MatchEntry, MoveEntry, - ClearEntry, - PL_DHashFinalizeStub + ClearEntry }; diff --git a/netwerk/dns/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp index 5e6ad5cbad6b..165ce2d0254a 100644 --- a/netwerk/dns/nsHostResolver.cpp +++ b/netwerk/dns/nsHostResolver.cpp @@ -469,7 +469,6 @@ static const PLDHashTableOps gHostDB_ops = HostDB_MatchEntry, HostDB_MoveEntry, HostDB_ClearEntry, - PL_DHashFinalizeStub, HostDB_InitEntry, }; diff --git a/netwerk/protocol/http/nsHttp.cpp b/netwerk/protocol/http/nsHttp.cpp index c0f2df3b2eca..45154f33ef62 100644 --- a/netwerk/protocol/http/nsHttp.cpp +++ b/netwerk/protocol/http/nsHttp.cpp @@ -91,7 +91,6 @@ static const PLDHashTableOps ops = { StringCompare, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; diff --git a/parser/htmlparser/nsHTMLEntities.cpp b/parser/htmlparser/nsHTMLEntities.cpp index f655a8d4ea4f..68ca4135d15e 100644 --- a/parser/htmlparser/nsHTMLEntities.cpp +++ b/parser/htmlparser/nsHTMLEntities.cpp @@ -58,7 +58,6 @@ static const PLDHashTableOps EntityToUnicodeOps = { matchNodeString, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr, }; @@ -69,7 +68,6 @@ static const PLDHashTableOps UnicodeToEntityOps = { matchNodeUnicode, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr, }; diff --git a/rdf/base/nsRDFService.cpp b/rdf/base/nsRDFService.cpp index 6f7bf8154ee9..5c34b8895e85 100644 --- a/rdf/base/nsRDFService.cpp +++ b/rdf/base/nsRDFService.cpp @@ -146,7 +146,6 @@ static const PLDHashTableOps gResourceTableOps = { ResourceHashEntry::MatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; @@ -184,7 +183,6 @@ static const PLDHashTableOps gLiteralTableOps = { LiteralHashEntry::MatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; @@ -221,7 +219,6 @@ static const PLDHashTableOps gIntTableOps = { IntHashEntry::MatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; @@ -262,7 +259,6 @@ static const PLDHashTableOps gDateTableOps = { DateHashEntry::MatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; @@ -382,7 +378,6 @@ static const PLDHashTableOps gBlobTableOps = { BlobHashEntry::MatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index 016de7e9a135..f064cc43e62c 100644 --- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -86,7 +86,6 @@ static const PLDHashTableOps gMapOps = { RequestMapMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, RequestMapInitEntry }; diff --git a/security/manager/ssl/src/nsCertTree.cpp b/security/manager/ssl/src/nsCertTree.cpp index 5775a3f7bc15..58d6265510e6 100644 --- a/security/manager/ssl/src/nsCertTree.cpp +++ b/security/manager/ssl/src/nsCertTree.cpp @@ -98,7 +98,6 @@ static const PLDHashTableOps gMapOps = { CompareCacheMatchEntry, PL_DHashMoveEntryStub, CompareCacheClearEntry, - PL_DHashFinalizeStub, CompareCacheInitEntry }; diff --git a/security/manager/ssl/src/nsNSSShutDown.cpp b/security/manager/ssl/src/nsNSSShutDown.cpp index 630947d85958..1f42a0674455 100644 --- a/security/manager/ssl/src/nsNSSShutDown.cpp +++ b/security/manager/ssl/src/nsNSSShutDown.cpp @@ -39,7 +39,6 @@ static const PLDHashTableOps gSetOps = { ObjectSetMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, ObjectSetInitEntry }; diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index 22752da0d825..7eb458ed15cc 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -120,7 +120,6 @@ nsDocLoader::nsDocLoader() PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, RequestInfoHashClearEntry, - PL_DHashFinalizeStub, RequestInfoHashInitEntry }; diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 78d2a12febf0..f7b4f4b5391c 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -807,7 +807,6 @@ static PLDHashTableOps PtrNodeOps = { PtrToNodeMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index 05a506b02cc1..f8a698f9334b 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -294,7 +294,6 @@ static const PLDHashTableOps AtomTableOps = { AtomTableMatchKey, PL_DHashMoveEntryStub, AtomTableClearEntry, - PL_DHashFinalizeStub, AtomTableInitEntry }; diff --git a/xpcom/ds/nsPersistentProperties.cpp b/xpcom/ds/nsPersistentProperties.cpp index 28e6b0110b54..6b9f28cc8421 100644 --- a/xpcom/ds/nsPersistentProperties.cpp +++ b/xpcom/ds/nsPersistentProperties.cpp @@ -56,7 +56,6 @@ static const struct PLDHashTableOps property_HashTableOps = { PL_DHashMatchStringKey, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr, }; diff --git a/xpcom/ds/nsStaticNameTable.cpp b/xpcom/ds/nsStaticNameTable.cpp index 576271573e63..df18d75fc564 100644 --- a/xpcom/ds/nsStaticNameTable.cpp +++ b/xpcom/ds/nsStaticNameTable.cpp @@ -100,7 +100,6 @@ static const struct PLDHashTableOps nametable_CaseInsensitiveHashTableOps = { matchNameKeysCaseInsensitive, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr, }; diff --git a/xpcom/glue/nsTHashtable.h b/xpcom/glue/nsTHashtable.h index 3ca97319f2a2..c01c71bf43f3 100644 --- a/xpcom/glue/nsTHashtable.h +++ b/xpcom/glue/nsTHashtable.h @@ -425,7 +425,6 @@ nsTHashtable::Init(uint32_t aInitLength) s_MatchEntry, EntryType::ALLOW_MEMMOVE ? ::PL_DHashMoveEntryStub : s_CopyEntry, s_ClearEntry, - ::PL_DHashFinalizeStub, s_InitEntry }; diff --git a/xpcom/glue/pldhash.cpp b/xpcom/glue/pldhash.cpp index efe626dac26d..df2ecc74d2e0 100644 --- a/xpcom/glue/pldhash.cpp +++ b/xpcom/glue/pldhash.cpp @@ -157,11 +157,6 @@ PL_DHashFreeStringKey(PLDHashTable* aTable, PLDHashEntryHdr* aEntry) aTable->FreeStringKey(aEntry); } -void -PL_DHashFinalizeStub(PLDHashTable* aTable) -{ -} - static const PLDHashTableOps stub_ops = { PL_DHashAllocTable, PL_DHashFreeTable, @@ -169,7 +164,6 @@ static const PLDHashTableOps stub_ops = { PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr }; @@ -342,9 +336,6 @@ PLDHashTable::Finish() { INCREMENT_RECURSION_LEVEL(this); - /* Call finalize before clearing entries, so it can enumerate them. */ - ops->finalize(this); - /* Clear any remaining live entries. */ char* entryAddr = mEntryStore; char* entryLimit = entryAddr + Capacity() * mEntrySize; diff --git a/xpcom/glue/pldhash.h b/xpcom/glue/pldhash.h index 8aa1947bc729..a7ffb59c6e4a 100644 --- a/xpcom/glue/pldhash.h +++ b/xpcom/glue/pldhash.h @@ -342,13 +342,6 @@ typedef void (*PLDHashMoveEntry)(PLDHashTable* aTable, typedef void (*PLDHashClearEntry)(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); -/* - * Called when a table (whether allocated dynamically by itself, or nested in - * a larger structure, or allocated on the stack) is finished. This callback - * allows aTable->ops-specific code to finalize aTable->data. - */ -typedef void (*PLDHashFinalize)(PLDHashTable* aTable); - /* * Initialize a new entry, apart from keyHash. This function is called when * PL_DHashTableOperate's PL_DHASH_ADD case finds no existing entry for the @@ -360,7 +353,7 @@ typedef bool (*PLDHashInitEntry)(PLDHashTable* aTable, PLDHashEntryHdr* aEntry, const void* aKey); /* - * Finally, the "vtable" structure for PLDHashTable. The first eight hooks + * Finally, the "vtable" structure for PLDHashTable. The first six hooks * must be provided by implementations; they're called unconditionally by the * generic pldhash.c code. Hooks after these may be null. * @@ -372,8 +365,6 @@ typedef bool (*PLDHashInitEntry)(PLDHashTable* aTable, PLDHashEntryHdr* aEntry, * moveEntry Call placement new using copy ctor, run dtor on old * entry storage. * clearEntry Run dtor on entry. - * finalize Stub unless aTable->data was initialized and needs to - * be finalized. * * Note the reason why initEntry is optional: the default hooks (stubs) clear * entry storage: On successful PL_DHashTableOperate(tbl, key, PL_DHASH_ADD), @@ -395,7 +386,6 @@ struct PLDHashTableOps PLDHashMatchEntry matchEntry; PLDHashMoveEntry moveEntry; PLDHashClearEntry clearEntry; - PLDHashFinalize finalize; /* Optional hooks start here. If null, these are not called. */ PLDHashInitEntry initEntry; @@ -436,8 +426,6 @@ void PL_DHashClearEntryStub(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); void PL_DHashFreeStringKey(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); -void PL_DHashFinalizeStub(PLDHashTable* aTable); - /* * If you use PLDHashEntryStub or a subclass of it as your entry struct, and * if your entries move via memcpy and clear via memset(0), you can use these @@ -456,8 +444,9 @@ PLDHashTable* PL_NewDHashTable( uint32_t aLength = PL_DHASH_DEFAULT_INITIAL_LENGTH); /* - * Finalize aTable's data, free its entry storage (via aTable->ops->freeTable), - * and return the memory starting at aTable to the malloc heap. + * Free |aTable|'s entry storage and |aTable| itself (both via + * aTable->ops->freeTable). Use this function to destroy a PLDHashTable that + * was allocated on the heap via PL_NewDHashTable(). */ void PL_DHashTableDestroy(PLDHashTable* aTable); @@ -483,10 +472,9 @@ MOZ_WARN_UNUSED_RESULT bool PL_DHashTableInit( uint32_t aLength = PL_DHASH_DEFAULT_INITIAL_LENGTH); /* - * Finalize aTable's data, free its entry storage using aTable->ops->freeTable, - * and leave its members unchanged from their last live values (which leaves - * pointers dangling). If you want to burn cycles clearing aTable, it's up to - * your code to call memset. + * Free |aTable|'s entry storage (via aTable->ops->freeTable). Use this function + * to destroy a PLDHashTable that is allocated on the stack or in static memory + * and was created via PL_DHashTableInit(). */ void PL_DHashTableFinish(PLDHashTable* aTable); diff --git a/xpcom/tests/TestPLDHash.cpp b/xpcom/tests/TestPLDHash.cpp index 19b9b7e5877d..81a8aa91f340 100644 --- a/xpcom/tests/TestPLDHash.cpp +++ b/xpcom/tests/TestPLDHash.cpp @@ -86,7 +86,6 @@ static bool test_pldhash_grow_to_max_capacity() PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, - PL_DHashFinalizeStub, nullptr };