Bug 1253085 - Remove the |PLDHashTable*| argument from PLDHash{HashKey,MatchEntry}. r=froydnj.

This is easy because it's never needed.

--HG--
extra : rebase_source : 78830dab41c40a1544fa55fc69ca9c1c6709d767
This commit is contained in:
Nicholas Nethercote 2016-03-16 15:33:44 +11:00
parent 40e671dab2
commit a2f068b2ad
36 changed files with 111 additions and 189 deletions

View File

@ -171,16 +171,14 @@ struct ContentListHashEntry : public PLDHashEntryHdr
};
static PLDHashNumber
ContentListHashtableHashKey(PLDHashTable *table, const void *key)
ContentListHashtableHashKey(const void *key)
{
const nsContentListKey* list = static_cast<const nsContentListKey *>(key);
return list->GetHash();
}
static bool
ContentListHashtableMatchEntry(PLDHashTable *table,
const PLDHashEntryHdr *entry,
const void *key)
ContentListHashtableMatchEntry(const PLDHashEntryHdr *entry, const void *key)
{
const ContentListHashEntry *e =
static_cast<const ContentListHashEntry *>(entry);
@ -278,7 +276,7 @@ struct FuncStringContentListHashEntry : public PLDHashEntryHdr
};
static PLDHashNumber
FuncStringContentListHashtableHashKey(PLDHashTable *table, const void *key)
FuncStringContentListHashtableHashKey(const void *key)
{
const nsFuncStringCacheKey* funcStringKey =
static_cast<const nsFuncStringCacheKey *>(key);
@ -286,9 +284,8 @@ FuncStringContentListHashtableHashKey(PLDHashTable *table, const void *key)
}
static bool
FuncStringContentListHashtableMatchEntry(PLDHashTable *table,
const PLDHashEntryHdr *entry,
const void *key)
FuncStringContentListHashtableMatchEntry(const PLDHashEntryHdr *entry,
const void *key)
{
const FuncStringContentListHashEntry *e =
static_cast<const FuncStringContentListHashEntry *>(entry);

View File

@ -36,15 +36,14 @@
using namespace mozilla;
static PLDHashNumber
GlobalNameHashHashKey(PLDHashTable *table, const void *key)
GlobalNameHashHashKey(const void *key)
{
const nsAString *str = static_cast<const nsAString *>(key);
return HashString(*str);
}
static bool
GlobalNameHashMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *entry,
const void *key)
GlobalNameHashMatchEntry(const PLDHashEntryHdr *entry, const void *key)
{
const GlobalNameMapEntry *e =
static_cast<const GlobalNameMapEntry *>(entry);

View File

@ -230,14 +230,13 @@ nsCommandParams::GetOrMakeEntry(const char* aName, uint8_t aEntryType)
}
PLDHashNumber
nsCommandParams::HashKey(PLDHashTable* aTable, const void* aKey)
nsCommandParams::HashKey(const void* aKey)
{
return HashString((const char*)aKey);
}
bool
nsCommandParams::HashMatchEntry(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry, const void* aKey)
nsCommandParams::HashMatchEntry(const PLDHashEntryHdr* aEntry, const void* aKey)
{
const char* keyString = (const char*)aKey;
const HashEntry* thisEntry = static_cast<const HashEntry*>(aEntry);

View File

@ -114,10 +114,9 @@ protected:
HashEntry* GetOrMakeEntry(const char* aName, uint8_t aEntryType);
protected:
static PLDHashNumber HashKey(PLDHashTable* aTable, const void* aKey);
static PLDHashNumber HashKey(const void* aKey);
static bool HashMatchEntry(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry, const void* aKey);
static bool HashMatchEntry(const PLDHashEntryHdr* aEntry, const void* aKey);
static void HashMoveEntry(PLDHashTable* aTable, const PLDHashEntryHdr* aFrom,
PLDHashEntryHdr* aTo);

View File

@ -759,13 +759,12 @@ private:
bool mFileExists;
} FNCMapEntry;
static PLDHashNumber StringHash(PLDHashTable *table, const void *key)
static PLDHashNumber StringHash(const void *key)
{
return HashString(reinterpret_cast<const char*>(key));
}
static bool HashMatchEntry(PLDHashTable *table,
const PLDHashEntryHdr *aHdr, const void *key)
static bool HashMatchEntry(const PLDHashEntryHdr *aHdr, const void *key)
{
const FNCMapEntry* entry =
static_cast<const FNCMapEntry*>(aHdr);

View File

@ -21,22 +21,20 @@ using namespace mozilla;
// the pointer to the nsID.
static PLDHashNumber
HashIIDPtrKey(PLDHashTable* table, const void* key)
HashIIDPtrKey(const void* key)
{
return *((js::HashNumber*)key);
}
static bool
MatchIIDPtrKey(PLDHashTable* table,
const PLDHashEntryHdr* entry,
const void* key)
MatchIIDPtrKey(const PLDHashEntryHdr* entry, const void* key)
{
return ((const nsID*)key)->
Equals(*((const nsID*)((PLDHashEntryStub*)entry)->key));
}
static PLDHashNumber
HashNativeKey(PLDHashTable* table, const void* key)
HashNativeKey(const void* key)
{
XPCNativeSetKey* Key = (XPCNativeSetKey*) key;
@ -319,9 +317,7 @@ ClassInfo2WrappedNativeProtoMap::SizeOfIncludingThis(mozilla::MallocSizeOf mallo
// implement NativeSetMap...
bool
NativeSetMap::Entry::Match(PLDHashTable* table,
const PLDHashEntryHdr* entry,
const void* key)
NativeSetMap::Entry::Match(const PLDHashEntryHdr* entry, const void* key)
{
XPCNativeSetKey* Key = (XPCNativeSetKey*) key;
@ -431,8 +427,7 @@ NativeSetMap::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
// implement IID2ThisTranslatorMap...
bool
IID2ThisTranslatorMap::Entry::Match(PLDHashTable* table,
const PLDHashEntryHdr* entry,
IID2ThisTranslatorMap::Entry::Match(const PLDHashEntryHdr* entry,
const void* key)
{
return ((const nsID*)key)->Equals(((Entry*)entry)->key);
@ -473,7 +468,7 @@ IID2ThisTranslatorMap::~IID2ThisTranslatorMap()
/***************************************************************************/
PLDHashNumber
XPCNativeScriptableSharedMap::Entry::Hash(PLDHashTable* table, const void* key)
XPCNativeScriptableSharedMap::Entry::Hash(const void* key)
{
PLDHashNumber h;
const unsigned char* s;
@ -492,8 +487,7 @@ XPCNativeScriptableSharedMap::Entry::Hash(PLDHashTable* table, const void* key)
}
bool
XPCNativeScriptableSharedMap::Entry::Match(PLDHashTable* table,
const PLDHashEntryHdr* entry,
XPCNativeScriptableSharedMap::Entry::Match(const PLDHashEntryHdr* entry,
const void* key)
{
XPCNativeScriptableShared* obj1 =

View File

@ -390,9 +390,7 @@ public:
XPCNativeSet* key_value;
static bool
Match(PLDHashTable* table,
const PLDHashEntryHdr* entry,
const void* key);
Match(const PLDHashEntryHdr* entry, const void* key);
static const struct PLDHashTableOps sOps;
};
@ -459,9 +457,7 @@ public:
nsCOMPtr<nsIXPCFunctionThisTranslator> value;
static bool
Match(PLDHashTable* table,
const PLDHashEntryHdr* entry,
const void* key);
Match(const PLDHashEntryHdr* entry, const void* key);
static void
Clear(PLDHashTable* table, PLDHashEntryHdr* entry);
@ -513,12 +509,10 @@ public:
XPCNativeScriptableShared* key;
static PLDHashNumber
Hash(PLDHashTable* table, const void* key);
Hash(const void* key);
static bool
Match(PLDHashTable* table,
const PLDHashEntryHdr* entry,
const void* key);
Match(const PLDHashEntryHdr* entry, const void* key);
static const struct PLDHashTableOps sOps;
};

View File

@ -57,8 +57,7 @@ struct PlaceholderMapEntry : public PLDHashEntryHdr {
};
static bool
PlaceholderMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
PlaceholderMapMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const PlaceholderMapEntry *entry =
static_cast<const PlaceholderMapEntry*>(hdr);

View File

@ -185,7 +185,7 @@ struct RuleHashTagTableEntry : public RuleHashTableEntry {
};
static PLDHashNumber
RuleHash_CIHashKey(PLDHashTable *table, const void *key)
RuleHash_CIHashKey(const void *key)
{
nsIAtom *atom = const_cast<nsIAtom*>(static_cast<const nsIAtom*>(key));
@ -232,29 +232,25 @@ CSMatchAtoms(const void* key, nsIAtom *entry_atom)
}
static bool
RuleHash_ClassCIMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
RuleHash_ClassCIMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
return CIMatchAtoms(key, SubjectSelectorForRuleHash(hdr)->mClassList->mAtom);
}
static bool
RuleHash_IdCIMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
RuleHash_IdCIMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
return CIMatchAtoms(key, SubjectSelectorForRuleHash(hdr)->mIDList->mAtom);
}
static bool
RuleHash_ClassCSMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
RuleHash_ClassCSMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
return CSMatchAtoms(key, SubjectSelectorForRuleHash(hdr)->mClassList->mAtom);
}
static bool
RuleHash_IdCSMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
RuleHash_IdCSMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
return CSMatchAtoms(key, SubjectSelectorForRuleHash(hdr)->mIDList->mAtom);
}
@ -287,8 +283,7 @@ RuleHash_MoveEntry(PLDHashTable *table, const PLDHashEntryHdr *from,
}
static bool
RuleHash_TagTable_MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
RuleHash_TagTable_MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
nsIAtom *match_atom = const_cast<nsIAtom*>(static_cast<const nsIAtom*>(key));
nsIAtom *entry_atom = static_cast<const RuleHashTagTableEntry*>(hdr)->mTag;
@ -326,15 +321,13 @@ RuleHash_TagTable_MoveEntry(PLDHashTable *table, const PLDHashEntryHdr *from,
}
static PLDHashNumber
RuleHash_NameSpaceTable_HashKey(PLDHashTable *table, const void *key)
RuleHash_NameSpaceTable_HashKey(const void *key)
{
return NS_PTR_TO_INT32(key);
}
static bool
RuleHash_NameSpaceTable_MatchEntry(PLDHashTable *table,
const PLDHashEntryHdr *hdr,
const void *key)
RuleHash_NameSpaceTable_MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const RuleHashTableEntry *entry =
static_cast<const RuleHashTableEntry*>(hdr);
@ -818,8 +811,7 @@ AtomSelector_MoveEntry(PLDHashTable *table, const PLDHashEntryHdr *from,
}
static bool
AtomSelector_CIMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
AtomSelector_CIMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const AtomSelectorEntry *entry = static_cast<const AtomSelectorEntry*>(hdr);
return CIMatchAtoms(key, entry->mAtom);
@ -3490,14 +3482,13 @@ struct RuleByWeightEntry : public PLDHashEntryHdr {
};
static PLDHashNumber
HashIntKey(PLDHashTable *table, const void *key)
HashIntKey(const void *key)
{
return PLDHashNumber(NS_PTR_TO_INT32(key));
}
static bool
MatchWeightEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
MatchWeightEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const RuleByWeightEntry *entry = (const RuleByWeightEntry *)hdr;
return entry->data.mWeight == NS_PTR_TO_INT32(key);

View File

@ -164,7 +164,7 @@ struct MappedAttrTableEntry : public PLDHashEntryHdr {
};
static PLDHashNumber
MappedAttrTable_HashKey(PLDHashTable *table, const void *key)
MappedAttrTable_HashKey(const void *key)
{
nsMappedAttributes *attributes =
static_cast<nsMappedAttributes*>(const_cast<void*>(key));
@ -182,8 +182,7 @@ MappedAttrTable_ClearEntry(PLDHashTable *table, PLDHashEntryHdr *hdr)
}
static bool
MappedAttrTable_MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
MappedAttrTable_MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
nsMappedAttributes *attributes =
static_cast<nsMappedAttributes*>(const_cast<void*>(key));
@ -208,7 +207,7 @@ struct LangRuleTableEntry : public PLDHashEntryHdr {
};
static PLDHashNumber
LangRuleTable_HashKey(PLDHashTable *table, const void *key)
LangRuleTable_HashKey(const void *key)
{
const nsString *lang = static_cast<const nsString*>(key);
return HashString(*lang);
@ -224,8 +223,7 @@ LangRuleTable_ClearEntry(PLDHashTable *table, PLDHashEntryHdr *hdr)
}
static bool
LangRuleTable_MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
LangRuleTable_MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const nsString *lang = static_cast<const nsString*>(key);
const LangRuleTableEntry *entry = static_cast<const LangRuleTableEntry*>(hdr);

View File

@ -128,18 +128,17 @@ struct ChildrenHashEntry : public PLDHashEntryHdr {
};
/* static */ PLDHashNumber
nsRuleNode::ChildrenHashHashKey(PLDHashTable *aTable, const void *aKey)
nsRuleNode::ChildrenHashHashKey(const void *aKey)
{
const nsRuleNode::Key *key =
static_cast<const nsRuleNode::Key*>(aKey);
// Disagreement on importance and level for the same rule is extremely
// rare, so hash just on the rule.
return PLDHashTable::HashVoidPtrKeyStub(aTable, key->mRule);
return PLDHashTable::HashVoidPtrKeyStub(key->mRule);
}
/* static */ bool
nsRuleNode::ChildrenHashMatchEntry(PLDHashTable *aTable,
const PLDHashEntryHdr *aHdr,
nsRuleNode::ChildrenHashMatchEntry(const PLDHashEntryHdr *aHdr,
const void *aKey)
{
const ChildrenHashEntry *entry =

View File

@ -451,12 +451,10 @@ private:
};
static PLDHashNumber
ChildrenHashHashKey(PLDHashTable *aTable, const void *aKey);
ChildrenHashHashKey(const void *aKey);
static bool
ChildrenHashMatchEntry(PLDHashTable *aTable,
const PLDHashEntryHdr *aHdr,
const void *aKey);
ChildrenHashMatchEntry(const PLDHashEntryHdr *aHdr, const void *aKey);
void SweepChildren(nsTArray<nsRuleNode*>& aSweepQueue);
bool DestroyIfNotMarked();

View File

@ -37,14 +37,13 @@ SpanningCellSorter::HashTableOps = {
};
/* static */ PLDHashNumber
SpanningCellSorter::HashTableHashKey(PLDHashTable *table, const void *key)
SpanningCellSorter::HashTableHashKey(const void *key)
{
return NS_PTR_TO_INT32(key);
}
/* static */ bool
SpanningCellSorter::HashTableMatchEntry(PLDHashTable *table,
const PLDHashEntryHdr *hdr,
SpanningCellSorter::HashTableMatchEntry(const PLDHashEntryHdr *hdr,
const void *key)
{
const HashTableEntry *entry = static_cast<const HashTableEntry*>(hdr);

View File

@ -70,11 +70,9 @@ private:
static const PLDHashTableOps HashTableOps;
static PLDHashNumber
HashTableHashKey(PLDHashTable *table, const void *key);
static PLDHashNumber HashTableHashKey(const void *key);
static bool
HashTableMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key);
HashTableMatchEntry(const PLDHashEntryHdr *hdr, const void *key);
static int SortArray(const void *a, const void *b, void *closure);

View File

@ -54,8 +54,7 @@ clearPrefEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
}
static bool
matchPrefEntry(PLDHashTable*, const PLDHashEntryHdr* entry,
const void* key)
matchPrefEntry(const PLDHashEntryHdr* entry, const void* key)
{
const PrefHashEntry *prefEntry =
static_cast<const PrefHashEntry*>(entry);

View File

@ -56,8 +56,7 @@ public:
};
static bool
RequestHashMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *entry,
const void *key)
RequestHashMatchEntry(const PLDHashEntryHdr *entry, const void *key)
{
const RequestMapEntry *e =
static_cast<const RequestMapEntry *>(entry);

View File

@ -476,14 +476,13 @@ nsCacheEntryHashTable::Iter()
*/
PLDHashNumber
nsCacheEntryHashTable::HashKey( PLDHashTable *table, const void *key)
nsCacheEntryHashTable::HashKey(const void *key)
{
return HashString(*static_cast<const nsCString *>(key));
}
bool
nsCacheEntryHashTable::MatchEntry(PLDHashTable * /* table */,
const PLDHashEntryHdr * hashEntry,
nsCacheEntryHashTable::MatchEntry(const PLDHashEntryHdr * hashEntry,
const void * key)
{
NS_ASSERTION(key != nullptr, "### nsCacheEntryHashTable::MatchEntry : null key");

View File

@ -278,11 +278,10 @@ public:
private:
// PLDHashTable operation callbacks
static PLDHashNumber HashKey( PLDHashTable *table, const void *key);
static PLDHashNumber HashKey(const void *key);
static bool MatchEntry( PLDHashTable * table,
const PLDHashEntryHdr * entry,
const void * key);
static bool MatchEntry(const PLDHashEntryHdr * entry,
const void * key);
static void MoveEntry( PLDHashTable *table,
const PLDHashEntryHdr *from,

View File

@ -24,16 +24,15 @@ struct HashTableEntry : PLDHashEntryHdr {
static PLDHashNumber
HashKey( PLDHashTable *table, const void *key)
HashKey(const void *key)
{
return (PLDHashNumber) NS_PTR_TO_INT32(key);
}
static bool
MatchEntry(PLDHashTable * /* table */,
const PLDHashEntryHdr * header,
const void * key)
MatchEntry(const PLDHashEntryHdr * header,
const void * key)
{
HashTableEntry * hashEntry = (HashTableEntry *) header;
return (hashEntry->mBinding->mRecord.HashNumber() == (PLDHashNumber) NS_PTR_TO_INT32(key));

View File

@ -394,7 +394,7 @@ struct nsHostDBEnt : PLDHashEntryHdr
};
static PLDHashNumber
HostDB_HashKey(PLDHashTable *table, const void *key)
HostDB_HashKey(const void *key)
{
const nsHostKey *hk = static_cast<const nsHostKey *>(key);
return AddToHash(HashString(hk->host), RES_KEY_FLAGS(hk->flags), hk->af,
@ -402,8 +402,7 @@ HostDB_HashKey(PLDHashTable *table, const void *key)
}
static bool
HostDB_MatchEntry(PLDHashTable *table,
const PLDHashEntryHdr *entry,
HostDB_MatchEntry(const PLDHashEntryHdr *entry,
const void *key)
{
const nsHostDBEnt *he = static_cast<const nsHostDBEnt *>(entry);

View File

@ -61,7 +61,7 @@ NewHeapAtom(const char *value) {
// Hash string ignore case, based on PL_HashString
static PLDHashNumber
StringHash(PLDHashTable *table, const void *key)
StringHash(const void *key)
{
PLDHashNumber h = 0;
for (const char *s = reinterpret_cast<const char*>(key); *s; ++s)
@ -70,8 +70,7 @@ StringHash(PLDHashTable *table, const void *key)
}
static bool
StringCompare(PLDHashTable *table, const PLDHashEntryHdr *entry,
const void *testKey)
StringCompare(const PLDHashEntryHdr *entry, const void *testKey)
{
const void *entryKey =
reinterpret_cast<const PLDHashEntryStub *>(entry)->key;

View File

@ -23,30 +23,25 @@ struct EntityNodeEntry : public PLDHashEntryHdr
const EntityNode* node;
};
static bool
matchNodeString(PLDHashTable*, const PLDHashEntryHdr* aHdr,
const void* key)
static bool matchNodeString(const PLDHashEntryHdr* aHdr, const void* key)
{
const EntityNodeEntry* entry = static_cast<const EntityNodeEntry*>(aHdr);
const char* str = static_cast<const char*>(key);
return (nsCRT::strcmp(entry->node->mStr, str) == 0);
}
static bool
matchNodeUnicode(PLDHashTable*, const PLDHashEntryHdr* aHdr,
const void* key)
static bool matchNodeUnicode(const PLDHashEntryHdr* aHdr, const void* key)
{
const EntityNodeEntry* entry = static_cast<const EntityNodeEntry*>(aHdr);
const int32_t ucode = NS_PTR_TO_INT32(key);
return (entry->node->mUnicode == ucode);
}
static PLDHashNumber
hashUnicodeValue(PLDHashTable*, const void* key)
static PLDHashNumber hashUnicodeValue(const void* key)
{
// key is actually the unicode value
return PLDHashNumber(NS_PTR_TO_INT32(key));
}
}
static const PLDHashTableOps EntityToUnicodeOps = {

View File

@ -121,14 +121,13 @@ struct ResourceHashEntry : public PLDHashEntryHdr {
nsIRDFResource *mResource;
static PLDHashNumber
HashKey(PLDHashTable *table, const void *key)
HashKey(const void *key)
{
return HashString(static_cast<const char *>(key));
}
static bool
MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const ResourceHashEntry *entry =
static_cast<const ResourceHashEntry *>(hdr);
@ -156,14 +155,13 @@ struct LiteralHashEntry : public PLDHashEntryHdr {
const char16_t *mKey;
static PLDHashNumber
HashKey(PLDHashTable *table, const void *key)
HashKey(const void *key)
{
return HashString(static_cast<const char16_t *>(key));
}
static bool
MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const LiteralHashEntry *entry =
static_cast<const LiteralHashEntry *>(hdr);
@ -191,14 +189,13 @@ struct IntHashEntry : public PLDHashEntryHdr {
int32_t mKey;
static PLDHashNumber
HashKey(PLDHashTable *table, const void *key)
HashKey(const void *key)
{
return PLDHashNumber(*static_cast<const int32_t *>(key));
}
static bool
MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const IntHashEntry *entry =
static_cast<const IntHashEntry *>(hdr);
@ -225,7 +222,7 @@ struct DateHashEntry : public PLDHashEntryHdr {
PRTime mKey;
static PLDHashNumber
HashKey(PLDHashTable *table, const void *key)
HashKey(const void *key)
{
// xor the low 32 bits with the high 32 bits.
PRTime t = *static_cast<const PRTime *>(key);
@ -235,8 +232,7 @@ struct DateHashEntry : public PLDHashEntryHdr {
}
static bool
MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const DateHashEntry *entry =
static_cast<const DateHashEntry *>(hdr);
@ -338,7 +334,7 @@ struct BlobHashEntry : public PLDHashEntryHdr {
BlobImpl *mBlob;
static PLDHashNumber
HashKey(PLDHashTable *table, const void *key)
HashKey(const void *key)
{
const BlobImpl::Data *data =
static_cast<const BlobImpl::Data *>(key);
@ -346,8 +342,7 @@ struct BlobHashEntry : public PLDHashEntryHdr {
}
static bool
MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const BlobHashEntry *entry =
static_cast<const BlobHashEntry *>(hdr);

View File

@ -107,9 +107,7 @@ class nsCertOverrideEntry final : public PLDHashEntryHdr
static PLDHashNumber HashKey(KeyTypePointer aKey)
{
// PLDHashTable::HashStringKey doesn't use the table parameter, so we can
// safely pass nullptr
return PLDHashTable::HashStringKey(nullptr, aKey);
return PLDHashTable::HashStringKey(aKey);
}
enum { ALLOW_MEMMOVE = false };

View File

@ -61,8 +61,7 @@ CompareCacheHashEntry::CompareCacheHashEntry()
}
static bool
CompareCacheMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
CompareCacheMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const CompareCacheHashEntryPtr *entryPtr = static_cast<const CompareCacheHashEntryPtr*>(hdr);
return entryPtr->entry->key == key;

View File

@ -87,9 +87,7 @@ class nsClientAuthRememberEntry final : public PLDHashEntryHdr
static PLDHashNumber HashKey(KeyTypePointer aKey)
{
// PLDHashTable::HashStringKey doesn't use the table parameter, so we can
// safely pass nullptr
return PLDHashTable::HashStringKey(nullptr, aKey);
return PLDHashTable::HashStringKey(aKey);
}
enum { ALLOW_MEMMOVE = false };

View File

@ -14,8 +14,7 @@ struct ObjectHashEntry : PLDHashEntryHdr {
};
static bool
ObjectSetMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
ObjectSetMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const ObjectHashEntry *entry = static_cast<const ObjectHashEntry*>(hdr);
return entry->obj == static_cast<const nsNSSShutDownObject*>(key);

View File

@ -56,8 +56,7 @@ struct RequestHashEntry : PLDHashEntryHdr {
};
static bool
RequestMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
const void *key)
RequestMapMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
const RequestHashEntry *entry = static_cast<const RequestHashEntry*>(hdr);
return entry->r == key;

View File

@ -794,9 +794,7 @@ struct PtrToNodeEntry : public PLDHashEntryHdr
};
static bool
PtrToNodeMatchEntry(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry,
const void* aKey)
PtrToNodeMatchEntry(const PLDHashEntryHdr* aEntry, const void* aKey)
{
const PtrToNodeEntry* n = static_cast<const PtrToNodeEntry*>(aEntry);
return n->mNode->mPointer == aKey;

View File

@ -756,15 +756,14 @@ struct SegmentKind
struct SegmentEntry : public PLDHashEntryHdr
{
static PLDHashNumber HashKey(PLDHashTable* aTable, const void* aKey)
static PLDHashNumber HashKey(const void* aKey)
{
auto kind = static_cast<const SegmentKind*>(aKey);
return mozilla::HashGeneric(kind->mState, kind->mType, kind->mProtect,
kind->mIsStack);
}
static bool MatchEntry(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry, const void* aKey)
static bool MatchEntry(const PLDHashEntryHdr* aEntry, const void* aKey)
{
auto kind = static_cast<const SegmentKind*>(aKey);
auto entry = static_cast<const SegmentEntry*>(aEntry);

View File

@ -236,15 +236,14 @@ struct AtomTableKey
};
static PLDHashNumber
AtomTableGetHash(PLDHashTable* aTable, const void* aKey)
AtomTableGetHash(const void* aKey)
{
const AtomTableKey* k = static_cast<const AtomTableKey*>(aKey);
return k->mHash;
}
static bool
AtomTableMatchKey(PLDHashTable* aTable, const PLDHashEntryHdr* aEntry,
const void* aKey)
AtomTableMatchKey(const PLDHashEntryHdr* aEntry, const void* aKey)
{
const AtomTableEntry* he = static_cast<const AtomTableEntry*>(aEntry);
const AtomTableKey* k = static_cast<const AtomTableKey*>(aKey);

View File

@ -50,8 +50,7 @@ struct NameTableEntry : public PLDHashEntryHdr
};
static bool
matchNameKeysCaseInsensitive(PLDHashTable*, const PLDHashEntryHdr* aHdr,
const void* aVoidKey)
matchNameKeysCaseInsensitive(const PLDHashEntryHdr* aHdr, const void* aVoidKey)
{
auto entry = static_cast<const NameTableEntry*>(aHdr);
auto key = static_cast<const NameTableKey*>(aVoidKey);
@ -71,7 +70,7 @@ matchNameKeysCaseInsensitive(PLDHashTable*, const PLDHashEntryHdr* aHdr,
* matter.
*/
static PLDHashNumber
caseInsensitiveStringHashKey(PLDHashTable* aTable, const void* aKey)
caseInsensitiveStringHashKey(const void* aKey)
{
PLDHashNumber h = 0;
const NameTableKey* tableKey = static_cast<const NameTableKey*>(aKey);

View File

@ -63,21 +63,19 @@ public:
#endif
/* static */ PLDHashNumber
PLDHashTable::HashStringKey(PLDHashTable* aTable, const void* aKey)
PLDHashTable::HashStringKey(const void* aKey)
{
return HashString(static_cast<const char*>(aKey));
}
/* static */ PLDHashNumber
PLDHashTable::HashVoidPtrKeyStub(PLDHashTable* aTable, const void* aKey)
PLDHashTable::HashVoidPtrKeyStub(const void* aKey)
{
return (PLDHashNumber)(ptrdiff_t)aKey >> 2;
}
/* static */ bool
PLDHashTable::MatchEntryStub(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry,
const void* aKey)
PLDHashTable::MatchEntryStub(const PLDHashEntryHdr* aEntry, const void* aKey)
{
const PLDHashEntryStub* stub = (const PLDHashEntryStub*)aEntry;
@ -85,9 +83,7 @@ PLDHashTable::MatchEntryStub(PLDHashTable* aTable,
}
/* static */ bool
PLDHashTable::MatchStringKey(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry,
const void* aKey)
PLDHashTable::MatchStringKey(const PLDHashEntryHdr* aEntry, const void* aKey)
{
const PLDHashEntryStub* stub = (const PLDHashEntryStub*)aEntry;
@ -355,7 +351,7 @@ PLDHashTable::SearchTable(const void* aKey, PLDHashNumber aKeyHash)
// Hit: return entry.
PLDHashMatchEntry matchEntry = mOps->matchEntry;
if (MatchEntryKeyhash(entry, aKeyHash) &&
matchEntry(this, entry, aKey)) {
matchEntry(entry, aKey)) {
return entry;
}
@ -389,7 +385,7 @@ PLDHashTable::SearchTable(const void* aKey, PLDHashNumber aKeyHash)
}
if (MatchEntryKeyhash(entry, aKeyHash) &&
matchEntry(this, entry, aKey)) {
matchEntry(entry, aKey)) {
return entry;
}
}
@ -501,7 +497,7 @@ PLDHashTable::ComputeKeyHash(const void* aKey)
{
MOZ_ASSERT(mEntryStore.Get());
PLDHashNumber keyHash = mOps->hashKey(this, aKey);
PLDHashNumber keyHash = mOps->hashKey(aKey);
keyHash *= kGoldenRatio;
// Avoid 0 and 1 hash codes, they indicate free and removed entries.

View File

@ -396,18 +396,15 @@ public:
static const PLDHashTableOps* StubOps();
// The individual stub operations in StubOps().
static PLDHashNumber HashVoidPtrKeyStub(PLDHashTable* aTable,
const void* aKey);
static bool MatchEntryStub(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry, const void* aKey);
static PLDHashNumber HashVoidPtrKeyStub(const void* aKey);
static bool MatchEntryStub(const PLDHashEntryHdr* aEntry, const void* aKey);
static void MoveEntryStub(PLDHashTable* aTable, const PLDHashEntryHdr* aFrom,
PLDHashEntryHdr* aTo);
static void ClearEntryStub(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);
// Hash/match operations for tables holding C strings.
static PLDHashNumber HashStringKey(PLDHashTable* aTable, const void* aKey);
static bool MatchStringKey(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry, const void* aKey);
static PLDHashNumber HashStringKey(const void* aKey);
static bool MatchStringKey(const PLDHashEntryHdr* aEntry, const void* aKey);
// This is an iterator for PLDHashtable. Assertions will detect some, but not
// all, mid-iteration table modifications that might invalidate (e.g.
@ -555,15 +552,13 @@ private:
PLDHashTable& operator=(const PLDHashTable& aOther) = delete;
};
// 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.
typedef PLDHashNumber (*PLDHashHashKey)(PLDHashTable* aTable,
const void* aKey);
// Compute the hash code for a given key to be looked up, added, or removed.
// A hash code may have any PLDHashNumber value.
typedef PLDHashNumber (*PLDHashHashKey)(const void* aKey);
// Compare the key identifying aEntry in aTable with the provided key parameter.
// Return true if keys match, false otherwise.
typedef bool (*PLDHashMatchEntry)(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry,
// Compare the key identifying aEntry with the provided key parameter. Return
// true if keys match, false otherwise.
typedef bool (*PLDHashMatchEntry)(const PLDHashEntryHdr* aEntry,
const void* aKey);
// Copy the data starting at aFrom to the new entry storage at aTo. Do not add

View File

@ -303,11 +303,9 @@ public:
protected:
PLDHashTable mTable;
static const void* s_GetKey(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);
static PLDHashNumber s_HashKey(const void* aKey);
static PLDHashNumber s_HashKey(PLDHashTable* aTable, const void* aKey);
static bool s_MatchEntry(PLDHashTable* aTable, const PLDHashEntryHdr* aEntry,
static bool s_MatchEntry(const PLDHashEntryHdr* aEntry,
const void* aKey);
static void s_CopyEntry(PLDHashTable* aTable, const PLDHashEntryHdr* aFrom,
@ -370,15 +368,14 @@ nsTHashtable<EntryType>::Ops()
template<class EntryType>
PLDHashNumber
nsTHashtable<EntryType>::s_HashKey(PLDHashTable* aTable, const void* aKey)
nsTHashtable<EntryType>::s_HashKey(const void* aKey)
{
return EntryType::HashKey(static_cast<const KeyTypePointer>(aKey));
}
template<class EntryType>
bool
nsTHashtable<EntryType>::s_MatchEntry(PLDHashTable* aTable,
const PLDHashEntryHdr* aEntry,
nsTHashtable<EntryType>::s_MatchEntry(const PLDHashEntryHdr* aEntry,
const void* aKey)
{
return ((const EntryType*)aEntry)->KeyEquals(

View File

@ -157,7 +157,7 @@ TEST(PLDHashTableTest, LazyStorage)
// GrowToMaxCapacity test because we insert the integers 0.., which means it's
// collision-free.
static PLDHashNumber
TrivialHash(PLDHashTable *table, const void *key)
TrivialHash(const void *key)
{
return (PLDHashNumber)(size_t)key;
}