From 30f83072c5246cf58ecd26744cc6217df6bd1caa Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Tue, 27 Mar 2007 15:33:45 +0000 Subject: [PATCH] Remove unused getKey callback from PLDHashTableOps/JSDHashTableOps. b=374906 r=bsmedberg git-svn-id: svn://10.0.0.236/trunk@222462 18797224-902f-48f8-a5cc-f745e15eee43 --- .../caps/include/nsScriptSecurityManager.h | 2 - mozilla/chrome/src/nsChromeRegistry.cpp | 8 -- mozilla/chrome/src/nsChromeRegistry.h | 1 - mozilla/content/base/src/nsContentList.cpp | 8 -- mozilla/content/base/src/nsContentUtils.cpp | 1 - mozilla/content/base/src/nsDocument.cpp | 1 - .../html/document/src/nsHTMLDocument.cpp | 9 -- mozilla/content/xbl/src/nsBindingManager.cpp | 1 - .../xul/document/src/nsXULDocument.cpp | 1 - .../xul/templates/src/nsContentSupportMap.cpp | 20 +--- .../xul/templates/src/nsContentSupportMap.h | 5 - .../dom/src/base/nsScriptNameSpaceManager.cpp | 9 -- .../commandhandler/src/nsCommandParams.cpp | 9 -- .../commandhandler/src/nsCommandParams.h | 2 - .../xpcom/src/nsJavaXPCOMBindingUtils.cpp | 18 +-- mozilla/js/src/jscntxt.c | 9 -- mozilla/js/src/jsdhash.c | 9 -- mozilla/js/src/jsdhash.h | 25 +--- mozilla/js/src/jsparse.c | 1 - mozilla/js/src/jsscope.c | 1 - mozilla/js/src/xpconnect/src/xpcmaps.cpp | 11 -- mozilla/js/src/xpconnect/src/xpcmaps.h | 3 - mozilla/layout/base/nsFrameManager.cpp | 19 ---- mozilla/layout/style/nsCSSRuleProcessor.cpp | 107 +++++++++++------- mozilla/layout/style/nsHTMLStyleSheet.cpp | 1 - mozilla/layout/style/nsRuleNode.cpp | 8 -- mozilla/layout/tables/SpanningCellSorter.cpp | 9 -- mozilla/layout/tables/SpanningCellSorter.h | 2 - .../mailnews/db/msgdb/public/nsMsgDatabase.h | 1 - .../mailnews/db/msgdb/src/nsMsgDatabase.cpp | 8 -- .../src/nsBayesianFilter.cpp | 1 - mozilla/modules/libpref/src/prefapi.cpp | 1 - .../modules/plugin/base/src/nsJSNPRuntime.cpp | 10 -- mozilla/netwerk/base/src/nsLoadGroup.cpp | 9 -- mozilla/netwerk/cache/src/nsCacheEntry.cpp | 8 -- mozilla/netwerk/cache/src/nsCacheEntry.h | 2 - .../netwerk/cache/src/nsDiskCacheBinding.cpp | 8 -- mozilla/netwerk/dns/src/nsHostResolver.cpp | 8 -- mozilla/netwerk/protocol/http/src/nsHttp.cpp | 1 - .../parser/htmlparser/src/nsHTMLEntities.cpp | 16 --- mozilla/rdf/base/src/nsRDFService.cpp | 40 ------- .../boot/src/nsSecureBrowserUIImpl.cpp | 8 -- .../security/manager/ssl/src/nsCertTree.cpp | 8 -- .../manager/ssl/src/nsNSSShutDown.cpp | 8 -- mozilla/uriloader/base/nsDocLoader.cpp | 1 - mozilla/widget/src/gtk/nsWindow.cpp | 1 - .../xpcom/components/nsComponentManager.cpp | 10 -- .../components/nsStaticComponentLoader.cpp | 12 +- mozilla/xpcom/ds/nsAtomTable.cpp | 11 +- mozilla/xpcom/ds/nsDoubleHashtable.h | 7 -- mozilla/xpcom/ds/nsHashtable.cpp | 1 - mozilla/xpcom/ds/nsPersistentProperties.cpp | 1 - mozilla/xpcom/ds/nsStaticNameTable.cpp | 21 +--- mozilla/xpcom/glue/nsTHashtable.h | 9 -- mozilla/xpcom/glue/pldhash.c | 9 -- mozilla/xpcom/glue/pldhash.h | 25 +--- mozilla/xpcom/io/nsFastLoadFile.cpp | 11 -- .../reflect/xptinfo/src/xptiWorkingSet.cpp | 14 --- 58 files changed, 95 insertions(+), 475 deletions(-) diff --git a/mozilla/caps/include/nsScriptSecurityManager.h b/mozilla/caps/include/nsScriptSecurityManager.h index 3810ce36b37..aaac3bbfbbb 100644 --- a/mozilla/caps/include/nsScriptSecurityManager.h +++ b/mozilla/caps/include/nsScriptSecurityManager.h @@ -245,7 +245,6 @@ InitClassPolicyEntry(PLDHashTable *table, { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashVoidPtrKeyStub, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, @@ -291,7 +290,6 @@ public: { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashStringKey, PL_DHashMatchStringKey, MoveClassPolicyEntry, diff --git a/mozilla/chrome/src/nsChromeRegistry.cpp b/mozilla/chrome/src/nsChromeRegistry.cpp index de87769f692..88c995da732 100644 --- a/mozilla/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/chrome/src/nsChromeRegistry.cpp @@ -339,13 +339,6 @@ nsChromeRegistry::PackageEntry::PackageEntry(const nsACString& aPackage) : { } -const void* -nsChromeRegistry::GetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - PackageEntry* pentry = NS_STATIC_CAST(PackageEntry*, entry); - return (nsACString*) &pentry->package; -} - PLHashNumber nsChromeRegistry::HashKey(PLDHashTable *table, const void *key) { @@ -383,7 +376,6 @@ const PLDHashTableOps nsChromeRegistry::kTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - GetKey, HashKey, MatchKey, PL_DHashMoveEntryStub, diff --git a/mozilla/chrome/src/nsChromeRegistry.h b/mozilla/chrome/src/nsChromeRegistry.h index dd9c6e84577..6c97354a385 100644 --- a/mozilla/chrome/src/nsChromeRegistry.h +++ b/mozilla/chrome/src/nsChromeRegistry.h @@ -196,7 +196,6 @@ public: }; private: - static const void* GetKey(PLDHashTable *table, PLDHashEntryHdr *entry); static PLDHashNumber HashKey(PLDHashTable *table, const void *key); static PRBool MatchKey(PLDHashTable *table, const PLDHashEntryHdr *entry, const void *key); diff --git a/mozilla/content/base/src/nsContentList.cpp b/mozilla/content/base/src/nsContentList.cpp index 0f6c322e914..1efc56502cc 100644 --- a/mozilla/content/base/src/nsContentList.cpp +++ b/mozilla/content/base/src/nsContentList.cpp @@ -186,13 +186,6 @@ struct ContentListHashEntry : public PLDHashEntryHdr nsContentList* mContentList; }; -PR_STATIC_CALLBACK(const void *) -ContentListHashtableGetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - ContentListHashEntry *e = NS_STATIC_CAST(ContentListHashEntry *, entry); - return e->mContentList->GetKey(); -} - PR_STATIC_CALLBACK(PLDHashNumber) ContentListHashtableHashKey(PLDHashTable *table, const void *key) { @@ -225,7 +218,6 @@ NS_GetContentList(nsINode* aRootNode, nsIAtom* aMatchAtom, { PL_DHashAllocTable, PL_DHashFreeTable, - ContentListHashtableGetKey, ContentListHashtableHashKey, ContentListHashtableMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/content/base/src/nsContentUtils.cpp b/mozilla/content/base/src/nsContentUtils.cpp index 00bccf85f8c..3ca8401a0f8 100644 --- a/mozilla/content/base/src/nsContentUtils.cpp +++ b/mozilla/content/base/src/nsContentUtils.cpp @@ -284,7 +284,6 @@ nsContentUtils::Init() { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashVoidPtrKeyStub, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index e07bdcdfb82..211d49db4d0 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -2043,7 +2043,6 @@ nsDocument::SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc) { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashVoidPtrKeyStub, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index ba78e692219..2911866e53e 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -274,14 +274,6 @@ IdAndNameMapEntry::AddIdContent(nsIContent* aContent) } -PR_STATIC_CALLBACK(const void *) -IdAndNameHashGetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - IdAndNameMapEntry *e = NS_STATIC_CAST(IdAndNameMapEntry *, entry); - - return NS_STATIC_CAST(const nsIAtom *, e->mKey); -} - PR_STATIC_CALLBACK(PLDHashNumber) IdAndNameHashHashKey(PLDHashTable *table, const void *key) { @@ -407,7 +399,6 @@ nsHTMLDocument::Init() { PL_DHashAllocTable, PL_DHashFreeTable, - IdAndNameHashGetKey, IdAndNameHashHashKey, IdAndNameHashMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/content/xbl/src/nsBindingManager.cpp b/mozilla/content/xbl/src/nsBindingManager.cpp index efc0b4111d3..870e1339878 100644 --- a/mozilla/content/xbl/src/nsBindingManager.cpp +++ b/mozilla/content/xbl/src/nsBindingManager.cpp @@ -202,7 +202,6 @@ InitObjectEntry(PLDHashTable* table, PLDHashEntryHdr* entry, const void* key) static PLDHashTableOps ObjectTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashVoidPtrKeyStub, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index f4e7cd3d3c5..7fe87720652 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -755,7 +755,6 @@ nsXULDocument::AddBroadcastListenerFor(nsIDOMElement* aBroadcaster, static PLDHashTableOps gOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashVoidPtrKeyStub, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, diff --git a/mozilla/content/xul/templates/src/nsContentSupportMap.cpp b/mozilla/content/xul/templates/src/nsContentSupportMap.cpp index 4c8246e4304..37e38443e40 100644 --- a/mozilla/content/xul/templates/src/nsContentSupportMap.cpp +++ b/mozilla/content/xul/templates/src/nsContentSupportMap.cpp @@ -39,27 +39,11 @@ #include "nsContentSupportMap.h" #include "nsXULElement.h" -PLDHashTableOps nsContentSupportMap::gOps = { - PL_DHashAllocTable, - PL_DHashFreeTable, - PL_DHashGetKeyStub, - PL_DHashVoidPtrKeyStub, - PL_DHashMatchEntryStub, - PL_DHashMoveEntryStub, - ClearEntry, - PL_DHashFinalizeStub -}; - -void PR_CALLBACK -nsContentSupportMap::ClearEntry(PLDHashTable* aTable, PLDHashEntryHdr* aHdr) -{ - PL_DHashClearEntryStub(aTable, aHdr); -} - void nsContentSupportMap::Init() { - if (!PL_DHashTableInit(&mMap, &gOps, nsnull, sizeof(Entry), PL_DHASH_MIN_SIZE)) + if (!PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nsnull, + sizeof(Entry), PL_DHASH_MIN_SIZE)) mMap.ops = nsnull; } diff --git a/mozilla/content/xul/templates/src/nsContentSupportMap.h b/mozilla/content/xul/templates/src/nsContentSupportMap.h index a9ce0d1d2e0..8b8b566c644 100644 --- a/mozilla/content/xul/templates/src/nsContentSupportMap.h +++ b/mozilla/content/xul/templates/src/nsContentSupportMap.h @@ -99,11 +99,6 @@ protected: nsIContent* mContent; nsTemplateMatch* mMatch; }; - - static PLDHashTableOps gOps; - - static void PR_CALLBACK - ClearEntry(PLDHashTable* aTable, PLDHashEntryHdr* aHdr); }; #endif diff --git a/mozilla/dom/src/base/nsScriptNameSpaceManager.cpp b/mozilla/dom/src/base/nsScriptNameSpaceManager.cpp index ea04f93f635..3956bf1b84e 100644 --- a/mozilla/dom/src/base/nsScriptNameSpaceManager.cpp +++ b/mozilla/dom/src/base/nsScriptNameSpaceManager.cpp @@ -68,14 +68,6 @@ public: }; -PR_STATIC_CALLBACK(const void *) -GlobalNameHashGetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - GlobalNameMapEntry *e = NS_STATIC_CAST(GlobalNameMapEntry *, entry); - - return NS_STATIC_CAST(const nsAString *, &e->mKey); -} - PR_STATIC_CALLBACK(PLDHashNumber) GlobalNameHashHashKey(PLDHashTable *table, const void *key) { @@ -461,7 +453,6 @@ nsScriptNameSpaceManager::Init() { PL_DHashAllocTable, PL_DHashFreeTable, - GlobalNameHashGetKey, GlobalNameHashHashKey, GlobalNameHashMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/embedding/components/commandhandler/src/nsCommandParams.cpp b/mozilla/embedding/components/commandhandler/src/nsCommandParams.cpp index 9e0f2c0bc60..252e729e430 100644 --- a/mozilla/embedding/components/commandhandler/src/nsCommandParams.cpp +++ b/mozilla/embedding/components/commandhandler/src/nsCommandParams.cpp @@ -47,7 +47,6 @@ PLDHashTableOps nsCommandParams::sHashOps = { PL_DHashAllocTable, PL_DHashFreeTable, - HashGetKey, HashKey, HashMatchEntry, HashMoveEntry, @@ -354,14 +353,6 @@ nsCommandParams::GetOrMakeEntry(const char * name, PRUint8 entryType, HashEntry* #pragma mark - #endif -const void * -nsCommandParams::HashGetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - HashEntry* thisEntry = NS_STATIC_CAST(HashEntry*, entry); - return (void *)thisEntry->mEntryName.get(); -} - - PLDHashNumber nsCommandParams::HashKey(PLDHashTable *table, const void *key) { diff --git a/mozilla/embedding/components/commandhandler/src/nsCommandParams.h b/mozilla/embedding/components/commandhandler/src/nsCommandParams.h index b0e18909dfb..d34f0fff6f3 100644 --- a/mozilla/embedding/components/commandhandler/src/nsCommandParams.h +++ b/mozilla/embedding/components/commandhandler/src/nsCommandParams.h @@ -151,8 +151,6 @@ protected: protected: - static const void * PR_CALLBACK HashGetKey(PLDHashTable *table, PLDHashEntryHdr *entry); - static PLDHashNumber PR_CALLBACK HashKey(PLDHashTable *table, const void *key); static PRBool PR_CALLBACK HashMatchEntry(PLDHashTable *table, diff --git a/mozilla/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.cpp b/mozilla/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.cpp index fa1299993e9..61fcabdeeec 100644 --- a/mozilla/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.cpp +++ b/mozilla/extensions/java/xpcom/src/nsJavaXPCOMBindingUtils.cpp @@ -449,18 +449,6 @@ FreeJavaGlobals(JNIEnv* env) * Java<->XPCOM object mappings **************************************/ -static PLDHashTableOps hash_ops = -{ - PL_DHashAllocTable, - PL_DHashFreeTable, - PL_DHashGetKeyStub, - PL_DHashVoidPtrKeyStub, - PL_DHashMatchEntryStub, - PL_DHashMoveEntryStub, - PL_DHashClearEntryStub, - PL_DHashFinalizeStub -}; - // NativeToJavaProxyMap: The common case is that each XPCOM object will have // one Java proxy. But there are instances where there will be multiple Java // proxies for a given XPCOM object, each representing a different interface. @@ -470,7 +458,8 @@ static PLDHashTableOps hash_ops = nsresult NativeToJavaProxyMap::Init() { - mHashTable = PL_NewDHashTable(&hash_ops, nsnull, sizeof(Entry), 16); + mHashTable = PL_NewDHashTable(PL_DHashGetStubOps(), nsnull, + sizeof(Entry), 16); if (!mHashTable) return NS_ERROR_OUT_OF_MEMORY; return NS_OK; @@ -659,7 +648,8 @@ NativeToJavaProxyMap::Remove(JNIEnv* env, nsISupports* aNativeObject, nsresult JavaToXPTCStubMap::Init() { - mHashTable = PL_NewDHashTable(&hash_ops, nsnull, sizeof(Entry), 16); + mHashTable = PL_NewDHashTable(PL_DHashGetStubOps(), nsnull, + sizeof(Entry), 16); if (!mHashTable) return NS_ERROR_OUT_OF_MEMORY; return NS_OK; diff --git a/mozilla/js/src/jscntxt.c b/mozilla/js/src/jscntxt.c index ee9ea78b985..ab72f24acc2 100644 --- a/mozilla/js/src/jscntxt.c +++ b/mozilla/js/src/jscntxt.c @@ -502,14 +502,6 @@ js_ContextIterator(JSRuntime *rt, JSBool unlocked, JSContext **iterp) return cx; } -JS_STATIC_DLL_CALLBACK(const void *) -resolving_GetKey(JSDHashTable *table, JSDHashEntryHdr *hdr) -{ - JSResolvingEntry *entry = (JSResolvingEntry *)hdr; - - return &entry->key; -} - JS_STATIC_DLL_CALLBACK(JSDHashNumber) resolving_HashKey(JSDHashTable *table, const void *ptr) { @@ -532,7 +524,6 @@ resolving_MatchEntry(JSDHashTable *table, static const JSDHashTableOps resolving_dhash_ops = { JS_DHashAllocTable, JS_DHashFreeTable, - resolving_GetKey, resolving_HashKey, resolving_MatchEntry, JS_DHashMoveEntryStub, diff --git a/mozilla/js/src/jsdhash.c b/mozilla/js/src/jsdhash.c index 67ac4eac6ad..311871d4f07 100644 --- a/mozilla/js/src/jsdhash.c +++ b/mozilla/js/src/jsdhash.c @@ -107,14 +107,6 @@ JS_DHashStringKey(JSDHashTable *table, const void *key) return h; } -JS_PUBLIC_API(const void *) -JS_DHashGetKeyStub(JSDHashTable *table, JSDHashEntryHdr *entry) -{ - JSDHashEntryStub *stub = (JSDHashEntryStub *)entry; - - return stub->key; -} - JS_PUBLIC_API(JSDHashNumber) JS_DHashVoidPtrKeyStub(JSDHashTable *table, const void *key) { @@ -174,7 +166,6 @@ JS_DHashFinalizeStub(JSDHashTable *table) static const JSDHashTableOps stub_ops = { JS_DHashAllocTable, JS_DHashFreeTable, - JS_DHashGetKeyStub, JS_DHashVoidPtrKeyStub, JS_DHashMatchEntryStub, JS_DHashMoveEntryStub, diff --git a/mozilla/js/src/jsdhash.h b/mozilla/js/src/jsdhash.h index 61056cb5e44..62f17481760 100644 --- a/mozilla/js/src/jsdhash.h +++ b/mozilla/js/src/jsdhash.h @@ -86,11 +86,12 @@ typedef struct JSDHashTableOps JSDHashTableOps; * Table entry header structure. * * In order to allow in-line allocation of key and value, we do not declare - * either here. Instead, the API uses const void *key as a formal parameter, - * and asks each entry for its key when necessary via a getKey callback, used - * when growing or shrinking the table. Other callback types are defined - * below and grouped into the JSDHashTableOps structure, for single static - * initialization per hash table sub-type. + * either here. Instead, the API uses const void *key as a formal parameter. + * The key need not be stored in the entry; it may be part of the value, but + * need not be stored at all. + * + * Callback types are defined below and grouped into the JSDHashTableOps + * structure, for single static initialization per hash table sub-type. * * Each hash table sub-type should nest the JSDHashEntryHdr structure at the * front of its particular entry type. The keyHash member contains the result @@ -242,16 +243,6 @@ typedef void * typedef void (* JS_DLL_CALLBACK JSDHashFreeTable) (JSDHashTable *table, void *ptr); -/* - * When a table grows or shrinks, each entry is queried for its key using this - * callback. NB: in that event, entry is not in table any longer; it's in the - * old entryStore vector, which is due to be freed once all entries have been - * moved via moveEntry callbacks. - */ -typedef const void * -(* JS_DLL_CALLBACK JSDHashGetKey) (JSDHashTable *table, - JSDHashEntryHdr *entry); - /* * Compute the hash code for a given key to be looked up, added, or removed * from table. A hash code may have any JSDHashNumber value. @@ -339,7 +330,6 @@ struct JSDHashTableOps { /* Mandatory hooks. All implementations must provide these. */ JSDHashAllocTable allocTable; JSDHashFreeTable freeTable; - JSDHashGetKey getKey; JSDHashHashKey hashKey; JSDHashMatchEntry matchEntry; JSDHashMoveEntry moveEntry; @@ -368,9 +358,6 @@ struct JSDHashEntryStub { const void *key; }; -extern JS_PUBLIC_API(const void *) -JS_DHashGetKeyStub(JSDHashTable *table, JSDHashEntryHdr *entry); - extern JS_PUBLIC_API(JSDHashNumber) JS_DHashVoidPtrKeyStub(JSDHashTable *table, const void *key); diff --git a/mozilla/js/src/jsparse.c b/mozilla/js/src/jsparse.c index e386e295a60..1967d625bbe 100644 --- a/mozilla/js/src/jsparse.c +++ b/mozilla/js/src/jsparse.c @@ -2009,7 +2009,6 @@ MatchFindPropValEntry(JSDHashTable *table, static const JSDHashTableOps FindPropValOps = { JS_DHashAllocTable, JS_DHashFreeTable, - JS_DHashGetKeyStub, HashFindPropValKey, MatchFindPropValEntry, JS_DHashMoveEntryStub, diff --git a/mozilla/js/src/jsscope.c b/mozilla/js/src/jsscope.c index 4e16432a06c..203e13d8257 100644 --- a/mozilla/js/src/jsscope.c +++ b/mozilla/js/src/jsscope.c @@ -439,7 +439,6 @@ js_MatchScopeProperty(JSDHashTable *table, static const JSDHashTableOps PropertyTreeHashOps = { JS_DHashAllocTable, JS_DHashFreeTable, - JS_DHashGetKeyStub, js_HashScopeProperty, js_MatchScopeProperty, JS_DHashMoveEntryStub, diff --git a/mozilla/js/src/xpconnect/src/xpcmaps.cpp b/mozilla/js/src/xpconnect/src/xpcmaps.cpp index 4961cc12a6f..054af823430 100644 --- a/mozilla/js/src/xpconnect/src/xpcmaps.cpp +++ b/mozilla/js/src/xpconnect/src/xpcmaps.cpp @@ -205,7 +205,6 @@ struct JSDHashTableOps IID2WrappedJSClassMap::Entry::sOps = { JS_DHashAllocTable, JS_DHashFreeTable, - JS_DHashGetKeyStub, HashIIDPtrKey, MatchIIDPtrKey, JS_DHashMoveEntryStub, @@ -243,7 +242,6 @@ struct JSDHashTableOps IID2NativeInterfaceMap::Entry::sOps = { JS_DHashAllocTable, JS_DHashFreeTable, - JS_DHashGetKeyStub, HashIIDPtrKey, MatchIIDPtrKey, JS_DHashMoveEntryStub, @@ -411,7 +409,6 @@ struct JSDHashTableOps NativeSetMap::Entry::sOps = { JS_DHashAllocTable, JS_DHashFreeTable, - JS_DHashGetKeyStub, HashNativeKey, Match, JS_DHashMoveEntryStub, @@ -444,12 +441,6 @@ NativeSetMap::~NativeSetMap() /***************************************************************************/ // implement IID2ThisTranslatorMap... -const void* JS_DLL_CALLBACK -IID2ThisTranslatorMap::Entry::GetKey(JSDHashTable *table, JSDHashEntryHdr *entry) -{ - return &((Entry*)entry)->key; -} - JSBool JS_DLL_CALLBACK IID2ThisTranslatorMap::Entry::Match(JSDHashTable *table, const JSDHashEntryHdr *entry, @@ -469,7 +460,6 @@ struct JSDHashTableOps IID2ThisTranslatorMap::Entry::sOps = { JS_DHashAllocTable, JS_DHashFreeTable, - GetKey, HashIIDPtrKey, Match, JS_DHashMoveEntryStub, @@ -547,7 +537,6 @@ struct JSDHashTableOps XPCNativeScriptableSharedMap::Entry::sOps = { JS_DHashAllocTable, JS_DHashFreeTable, - JS_DHashGetKeyStub, Hash, Match, JS_DHashMoveEntryStub, diff --git a/mozilla/js/src/xpconnect/src/xpcmaps.h b/mozilla/js/src/xpconnect/src/xpcmaps.h index 8d4bd9beba1..a43283c19ae 100644 --- a/mozilla/js/src/xpconnect/src/xpcmaps.h +++ b/mozilla/js/src/xpconnect/src/xpcmaps.h @@ -519,9 +519,6 @@ public: nsIID key; nsIXPCFunctionThisTranslator* value; - static const void* JS_DLL_CALLBACK - GetKey(JSDHashTable *table, JSDHashEntryHdr *entry); - static JSBool JS_DLL_CALLBACK Match(JSDHashTable *table, const JSDHashEntryHdr *entry, diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 0819a254f25..620208c91fd 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -123,16 +123,6 @@ struct PlaceholderMapEntry : public PLDHashEntryHdr { nsPlaceholderFrame *placeholderFrame; }; -PR_STATIC_CALLBACK(const void *) -PlaceholderMapGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) -{ - PlaceholderMapEntry *entry = NS_STATIC_CAST(PlaceholderMapEntry*, hdr); - NS_ASSERTION(entry->placeholderFrame->GetOutOfFlowFrame() != - (void*)0xdddddddd, - "Dead placeholder in placeholder map"); - return entry->placeholderFrame->GetOutOfFlowFrame(); -} - PR_STATIC_CALLBACK(PRBool) PlaceholderMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, const void *key) @@ -148,7 +138,6 @@ PlaceholderMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, static PLDHashTableOps PlaceholderMapOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PlaceholderMapGetKey, PL_DHashVoidPtrKeyStub, PlaceholderMapMatchEntry, PL_DHashMoveEntryStub, @@ -171,13 +160,6 @@ struct PrimaryFrameMapEntry : public PLDHashEntryHdr { // These ops should be used if/when we switch back to a 2-word entry. // See comment in |PrimaryFrameMapEntry| above. #if 0 -PR_STATIC_CALLBACK(const void *) -PrimaryFrameMapGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) -{ - PrimaryFrameMapEntry *entry = NS_STATIC_CAST(PrimaryFrameMapEntry*, hdr); - return entry->frame->GetContent(); -} - PR_STATIC_CALLBACK(PRBool) PrimaryFrameMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, const void *key) @@ -190,7 +172,6 @@ PrimaryFrameMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, static PLDHashTableOps PrimaryFrameMapOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PrimaryFrameMapGetKey, PL_DHashVoidPtrKeyStub, PrimaryFrameMapMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/layout/style/nsCSSRuleProcessor.cpp b/mozilla/layout/style/nsCSSRuleProcessor.cpp index 1ffd2977d39..093e085cea9 100644 --- a/mozilla/layout/style/nsCSSRuleProcessor.cpp +++ b/mozilla/layout/style/nsCSSRuleProcessor.cpp @@ -138,16 +138,33 @@ RuleHash_CIHashKey(PLDHashTable *table, const void *key) return HashString(str); } +typedef nsIAtom* +(* PR_CALLBACK RuleHashGetKey) (PLDHashTable *table, + const PLDHashEntryHdr *entry); + +struct RuleHashTableOps { + PLDHashTableOps ops; + // Extra callback to avoid duplicating the matchEntry callback for + // each table. (There used to be a getKey callback in + // PLDHashTableOps.) + RuleHashGetKey getKey; +}; + +inline const RuleHashTableOps* +ToLocalOps(const PLDHashTableOps *aOps) +{ + return (const RuleHashTableOps*) + (((const char*) aOps) - offsetof(RuleHashTableOps, ops)); +} + PR_STATIC_CALLBACK(PRBool) RuleHash_CIMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, const void *key) { nsIAtom *match_atom = NS_CONST_CAST(nsIAtom*, NS_STATIC_CAST(const nsIAtom*, key)); - // Use the |getKey| callback to avoid code duplication. - // XXX Ugh! Why does |getKey| have different |const|-ness? - nsIAtom *entry_atom = NS_CONST_CAST(nsIAtom*, NS_STATIC_CAST(const nsIAtom*, - table->ops->getKey(table, NS_CONST_CAST(PLDHashEntryHdr*, hdr)))); + // Use our extra |getKey| callback to avoid code duplication. + nsIAtom *entry_atom = ToLocalOps(table->ops)->getKey(table, hdr); // Check for case-sensitive match first. if (match_atom == entry_atom) @@ -166,42 +183,36 @@ RuleHash_CSMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, { nsIAtom *match_atom = NS_CONST_CAST(nsIAtom*, NS_STATIC_CAST(const nsIAtom*, key)); - // Use the |getKey| callback to avoid code duplication. - // XXX Ugh! Why does |getKey| have different |const|-ness? - nsIAtom *entry_atom = NS_CONST_CAST(nsIAtom*, NS_STATIC_CAST(const nsIAtom*, - table->ops->getKey(table, NS_CONST_CAST(PLDHashEntryHdr*, hdr)))); + // Use our extra |getKey| callback to avoid code duplication. + nsIAtom *entry_atom = ToLocalOps(table->ops)->getKey(table, hdr); return match_atom == entry_atom; } -PR_STATIC_CALLBACK(const void*) -RuleHash_TagTable_GetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) +PR_STATIC_CALLBACK(nsIAtom*) +RuleHash_TagTable_GetKey(PLDHashTable *table, const PLDHashEntryHdr *hdr) { - RuleHashTableEntry *entry = NS_STATIC_CAST(RuleHashTableEntry*, hdr); + const RuleHashTableEntry *entry = + NS_STATIC_CAST(const RuleHashTableEntry*, hdr); return entry->mRules->mSelector->mTag; } -PR_STATIC_CALLBACK(const void*) -RuleHash_ClassTable_GetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) +PR_STATIC_CALLBACK(nsIAtom*) +RuleHash_ClassTable_GetKey(PLDHashTable *table, const PLDHashEntryHdr *hdr) { - RuleHashTableEntry *entry = NS_STATIC_CAST(RuleHashTableEntry*, hdr); + const RuleHashTableEntry *entry = + NS_STATIC_CAST(const RuleHashTableEntry*, hdr); return entry->mRules->mSelector->mClassList->mAtom; } -PR_STATIC_CALLBACK(const void*) -RuleHash_IdTable_GetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) +PR_STATIC_CALLBACK(nsIAtom*) +RuleHash_IdTable_GetKey(PLDHashTable *table, const PLDHashEntryHdr *hdr) { - RuleHashTableEntry *entry = NS_STATIC_CAST(RuleHashTableEntry*, hdr); + const RuleHashTableEntry *entry = + NS_STATIC_CAST(const RuleHashTableEntry*, hdr); return entry->mRules->mSelector->mIDList->mAtom; } -PR_STATIC_CALLBACK(const void*) -RuleHash_NameSpaceTable_GetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) -{ - RuleHashTableEntry *entry = NS_STATIC_CAST(RuleHashTableEntry*, hdr); - return NS_INT32_TO_PTR(entry->mRules->mSelector->mNameSpace); -} - PR_STATIC_CALLBACK(PLDHashNumber) RuleHash_NameSpaceTable_HashKey(PLDHashTable *table, const void *key) { @@ -220,80 +231,89 @@ RuleHash_NameSpaceTable_MatchEntry(PLDHashTable *table, entry->mRules->mSelector->mNameSpace; } -static PLDHashTableOps RuleHash_TagTable_Ops = { +static const RuleHashTableOps RuleHash_TagTable_Ops = { + { PL_DHashAllocTable, PL_DHashFreeTable, - RuleHash_TagTable_GetKey, PL_DHashVoidPtrKeyStub, RuleHash_CSMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, PL_DHashFinalizeStub, NULL + }, + RuleHash_TagTable_GetKey }; // Case-sensitive ops. -static PLDHashTableOps RuleHash_ClassTable_CSOps = { +static const RuleHashTableOps RuleHash_ClassTable_CSOps = { + { PL_DHashAllocTable, PL_DHashFreeTable, - RuleHash_ClassTable_GetKey, PL_DHashVoidPtrKeyStub, RuleHash_CSMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, PL_DHashFinalizeStub, NULL + }, + RuleHash_ClassTable_GetKey }; // Case-insensitive ops. -static PLDHashTableOps RuleHash_ClassTable_CIOps = { +static const RuleHashTableOps RuleHash_ClassTable_CIOps = { + { PL_DHashAllocTable, PL_DHashFreeTable, - RuleHash_ClassTable_GetKey, RuleHash_CIHashKey, RuleHash_CIMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, PL_DHashFinalizeStub, NULL + }, + RuleHash_ClassTable_GetKey }; // Case-sensitive ops. -static PLDHashTableOps RuleHash_IdTable_CSOps = { +static const RuleHashTableOps RuleHash_IdTable_CSOps = { + { PL_DHashAllocTable, PL_DHashFreeTable, - RuleHash_IdTable_GetKey, PL_DHashVoidPtrKeyStub, RuleHash_CSMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, PL_DHashFinalizeStub, NULL + }, + RuleHash_IdTable_GetKey }; // Case-insensitive ops. -static PLDHashTableOps RuleHash_IdTable_CIOps = { +static const RuleHashTableOps RuleHash_IdTable_CIOps = { + { PL_DHashAllocTable, PL_DHashFreeTable, - RuleHash_IdTable_GetKey, RuleHash_CIHashKey, RuleHash_CIMatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, PL_DHashFinalizeStub, NULL + }, + RuleHash_IdTable_GetKey }; -static PLDHashTableOps RuleHash_NameSpaceTable_Ops = { +static const PLDHashTableOps RuleHash_NameSpaceTable_Ops = { PL_DHashAllocTable, PL_DHashFreeTable, - RuleHash_NameSpaceTable_GetKey, RuleHash_NameSpaceTable_HashKey, RuleHash_NameSpaceTable_MatchEntry, PL_DHashMoveEntryStub, PL_DHashClearEntryStub, PL_DHashFinalizeStub, - NULL + NULL, }; #undef RULE_HASH_STATS @@ -389,15 +409,15 @@ RuleHash::RuleHash(PRBool aQuirksMode) // Initialize our arena PL_INIT_ARENA_POOL(&mArena, "RuleHashArena", NS_RULEHASH_ARENA_BLOCK_SIZE); - PL_DHashTableInit(&mTagTable, &RuleHash_TagTable_Ops, nsnull, + PL_DHashTableInit(&mTagTable, &RuleHash_TagTable_Ops.ops, nsnull, sizeof(RuleHashTableEntry), 64); PL_DHashTableInit(&mIdTable, - aQuirksMode ? &RuleHash_IdTable_CIOps - : &RuleHash_IdTable_CSOps, + aQuirksMode ? &RuleHash_IdTable_CIOps.ops + : &RuleHash_IdTable_CSOps.ops, nsnull, sizeof(RuleHashTableEntry), 16); PL_DHashTableInit(&mClassTable, - aQuirksMode ? &RuleHash_ClassTable_CIOps - : &RuleHash_ClassTable_CSOps, + aQuirksMode ? &RuleHash_ClassTable_CIOps.ops + : &RuleHash_ClassTable_CSOps.ops, nsnull, sizeof(RuleHashTableEntry), 16); PL_DHashTableInit(&mNameSpaceTable, &RuleHash_NameSpaceTable_Ops, nsnull, sizeof(RuleHashTableEntry), 16); @@ -636,10 +656,9 @@ AttributeSelectorClearEntry(PLDHashTable *table, PLDHashEntryHdr *hdr) memset(entry, 0, table->entrySize); } -static PLDHashTableOps AttributeSelectorOps = { +static const PLDHashTableOps AttributeSelectorOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashVoidPtrKeyStub, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, diff --git a/mozilla/layout/style/nsHTMLStyleSheet.cpp b/mozilla/layout/style/nsHTMLStyleSheet.cpp index 227037fbeed..b946a89c932 100644 --- a/mozilla/layout/style/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLStyleSheet.cpp @@ -333,7 +333,6 @@ MappedAttrTable_MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, static PLDHashTableOps MappedAttrTable_Ops = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, MappedAttrTable_HashKey, MappedAttrTable_MatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/layout/style/nsRuleNode.cpp b/mozilla/layout/style/nsRuleNode.cpp index f601b3e1f6a..0177dcde45f 100644 --- a/mozilla/layout/style/nsRuleNode.cpp +++ b/mozilla/layout/style/nsRuleNode.cpp @@ -115,13 +115,6 @@ struct ChildrenHashEntry : public PLDHashEntryHdr { nsRuleNode *mRuleNode; }; -PR_STATIC_CALLBACK(const void *) -ChildrenHashGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) -{ - ChildrenHashEntry *entry = NS_STATIC_CAST(ChildrenHashEntry*, hdr); - return entry->mRuleNode->GetRule(); -} - PR_STATIC_CALLBACK(PRBool) ChildrenHashMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, const void *key) @@ -138,7 +131,6 @@ static PLDHashTableOps ChildrenHashOps = { // large size allocations. PL_DHashAllocTable, PL_DHashFreeTable, - ChildrenHashGetKey, PL_DHashVoidPtrKeyStub, ChildrenHashMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/layout/tables/SpanningCellSorter.cpp b/mozilla/layout/tables/SpanningCellSorter.cpp index 8475c0cf601..2c5481870f3 100644 --- a/mozilla/layout/tables/SpanningCellSorter.cpp +++ b/mozilla/layout/tables/SpanningCellSorter.cpp @@ -69,7 +69,6 @@ SpanningCellSorter::~SpanningCellSorter() SpanningCellSorter::HashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - HashTableGetKey, HashTableHashKey, HashTableMatchEntry, PL_DHashMoveEntryStub, @@ -78,14 +77,6 @@ SpanningCellSorter::HashTableOps = { nsnull }; -/* static */ PR_CALLBACK const void* -SpanningCellSorter::HashTableGetKey(PLDHashTable *table, - PLDHashEntryHdr *hdr) -{ - HashTableEntry *entry = NS_STATIC_CAST(HashTableEntry*, hdr); - return NS_INT32_TO_PTR(entry->mColSpan); -} - /* static */ PR_CALLBACK PLDHashNumber SpanningCellSorter::HashTableHashKey(PLDHashTable *table, const void *key) { diff --git a/mozilla/layout/tables/SpanningCellSorter.h b/mozilla/layout/tables/SpanningCellSorter.h index 05c4f2f19ca..583f69fd7de 100644 --- a/mozilla/layout/tables/SpanningCellSorter.h +++ b/mozilla/layout/tables/SpanningCellSorter.h @@ -99,8 +99,6 @@ private: static PLDHashTableOps HashTableOps; - PR_STATIC_CALLBACK(const void*) - HashTableGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr); PR_STATIC_CALLBACK(PLDHashNumber) HashTableHashKey(PLDHashTable *table, const void *key); PR_STATIC_CALLBACK(PRBool) diff --git a/mozilla/mailnews/db/msgdb/public/nsMsgDatabase.h b/mozilla/mailnews/db/msgdb/public/nsMsgDatabase.h index 2b5d3f32336..c474e37fd1b 100644 --- a/mozilla/mailnews/db/msgdb/public/nsMsgDatabase.h +++ b/mozilla/mailnews/db/msgdb/public/nsMsgDatabase.h @@ -295,7 +295,6 @@ protected: void ClearCachedObjects(PRBool dbGoingAway); // all instantiated headers, but doesn't hold refs. PLDHashTable *m_headersInUse; - static const void* PR_CALLBACK GetKey(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); static PLDHashNumber PR_CALLBACK HashKey(PLDHashTable* aTable, const void* aKey); static PRBool PR_CALLBACK MatchEntry(PLDHashTable* aTable, const PLDHashEntryHdr* aEntry, const void* aKey); static void PR_CALLBACK MoveEntry(PLDHashTable* aTable, const PLDHashEntryHdr* aFrom, PLDHashEntryHdr* aTo); diff --git a/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp b/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp index 479a6c33a5c..c0af466c0db 100644 --- a/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp @@ -438,7 +438,6 @@ PLDHashTableOps nsMsgDatabase::gMsgDBHashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - GetKey, HashKey, MatchEntry, MoveEntry, @@ -447,13 +446,6 @@ PLDHashTableOps nsMsgDatabase::gMsgDBHashTableOps = nsnull }; -const void* PR_CALLBACK -nsMsgDatabase::GetKey(PLDHashTable* aTable, PLDHashEntryHdr* aEntry) -{ - MsgHdrHashElement* hdr = NS_REINTERPRET_CAST(MsgHdrHashElement*, aEntry); - return (const void *) hdr->mKey; -} - // HashKey is supposed to maximize entropy in the low order bits, and the key // as is, should do that. PLDHashNumber PR_CALLBACK diff --git a/mozilla/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp b/mozilla/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp index 9f15403b0a1..b39e5bb05c1 100644 --- a/mozilla/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp +++ b/mozilla/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp @@ -159,7 +159,6 @@ static PLDHashOperator PR_CALLBACK VisitEntry(PLDHashTable* table, PLDHashEntryH static const PLDHashTableOps gTokenTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashStringKey, PL_DHashMatchStringKey, PL_DHashMoveEntryStub, diff --git a/mozilla/modules/libpref/src/prefapi.cpp b/mozilla/modules/libpref/src/prefapi.cpp index a7253065ea3..f09aa5ddbe5 100644 --- a/mozilla/modules/libpref/src/prefapi.cpp +++ b/mozilla/modules/libpref/src/prefapi.cpp @@ -127,7 +127,6 @@ static PRBool gIsAnyPrefLocked = PR_FALSE; static PLDHashTableOps pref_HashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashStringKey, matchPrefEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/modules/plugin/base/src/nsJSNPRuntime.cpp b/mozilla/modules/plugin/base/src/nsJSNPRuntime.cpp index 58a7b5149af..f1bf4f67722 100644 --- a/mozilla/modules/plugin/base/src/nsJSNPRuntime.cpp +++ b/mozilla/modules/plugin/base/src/nsJSNPRuntime.cpp @@ -877,15 +877,6 @@ JSObjWrapperHash(PLDHashTable *table, const void *key) return (PLDHashNumber)((PRWord)e->mJSObj ^ (PRWord)e->mNpp) >> 2; } -PR_STATIC_CALLBACK(const void *) -JSObjWrapperHashGetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - JSObjWrapperHashEntry *e = - NS_STATIC_CAST(JSObjWrapperHashEntry *, entry); - - return NS_STATIC_CAST(nsJSObjWrapperKey *, e->mJSObjWrapper); -} - PR_STATIC_CALLBACK(PRBool) JSObjWrapperHashMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *entry, const void *key) @@ -941,7 +932,6 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JSObject *obj) { PL_DHashAllocTable, PL_DHashFreeTable, - JSObjWrapperHashGetKey, JSObjWrapperHash, JSObjWrapperHashMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/netwerk/base/src/nsLoadGroup.cpp b/mozilla/netwerk/base/src/nsLoadGroup.cpp index 49c17601df4..c09cb8a2eaf 100644 --- a/mozilla/netwerk/base/src/nsLoadGroup.cpp +++ b/mozilla/netwerk/base/src/nsLoadGroup.cpp @@ -81,14 +81,6 @@ public: nsCOMPtr mKey; }; -PR_STATIC_CALLBACK(const void *) -RequestHashGetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - RequestMapEntry *e = NS_STATIC_CAST(RequestMapEntry *, entry); - - return e->mKey.get(); -} - PR_STATIC_CALLBACK(PRBool) RequestHashMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *entry, const void *key) @@ -188,7 +180,6 @@ nsresult nsLoadGroup::Init() { PL_DHashAllocTable, PL_DHashFreeTable, - RequestHashGetKey, PL_DHashVoidPtrKeyStub, RequestHashMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/netwerk/cache/src/nsCacheEntry.cpp b/mozilla/netwerk/cache/src/nsCacheEntry.cpp index 650a1bd2058..1dbf2339ab9 100644 --- a/mozilla/netwerk/cache/src/nsCacheEntry.cpp +++ b/mozilla/netwerk/cache/src/nsCacheEntry.cpp @@ -397,7 +397,6 @@ nsCacheEntryHashTable::ops = { PL_DHashAllocTable, PL_DHashFreeTable, - GetKey, HashKey, MatchEntry, MoveEntry, @@ -520,13 +519,6 @@ nsCacheEntryHashTable::VisitEntry(PLDHashTable *table, /** * hash table operation callback functions */ -const void * PR_CALLBACK -nsCacheEntryHashTable::GetKey( PLDHashTable * /*table*/, PLDHashEntryHdr *hashEntry) -{ - nsCacheEntry *cacheEntry = ((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry; - return cacheEntry->mKey; -} - PLDHashNumber PR_CALLBACK nsCacheEntryHashTable::HashKey( PLDHashTable *table, const void *key) diff --git a/mozilla/netwerk/cache/src/nsCacheEntry.h b/mozilla/netwerk/cache/src/nsCacheEntry.h index 49b3dc0372f..b62161bc760 100644 --- a/mozilla/netwerk/cache/src/nsCacheEntry.h +++ b/mozilla/netwerk/cache/src/nsCacheEntry.h @@ -307,8 +307,6 @@ private: friend class nsCacheService; // XXX redefine interface so this isn't necessary // PLDHashTable operation callbacks - static const void * PR_CALLBACK GetKey( PLDHashTable *table, PLDHashEntryHdr *entry); - static PLDHashNumber PR_CALLBACK HashKey( PLDHashTable *table, const void *key); static PRBool PR_CALLBACK MatchEntry( PLDHashTable * table, diff --git a/mozilla/netwerk/cache/src/nsDiskCacheBinding.cpp b/mozilla/netwerk/cache/src/nsDiskCacheBinding.cpp index 59439e8754f..ed60b12a6e7 100644 --- a/mozilla/netwerk/cache/src/nsDiskCacheBinding.cpp +++ b/mozilla/netwerk/cache/src/nsDiskCacheBinding.cpp @@ -60,13 +60,6 @@ struct HashTableEntry : PLDHashEntryHdr { }; -static const void * PR_CALLBACK -GetKey(PLDHashTable * /*table*/, PLDHashEntryHdr * header) -{ - return (void*) ((HashTableEntry *)header)->mBinding->mRecord.HashNumber(); -} - - static PLDHashNumber PR_CALLBACK HashKey( PLDHashTable *table, const void *key) { @@ -168,7 +161,6 @@ PLDHashTableOps nsDiskCacheBindery::ops = { PL_DHashAllocTable, PL_DHashFreeTable, - GetKey, HashKey, MatchEntry, MoveEntry, diff --git a/mozilla/netwerk/dns/src/nsHostResolver.cpp b/mozilla/netwerk/dns/src/nsHostResolver.cpp index 7f673d7070c..af0a09d3faa 100644 --- a/mozilla/netwerk/dns/src/nsHostResolver.cpp +++ b/mozilla/netwerk/dns/src/nsHostResolver.cpp @@ -199,13 +199,6 @@ struct nsHostDBEnt : PLDHashEntryHdr nsHostRecord *rec; }; -PR_STATIC_CALLBACK(const void *) -HostDB_GetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - nsHostDBEnt *he = NS_STATIC_CAST(nsHostDBEnt *, entry); - return NS_STATIC_CAST(const nsHostKey *, he->rec); -} - PR_STATIC_CALLBACK(PLDHashNumber) HostDB_HashKey(PLDHashTable *table, const void *key) { @@ -279,7 +272,6 @@ static PLDHashTableOps gHostDB_ops = { PL_DHashAllocTable, PL_DHashFreeTable, - HostDB_GetKey, HostDB_HashKey, HostDB_MatchEntry, HostDB_MoveEntry, diff --git a/mozilla/netwerk/protocol/http/src/nsHttp.cpp b/mozilla/netwerk/protocol/http/src/nsHttp.cpp index e6c923f403e..3a55e54cd08 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttp.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttp.cpp @@ -113,7 +113,6 @@ StringCompare(PLDHashTable *table, const PLDHashEntryHdr *entry, static const PLDHashTableOps ops = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, StringHash, StringCompare, PL_DHashMoveEntryStub, diff --git a/mozilla/parser/htmlparser/src/nsHTMLEntities.cpp b/mozilla/parser/htmlparser/src/nsHTMLEntities.cpp index a107fe7ccc7..ee123c3b9c3 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLEntities.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLEntities.cpp @@ -54,20 +54,6 @@ struct EntityNodeEntry : public PLDHashEntryHdr const EntityNode* node; }; -PR_STATIC_CALLBACK(const void*) - getStringKey(PLDHashTable*, PLDHashEntryHdr* aHdr) -{ - const EntityNodeEntry* entry = NS_STATIC_CAST(const EntityNodeEntry*, aHdr); - return entry->node->mStr; -} - -PR_STATIC_CALLBACK(const void*) - getUnicodeKey(PLDHashTable*, PLDHashEntryHdr* aHdr) -{ - const EntityNodeEntry* entry = NS_STATIC_CAST(const EntityNodeEntry*, aHdr); - return NS_INT32_TO_PTR(entry->node->mUnicode); -} - PR_STATIC_CALLBACK(PRBool) matchNodeString(PLDHashTable*, const PLDHashEntryHdr* aHdr, const void* key) @@ -97,7 +83,6 @@ PR_STATIC_CALLBACK(PLDHashNumber) static const PLDHashTableOps EntityToUnicodeOps = { PL_DHashAllocTable, PL_DHashFreeTable, - getStringKey, PL_DHashStringKey, matchNodeString, PL_DHashMoveEntryStub, @@ -109,7 +94,6 @@ static const PLDHashTableOps EntityToUnicodeOps = { static const PLDHashTableOps UnicodeToEntityOps = { PL_DHashAllocTable, PL_DHashFreeTable, - getUnicodeKey, hashUnicodeValue, matchNodeUnicode, PL_DHashMoveEntryStub, diff --git a/mozilla/rdf/base/src/nsRDFService.cpp b/mozilla/rdf/base/src/nsRDFService.cpp index 5ce141b4bce..10b0adf3e87 100644 --- a/mozilla/rdf/base/src/nsRDFService.cpp +++ b/mozilla/rdf/base/src/nsRDFService.cpp @@ -167,13 +167,6 @@ struct ResourceHashEntry : public PLDHashEntryHdr { const char *mKey; nsIRDFResource *mResource; - static const void * PR_CALLBACK - GetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) - { - ResourceHashEntry *entry = NS_STATIC_CAST(ResourceHashEntry *, hdr); - return entry->mKey; - } - static PLDHashNumber PR_CALLBACK HashKey(PLDHashTable *table, const void *key) { @@ -195,7 +188,6 @@ struct ResourceHashEntry : public PLDHashEntryHdr { static PLDHashTableOps gResourceTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - ResourceHashEntry::GetKey, ResourceHashEntry::HashKey, ResourceHashEntry::MatchEntry, PL_DHashMoveEntryStub, @@ -213,13 +205,6 @@ struct LiteralHashEntry : public PLDHashEntryHdr { nsIRDFLiteral *mLiteral; const PRUnichar *mKey; - static const void * PR_CALLBACK - GetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) - { - LiteralHashEntry *entry = NS_STATIC_CAST(LiteralHashEntry *, hdr); - return entry->mKey; - } - static PLDHashNumber PR_CALLBACK HashKey(PLDHashTable *table, const void *key) { @@ -241,7 +226,6 @@ struct LiteralHashEntry : public PLDHashEntryHdr { static PLDHashTableOps gLiteralTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - LiteralHashEntry::GetKey, LiteralHashEntry::HashKey, LiteralHashEntry::MatchEntry, PL_DHashMoveEntryStub, @@ -259,13 +243,6 @@ struct IntHashEntry : public PLDHashEntryHdr { nsIRDFInt *mInt; PRInt32 mKey; - static const void * PR_CALLBACK - GetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) - { - IntHashEntry *entry = NS_STATIC_CAST(IntHashEntry *, hdr); - return &entry->mKey; - } - static PLDHashNumber PR_CALLBACK HashKey(PLDHashTable *table, const void *key) { @@ -286,7 +263,6 @@ struct IntHashEntry : public PLDHashEntryHdr { static PLDHashTableOps gIntTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - IntHashEntry::GetKey, IntHashEntry::HashKey, IntHashEntry::MatchEntry, PL_DHashMoveEntryStub, @@ -304,13 +280,6 @@ struct DateHashEntry : public PLDHashEntryHdr { nsIRDFDate *mDate; PRTime mKey; - static const void * PR_CALLBACK - GetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) - { - DateHashEntry *entry = NS_STATIC_CAST(DateHashEntry *, hdr); - return &entry->mKey; - } - static PLDHashNumber PR_CALLBACK HashKey(PLDHashTable *table, const void *key) { @@ -340,7 +309,6 @@ struct DateHashEntry : public PLDHashEntryHdr { static PLDHashTableOps gDateTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - DateHashEntry::GetKey, DateHashEntry::HashKey, DateHashEntry::MatchEntry, PL_DHashMoveEntryStub, @@ -431,13 +399,6 @@ BlobImpl::GetLength(PRInt32 *aResult) struct BlobHashEntry : public PLDHashEntryHdr { BlobImpl *mBlob; - static const void * PR_CALLBACK - GetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) - { - BlobHashEntry *entry = NS_STATIC_CAST(BlobHashEntry *, hdr); - return &entry->mBlob->mData; - } - static PLDHashNumber PR_CALLBACK HashKey(PLDHashTable *table, const void *key) { @@ -471,7 +432,6 @@ struct BlobHashEntry : public PLDHashEntryHdr { static PLDHashTableOps gBlobTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - BlobHashEntry::GetKey, BlobHashEntry::HashKey, BlobHashEntry::MatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index 327541b33a6..256e7669185 100644 --- a/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/mozilla/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -104,13 +104,6 @@ struct RequestHashEntry : PLDHashEntryHdr { void *r; }; -PR_STATIC_CALLBACK(const void *) -RequestMapGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) -{ - RequestHashEntry *entry = NS_STATIC_CAST(RequestHashEntry*, hdr); - return entry->r; -} - PR_STATIC_CALLBACK(PRBool) RequestMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, const void *key) @@ -131,7 +124,6 @@ RequestMapInitEntry(PLDHashTable *table, PLDHashEntryHdr *hdr, static PLDHashTableOps gMapOps = { PL_DHashAllocTable, PL_DHashFreeTable, - RequestMapGetKey, PL_DHashVoidPtrKeyStub, RequestMapMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/security/manager/ssl/src/nsCertTree.cpp b/mozilla/security/manager/ssl/src/nsCertTree.cpp index 493e49f2976..327935382f8 100644 --- a/mozilla/security/manager/ssl/src/nsCertTree.cpp +++ b/mozilla/security/manager/ssl/src/nsCertTree.cpp @@ -91,13 +91,6 @@ CompareCacheHashEntry::CompareCacheHashEntry() } } -PR_STATIC_CALLBACK(const void *) -CompareCacheGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) -{ - CompareCacheHashEntryPtr *entryPtr = NS_STATIC_CAST(CompareCacheHashEntryPtr*, hdr); - return entryPtr->entry->key; -} - PR_STATIC_CALLBACK(PRBool) CompareCacheMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, const void *key) @@ -129,7 +122,6 @@ CompareCacheClearEntry(PLDHashTable *table, PLDHashEntryHdr *hdr) static PLDHashTableOps gMapOps = { PL_DHashAllocTable, PL_DHashFreeTable, - CompareCacheGetKey, PL_DHashVoidPtrKeyStub, CompareCacheMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/security/manager/ssl/src/nsNSSShutDown.cpp b/mozilla/security/manager/ssl/src/nsNSSShutDown.cpp index 4687f98f675..6112f7af2c5 100644 --- a/mozilla/security/manager/ssl/src/nsNSSShutDown.cpp +++ b/mozilla/security/manager/ssl/src/nsNSSShutDown.cpp @@ -46,13 +46,6 @@ struct ObjectHashEntry : PLDHashEntryHdr { nsNSSShutDownObject *obj; }; -PR_STATIC_CALLBACK(const void *) -ObjectSetGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr) -{ - ObjectHashEntry *entry = NS_STATIC_CAST(ObjectHashEntry*, hdr); - return entry->obj; -} - PR_STATIC_CALLBACK(PRBool) ObjectSetMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr, const void *key) @@ -73,7 +66,6 @@ ObjectSetInitEntry(PLDHashTable *table, PLDHashEntryHdr *hdr, static PLDHashTableOps gSetOps = { PL_DHashAllocTable, PL_DHashFreeTable, - ObjectSetGetKey, PL_DHashVoidPtrKeyStub, ObjectSetMatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/uriloader/base/nsDocLoader.cpp b/mozilla/uriloader/base/nsDocLoader.cpp index b419d27491a..93a36f65928 100644 --- a/mozilla/uriloader/base/nsDocLoader.cpp +++ b/mozilla/uriloader/base/nsDocLoader.cpp @@ -148,7 +148,6 @@ nsDocLoader::nsDocLoader() { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashVoidPtrKeyStub, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, diff --git a/mozilla/widget/src/gtk/nsWindow.cpp b/mozilla/widget/src/gtk/nsWindow.cpp index 348f8ecf5ff..6b664051585 100644 --- a/mozilla/widget/src/gtk/nsWindow.cpp +++ b/mozilla/widget/src/gtk/nsWindow.cpp @@ -137,7 +137,6 @@ struct IconEntry : public PLDHashEntryHdr { static PLDHashTableOps iconHashOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashStringKey, PL_DHashMatchStringKey, PL_DHashMoveEntryStub, diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp index 08356ff8569..6e0e0ae01b8 100644 --- a/mozilla/xpcom/components/nsComponentManager.cpp +++ b/mozilla/xpcom/components/nsComponentManager.cpp @@ -278,14 +278,6 @@ ArenaStrdup(const char *s, PLArenaPool *arena) PRBool PR_CALLBACK nsFactoryEntry_Destroy(nsHashKey *aKey, void *aData, void* closure); -PR_STATIC_CALLBACK(const void *) -factory_GetKey(PLDHashTable *aTable, PLDHashEntryHdr *aHdr) -{ - nsFactoryTableEntry* entry = NS_STATIC_CAST(nsFactoryTableEntry*, aHdr); - - return &entry->mFactoryEntry->mCid; -} - PR_STATIC_CALLBACK(PLDHashNumber) factory_HashKey(PLDHashTable *aTable, const void *aKey) { @@ -318,7 +310,6 @@ factory_ClearEntry(PLDHashTable *aTable, PLDHashEntryHdr *aHdr) static const PLDHashTableOps factory_DHashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - factory_GetKey, factory_HashKey, factory_MatchEntry, PL_DHashMoveEntryStub, @@ -346,7 +337,6 @@ contractID_ClearEntry(PLDHashTable *aTable, PLDHashEntryHdr *aHdr) static const PLDHashTableOps contractID_DHashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashStringKey, PL_DHashMatchStringKey, PL_DHashMoveEntryStub, diff --git a/mozilla/xpcom/components/nsStaticComponentLoader.cpp b/mozilla/xpcom/components/nsStaticComponentLoader.cpp index fb7101d8abe..15049e4f83d 100644 --- a/mozilla/xpcom/components/nsStaticComponentLoader.cpp +++ b/mozilla/xpcom/components/nsStaticComponentLoader.cpp @@ -80,10 +80,14 @@ info_InitEntry(PLDHashTable *table, PLDHashEntryHdr *entry, const void *key) } /* static */ PLDHashTableOps nsStaticModuleLoader::sInfoHashOps = { - PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashStringKey, PL_DHashMatchStringKey, - PL_DHashMoveEntryStub, info_ClearEntry, - PL_DHashFinalizeStub, info_InitEntry + PL_DHashAllocTable, + PL_DHashFreeTable, + PL_DHashStringKey, + PL_DHashMatchStringKey, + PL_DHashMoveEntryStub, + info_ClearEntry, + PL_DHashFinalizeStub, + info_InitEntry }; nsresult diff --git a/mozilla/xpcom/ds/nsAtomTable.cpp b/mozilla/xpcom/ds/nsAtomTable.cpp index d71941cd9d2..293396c93ac 100644 --- a/mozilla/xpcom/ds/nsAtomTable.cpp +++ b/mozilla/xpcom/ds/nsAtomTable.cpp @@ -114,6 +114,8 @@ private: // actual live entry in the table, and then mBits & ~0x1 in the // AtomTableEntry points to an AtomImpl or a nsStaticAtomWrapper, // indicated by the first bit of PtrBits. +// XXX This whole mess could be vastly simplified now that pldhash +// no longer has a getKey callback. typedef PRUword PtrBits; struct AtomTableEntry : public PLDHashEntryHdr { @@ -240,14 +242,6 @@ struct AtomTableEntry : public PLDHashEntryHdr { } }; -PR_STATIC_CALLBACK(const void *) -AtomTableGetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - AtomTableEntry *he = NS_STATIC_CAST(AtomTableEntry*, entry); - NS_ASSERTION(he->HasValue(), "Empty atom. how did that happen?"); - return he; -} - PR_STATIC_CALLBACK(PLDHashNumber) AtomTableGetHash(PLDHashTable *table, const void *key) { @@ -314,7 +308,6 @@ AtomTableClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry) static const PLDHashTableOps AtomTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - AtomTableGetKey, AtomTableGetHash, AtomTableMatchKey, PL_DHashMoveEntryStub, diff --git a/mozilla/xpcom/ds/nsDoubleHashtable.h b/mozilla/xpcom/ds/nsDoubleHashtable.h index 3f88f8dfb3b..770538bebae 100644 --- a/mozilla/xpcom/ds/nsDoubleHashtable.h +++ b/mozilla/xpcom/ds/nsDoubleHashtable.h @@ -205,12 +205,6 @@ // ENTRY_CLASS: the classname of the entry // #define DHASH_CALLBACKS(ENTRY_CLASS) \ -PR_STATIC_CALLBACK(const void *) \ -ENTRY_CLASS##GetKey(PLDHashTable* table, PLDHashEntryHdr* entry) \ -{ \ - ENTRY_CLASS* e = NS_STATIC_CAST(ENTRY_CLASS*, entry); \ - return e->GetKey(); \ -} \ PR_STATIC_CALLBACK(PLDHashNumber) \ ENTRY_CLASS##HashKey(PLDHashTable* table, const void* key) \ { \ @@ -255,7 +249,6 @@ PR_BEGIN_MACRO \ { \ PL_DHashAllocTable, \ PL_DHashFreeTable, \ - ENTRY_CLASS##GetKey, \ ENTRY_CLASS##HashKey, \ ENTRY_CLASS##MatchEntry, \ PL_DHashMoveEntryStub, \ diff --git a/mozilla/xpcom/ds/nsHashtable.cpp b/mozilla/xpcom/ds/nsHashtable.cpp index e243cde8f5f..5f42d9a6aff 100644 --- a/mozilla/xpcom/ds/nsHashtable.cpp +++ b/mozilla/xpcom/ds/nsHashtable.cpp @@ -103,7 +103,6 @@ clearHashEntry(PLDHashTable* table, PLDHashEntryHdr* entry) static const PLDHashTableOps hashtableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, hashKey, matchKeyEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/xpcom/ds/nsPersistentProperties.cpp b/mozilla/xpcom/ds/nsPersistentProperties.cpp index 2fdba6c6967..05853f8075c 100644 --- a/mozilla/xpcom/ds/nsPersistentProperties.cpp +++ b/mozilla/xpcom/ds/nsPersistentProperties.cpp @@ -89,7 +89,6 @@ ArenaStrdup(const nsAFlatCString& aString, PLArenaPool* aArena) static const struct PLDHashTableOps property_HashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashStringKey, PL_DHashMatchStringKey, PL_DHashMoveEntryStub, diff --git a/mozilla/xpcom/ds/nsStaticNameTable.cpp b/mozilla/xpcom/ds/nsStaticNameTable.cpp index 5b99c62a5db..f5d37d10295 100644 --- a/mozilla/xpcom/ds/nsStaticNameTable.cpp +++ b/mozilla/xpcom/ds/nsStaticNameTable.cpp @@ -72,18 +72,10 @@ struct NameTableKey struct NameTableEntry : public PLDHashEntryHdr { // no ownership here! - NameTableKey mKey; + const nsAFlatCString* mString; PRInt32 mIndex; }; -PR_STATIC_CALLBACK(const void *) -nameTableGetKey(PLDHashTable *, PLDHashEntryHdr *aHdr) -{ - NameTableEntry* entry = - NS_STATIC_CAST(NameTableEntry *, aHdr); - return &(entry->mKey); -} - PR_STATIC_CALLBACK(PRBool) matchNameKeysCaseInsensitive(PLDHashTable*, const PLDHashEntryHdr* aHdr, const void* key) @@ -92,10 +84,7 @@ matchNameKeysCaseInsensitive(PLDHashTable*, const PLDHashEntryHdr* aHdr, NS_STATIC_CAST(const NameTableEntry *, aHdr); const NameTableKey *keyValue = NS_STATIC_CAST(const NameTableKey*, key); - NS_ASSERTION(!entry->mKey.mIsUnichar, - "Entry shouldn't have a unichar key!"); - - const nsAFlatCString* entryKey = entry->mKey.mKeyStr.m1b; + const nsAFlatCString* entryKey = entry->mString; if (keyValue->mIsUnichar) { return keyValue->mKeyStr.m2b-> @@ -138,7 +127,6 @@ caseInsensitiveStringHashKey(PLDHashTable *table, const void *key) static const struct PLDHashTableOps nametable_CaseInsensitiveHashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - nameTableGetKey, caseInsensitiveStringHashKey, matchNameKeysCaseInsensitive, PL_DHashMoveEntryStub, @@ -215,10 +203,9 @@ nsStaticCaseInsensitiveNameTable::Init(const char* const aNames[], PRInt32 Count if (!entry) continue; - NS_ASSERTION(entry->mKey.mKeyStr.m1b == 0, "Entry already exists!"); + NS_ASSERTION(entry->mString == 0, "Entry already exists!"); - entry->mKey.mIsUnichar = PR_FALSE; - entry->mKey.mKeyStr.m1b = strPtr; // not owned! + entry->mString = strPtr; // not owned! entry->mIndex = index; } return PR_TRUE; diff --git a/mozilla/xpcom/glue/nsTHashtable.h b/mozilla/xpcom/glue/nsTHashtable.h index 6955905fa1f..8aeec021546 100644 --- a/mozilla/xpcom/glue/nsTHashtable.h +++ b/mozilla/xpcom/glue/nsTHashtable.h @@ -329,7 +329,6 @@ nsTHashtable::Init(PRUint32 initSize) { ::PL_DHashAllocTable, ::PL_DHashFreeTable, - s_GetKey, s_HashKey, s_MatchEntry, ::PL_DHashMoveEntryStub, @@ -355,14 +354,6 @@ nsTHashtable::Init(PRUint32 initSize) // static definitions -template -const void* -nsTHashtable::s_GetKey(PLDHashTable *table, - PLDHashEntryHdr *entry) -{ - return ((EntryType*) entry)->GetKeyPointer(); -} - template PLDHashNumber nsTHashtable::s_HashKey(PLDHashTable *table, diff --git a/mozilla/xpcom/glue/pldhash.c b/mozilla/xpcom/glue/pldhash.c index 7b28d2f61fb..80c5a927d32 100644 --- a/mozilla/xpcom/glue/pldhash.c +++ b/mozilla/xpcom/glue/pldhash.c @@ -108,14 +108,6 @@ PL_DHashStringKey(PLDHashTable *table, const void *key) return h; } -const void * -PL_DHashGetKeyStub(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - PLDHashEntryStub *stub = (PLDHashEntryStub *)entry; - - return stub->key; -} - PLDHashNumber PL_DHashVoidPtrKeyStub(PLDHashTable *table, const void *key) { @@ -175,7 +167,6 @@ PL_DHashFinalizeStub(PLDHashTable *table) static const PLDHashTableOps stub_ops = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashVoidPtrKeyStub, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, diff --git a/mozilla/xpcom/glue/pldhash.h b/mozilla/xpcom/glue/pldhash.h index 135ff657013..54e7e49e103 100644 --- a/mozilla/xpcom/glue/pldhash.h +++ b/mozilla/xpcom/glue/pldhash.h @@ -87,11 +87,12 @@ typedef struct PLDHashTableOps PLDHashTableOps; * Table entry header structure. * * In order to allow in-line allocation of key and value, we do not declare - * either here. Instead, the API uses const void *key as a formal parameter, - * and asks each entry for its key when necessary via a getKey callback, used - * when growing or shrinking the table. Other callback types are defined - * below and grouped into the PLDHashTableOps structure, for single static - * initialization per hash table sub-type. + * either here. Instead, the API uses const void *key as a formal parameter. + * The key need not be stored in the entry; it may be part of the value, but + * need not be stored at all. + * + * Callback types are defined below and grouped into the PLDHashTableOps + * structure, for single static initialization per hash table sub-type. * * Each hash table sub-type should nest the PLDHashEntryHdr structure at the * front of its particular entry type. The keyHash member contains the result @@ -243,16 +244,6 @@ typedef void * typedef void (* PR_CALLBACK PLDHashFreeTable) (PLDHashTable *table, void *ptr); -/* - * When a table grows or shrinks, each entry is queried for its key using this - * callback. NB: in that event, entry is not in table any longer; it's in the - * old entryStore vector, which is due to be freed once all entries have been - * moved via moveEntry callbacks. - */ -typedef const void * -(* PR_CALLBACK PLDHashGetKey) (PLDHashTable *table, - PLDHashEntryHdr *entry); - /* * Compute the hash code for a given key to be looked up, added, or removed * from table. A hash code may have any PLDHashNumber value. @@ -340,7 +331,6 @@ struct PLDHashTableOps { /* Mandatory hooks. All implementations must provide these. */ PLDHashAllocTable allocTable; PLDHashFreeTable freeTable; - PLDHashGetKey getKey; PLDHashHashKey hashKey; PLDHashMatchEntry matchEntry; PLDHashMoveEntry moveEntry; @@ -369,9 +359,6 @@ struct PLDHashEntryStub { const void *key; }; -NS_COM_GLUE const void * -PL_DHashGetKeyStub(PLDHashTable *table, PLDHashEntryHdr *entry); - NS_COM_GLUE PLDHashNumber PL_DHashVoidPtrKeyStub(PLDHashTable *table, const void *key); diff --git a/mozilla/xpcom/io/nsFastLoadFile.cpp b/mozilla/xpcom/io/nsFastLoadFile.cpp index 9146a0d9763..ff44098a6c8 100644 --- a/mozilla/xpcom/io/nsFastLoadFile.cpp +++ b/mozilla/xpcom/io/nsFastLoadFile.cpp @@ -340,7 +340,6 @@ strmap_ClearEntry(PLDHashTable *aTable, PLDHashEntryHdr *aHdr) static const PLDHashTableOps strmap_DHashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashStringKey, PL_DHashMatchStringKey, PL_DHashMoveEntryStub, @@ -376,7 +375,6 @@ objmap_ClearEntry(PLDHashTable *aTable, PLDHashEntryHdr *aHdr) static const PLDHashTableOps objmap_DHashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - PL_DHashGetKeyStub, PL_DHashVoidPtrKeyStub, PL_DHashMatchEntryStub, PL_DHashMoveEntryStub, @@ -1247,14 +1245,6 @@ struct nsIDMapEntry : public PLDHashEntryHdr { nsID mSlowID; // key, used by PLDHashTableOps below }; -PR_STATIC_CALLBACK(const void *) -idmap_GetKey(PLDHashTable *aTable, PLDHashEntryHdr *aHdr) -{ - nsIDMapEntry* entry = NS_STATIC_CAST(nsIDMapEntry*, aHdr); - - return &entry->mSlowID; -} - PR_STATIC_CALLBACK(PLDHashNumber) idmap_HashKey(PLDHashTable *aTable, const void *aKey) { @@ -1277,7 +1267,6 @@ idmap_MatchEntry(PLDHashTable *aTable, static const PLDHashTableOps idmap_DHashTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - idmap_GetKey, idmap_HashKey, idmap_MatchEntry, PL_DHashMoveEntryStub, diff --git a/mozilla/xpcom/reflect/xptinfo/src/xptiWorkingSet.cpp b/mozilla/xpcom/reflect/xptinfo/src/xptiWorkingSet.cpp index f23bb1099d9..d2f9fe5cfb5 100644 --- a/mozilla/xpcom/reflect/xptinfo/src/xptiWorkingSet.cpp +++ b/mozilla/xpcom/reflect/xptinfo/src/xptiWorkingSet.cpp @@ -48,12 +48,6 @@ /***************************************************************************/ -PR_STATIC_CALLBACK(const void*) -IIDGetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - return ((xptiHashEntry*)entry)->value->GetTheIID(); -} - PR_STATIC_CALLBACK(PLDHashNumber) IIDHash(PLDHashTable *table, const void *key) { @@ -75,7 +69,6 @@ const static struct PLDHashTableOps IIDTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - IIDGetKey, IIDHash, IIDMatch, PL_DHashMoveEntryStub, @@ -85,12 +78,6 @@ const static struct PLDHashTableOps IIDTableOps = /***************************************************************************/ -PR_STATIC_CALLBACK(const void*) -NameGetKey(PLDHashTable *table, PLDHashEntryHdr *entry) -{ - return ((xptiHashEntry*)entry)->value->GetTheName(); -} - PR_STATIC_CALLBACK(PRBool) NameMatch(PLDHashTable *table, const PLDHashEntryHdr *entry, @@ -105,7 +92,6 @@ static const struct PLDHashTableOps NameTableOps = { PL_DHashAllocTable, PL_DHashFreeTable, - NameGetKey, PL_DHashStringKey, NameMatch, PL_DHashMoveEntryStub,