Bug 1120476 (part 3) - Remove PLDHashTable::data. r=froydnj.
This commit is contained in:
@@ -219,7 +219,7 @@ NS_GetContentList(nsINode* aRootNode,
|
||||
|
||||
// Initialize the hashtable if needed.
|
||||
if (!gContentListHashTable.ops) {
|
||||
PL_DHashTableInit(&gContentListHashTable, &hash_table_ops, nullptr,
|
||||
PL_DHashTableInit(&gContentListHashTable, &hash_table_ops,
|
||||
sizeof(ContentListHashEntry));
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ GetFuncStringContentList(nsINode* aRootNode,
|
||||
// Initialize the hashtable if needed.
|
||||
if (!gFuncStringContentListHashTable.ops) {
|
||||
PL_DHashTableInit(&gFuncStringContentListHashTable, &hash_table_ops,
|
||||
nullptr, sizeof(FuncStringContentListHashEntry));
|
||||
sizeof(FuncStringContentListHashEntry));
|
||||
}
|
||||
|
||||
FuncStringContentListHashEntry *entry = nullptr;
|
||||
|
||||
@@ -490,7 +490,7 @@ nsContentUtils::Init()
|
||||
};
|
||||
|
||||
PL_DHashTableInit(&sEventListenerManagersHash, &hash_table_ops,
|
||||
nullptr, sizeof(EventListenerManagerMapEntry));
|
||||
sizeof(EventListenerManagerMapEntry));
|
||||
|
||||
RegisterStrongMemoryReporter(new DOMEventListenerManagersHashReporter());
|
||||
}
|
||||
|
||||
@@ -3982,8 +3982,7 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
|
||||
SubDocInitEntry
|
||||
};
|
||||
|
||||
mSubDocuments = PL_NewDHashTable(&hash_table_ops, nullptr,
|
||||
sizeof(SubDocMapEntry));
|
||||
mSubDocuments = PL_NewDHashTable(&hash_table_ops, sizeof(SubDocMapEntry));
|
||||
if (!mSubDocuments) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ nsPropertyTable::PropertyList::PropertyList(nsIAtom *aName,
|
||||
mTransfer(aTransfer),
|
||||
mNext(nullptr)
|
||||
{
|
||||
PL_DHashTableInit(&mObjectValueMap, PL_DHashGetStubOps(), nullptr,
|
||||
PL_DHashTableInit(&mObjectValueMap, PL_DHashGetStubOps(),
|
||||
sizeof(PropertyListMapEntry));
|
||||
}
|
||||
|
||||
|
||||
@@ -331,13 +331,13 @@ nsScriptNameSpaceManager::Init()
|
||||
};
|
||||
|
||||
mIsInitialized = PL_DHashTableInit(&mGlobalNames, &hash_table_ops,
|
||||
nullptr, sizeof(GlobalNameMapEntry),
|
||||
sizeof(GlobalNameMapEntry),
|
||||
fallible_t(),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_LENGTH);
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mIsInitialized = PL_DHashTableInit(&mNavigatorNames, &hash_table_ops,
|
||||
nullptr, sizeof(GlobalNameMapEntry),
|
||||
sizeof(GlobalNameMapEntry),
|
||||
fallible_t(),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_LENGTH);
|
||||
if (!mIsInitialized) {
|
||||
|
||||
@@ -408,7 +408,7 @@ CreateNPObjWrapperTable()
|
||||
return false;
|
||||
}
|
||||
|
||||
PL_DHashTableInit(&sNPObjWrappers, PL_DHashGetStubOps(), nullptr,
|
||||
PL_DHashTableInit(&sNPObjWrappers, PL_DHashGetStubOps(),
|
||||
sizeof(NPObjWrapperHashEntry));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -771,8 +771,7 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
|
||||
};
|
||||
|
||||
if (! mBroadcasterMap) {
|
||||
mBroadcasterMap =
|
||||
PL_NewDHashTable(&gOps, nullptr, sizeof(BroadcasterMapEntry));
|
||||
mBroadcasterMap = PL_NewDHashTable(&gOps, sizeof(BroadcasterMapEntry));
|
||||
|
||||
if (! mBroadcasterMap) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
void
|
||||
nsContentSupportMap::Init()
|
||||
{
|
||||
PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr, sizeof(Entry));
|
||||
PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), sizeof(Entry));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -22,8 +22,7 @@ protected:
|
||||
void
|
||||
Init()
|
||||
{
|
||||
PL_DHashTableInit(&mTable, PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry));
|
||||
PL_DHashTableInit(&mTable, PL_DHashGetStubOps(), sizeof(Entry));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -40,7 +40,7 @@ nsCommandParams::~nsCommandParams()
|
||||
nsresult
|
||||
nsCommandParams::Init()
|
||||
{
|
||||
PL_DHashTableInit(&mValuesHash, &sHashOps, nullptr, sizeof(HashEntry), 2);
|
||||
PL_DHashTableInit(&mValuesHash, &sHashOps, sizeof(HashEntry), 2);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -632,7 +632,7 @@ public:
|
||||
nullptr
|
||||
};
|
||||
|
||||
PL_DHashTableInit(&mMap, &mOps, nullptr, sizeof(FNCMapEntry), 0);
|
||||
PL_DHashTableInit(&mMap, &mOps, sizeof(FNCMapEntry), 0);
|
||||
|
||||
NS_ABORT_IF_FALSE(XRE_GetProcessType() == GeckoProcessType_Default,
|
||||
"StartupCacheFontNameCache should only be used in chrome process");
|
||||
|
||||
@@ -182,8 +182,7 @@ Native2WrappedNativeMap::newMap(int length)
|
||||
|
||||
Native2WrappedNativeMap::Native2WrappedNativeMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry), length);
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), sizeof(Entry), length);
|
||||
}
|
||||
|
||||
Native2WrappedNativeMap::~Native2WrappedNativeMap()
|
||||
@@ -235,7 +234,7 @@ IID2WrappedJSClassMap::newMap(int length)
|
||||
|
||||
IID2WrappedJSClassMap::IID2WrappedJSClassMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
IID2WrappedJSClassMap::~IID2WrappedJSClassMap()
|
||||
@@ -272,7 +271,7 @@ IID2NativeInterfaceMap::newMap(int length)
|
||||
|
||||
IID2NativeInterfaceMap::IID2NativeInterfaceMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
IID2NativeInterfaceMap::~IID2NativeInterfaceMap()
|
||||
@@ -314,8 +313,7 @@ ClassInfo2NativeSetMap::newMap(int length)
|
||||
|
||||
ClassInfo2NativeSetMap::ClassInfo2NativeSetMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry), length);
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), sizeof(Entry), length);
|
||||
}
|
||||
|
||||
ClassInfo2NativeSetMap::~ClassInfo2NativeSetMap()
|
||||
@@ -354,8 +352,7 @@ ClassInfo2WrappedNativeProtoMap::newMap(int length)
|
||||
|
||||
ClassInfo2WrappedNativeProtoMap::ClassInfo2WrappedNativeProtoMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), nullptr,
|
||||
sizeof(Entry), length);
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), sizeof(Entry), length);
|
||||
}
|
||||
|
||||
ClassInfo2WrappedNativeProtoMap::~ClassInfo2WrappedNativeProtoMap()
|
||||
@@ -479,7 +476,7 @@ NativeSetMap::newMap(int length)
|
||||
|
||||
NativeSetMap::NativeSetMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
NativeSetMap::~NativeSetMap()
|
||||
@@ -546,7 +543,7 @@ IID2ThisTranslatorMap::newMap(int length)
|
||||
|
||||
IID2ThisTranslatorMap::IID2ThisTranslatorMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
IID2ThisTranslatorMap::~IID2ThisTranslatorMap()
|
||||
@@ -626,7 +623,7 @@ XPCNativeScriptableSharedMap::newMap(int length)
|
||||
|
||||
XPCNativeScriptableSharedMap::XPCNativeScriptableSharedMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, nullptr, sizeof(Entry), length);
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
XPCNativeScriptableSharedMap::~XPCNativeScriptableSharedMap()
|
||||
@@ -677,7 +674,7 @@ XPCWrappedNativeProtoMap::newMap(int length)
|
||||
|
||||
XPCWrappedNativeProtoMap::XPCWrappedNativeProtoMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), nullptr,
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(),
|
||||
sizeof(PLDHashEntryStub), length);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ nsFrameManager::RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame)
|
||||
NS_PRECONDITION(nsGkAtoms::placeholderFrame == aPlaceholderFrame->GetType(),
|
||||
"unexpected frame type");
|
||||
if (!mPlaceholderMap.ops) {
|
||||
PL_DHashTableInit(&mPlaceholderMap, &PlaceholderMapOps, nullptr,
|
||||
PL_DHashTableInit(&mPlaceholderMap, &PlaceholderMapOps,
|
||||
sizeof(PlaceholderMapEntry));
|
||||
}
|
||||
PlaceholderMapEntry *entry = static_cast<PlaceholderMapEntry*>(PL_DHashTableAdd(&mPlaceholderMap,
|
||||
|
||||
@@ -633,7 +633,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
|
||||
PL_DHashTableInit(&mIdTable,
|
||||
mQuirksMode ? &RuleHash_IdTable_CIOps.ops
|
||||
: &RuleHash_IdTable_CSOps.ops,
|
||||
nullptr, sizeof(RuleHashTableEntry));
|
||||
sizeof(RuleHashTableEntry));
|
||||
}
|
||||
AppendRuleToTable(&mIdTable, selector->mIDList->mAtom, aRuleInfo);
|
||||
RULE_HASH_STAT_INCREMENT(mIdSelectors);
|
||||
@@ -643,7 +643,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
|
||||
PL_DHashTableInit(&mClassTable,
|
||||
mQuirksMode ? &RuleHash_ClassTable_CIOps.ops
|
||||
: &RuleHash_ClassTable_CSOps.ops,
|
||||
nullptr, sizeof(RuleHashTableEntry));
|
||||
sizeof(RuleHashTableEntry));
|
||||
}
|
||||
AppendRuleToTable(&mClassTable, selector->mClassList->mAtom, aRuleInfo);
|
||||
RULE_HASH_STAT_INCREMENT(mClassSelectors);
|
||||
@@ -651,7 +651,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
|
||||
else if (selector->mLowercaseTag) {
|
||||
RuleValue ruleValue(aRuleInfo, mRuleCount++, mQuirksMode);
|
||||
if (!mTagTable.ops) {
|
||||
PL_DHashTableInit(&mTagTable, &RuleHash_TagTable_Ops, nullptr,
|
||||
PL_DHashTableInit(&mTagTable, &RuleHash_TagTable_Ops,
|
||||
sizeof(RuleHashTagTableEntry));
|
||||
}
|
||||
AppendRuleToTagTable(&mTagTable, selector->mLowercaseTag, ruleValue);
|
||||
@@ -664,7 +664,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
|
||||
}
|
||||
else if (kNameSpaceID_Unknown != selector->mNameSpace) {
|
||||
if (!mNameSpaceTable.ops) {
|
||||
PL_DHashTableInit(&mNameSpaceTable, &RuleHash_NameSpaceTable_Ops, nullptr,
|
||||
PL_DHashTableInit(&mNameSpaceTable, &RuleHash_NameSpaceTable_Ops,
|
||||
sizeof(RuleHashTableEntry));
|
||||
}
|
||||
AppendRuleToTable(&mNameSpaceTable,
|
||||
@@ -933,21 +933,21 @@ struct RuleCascadeData {
|
||||
{
|
||||
// mAttributeSelectors is matching on the attribute _name_, not the value,
|
||||
// and we case-fold names at parse-time, so this is a case-sensitive match.
|
||||
PL_DHashTableInit(&mAttributeSelectors, &AtomSelector_CSOps, nullptr,
|
||||
PL_DHashTableInit(&mAttributeSelectors, &AtomSelector_CSOps,
|
||||
sizeof(AtomSelectorEntry));
|
||||
PL_DHashTableInit(&mAnonBoxRules, &RuleHash_TagTable_Ops, nullptr,
|
||||
PL_DHashTableInit(&mAnonBoxRules, &RuleHash_TagTable_Ops,
|
||||
sizeof(RuleHashTagTableEntry));
|
||||
PL_DHashTableInit(&mIdSelectors,
|
||||
aQuirksMode ? &AtomSelector_CIOps.ops :
|
||||
&AtomSelector_CSOps,
|
||||
nullptr, sizeof(AtomSelectorEntry));
|
||||
sizeof(AtomSelectorEntry));
|
||||
PL_DHashTableInit(&mClassSelectors,
|
||||
aQuirksMode ? &AtomSelector_CIOps.ops :
|
||||
&AtomSelector_CSOps,
|
||||
nullptr, sizeof(AtomSelectorEntry));
|
||||
sizeof(AtomSelectorEntry));
|
||||
memset(mPseudoElementRuleHashes, 0, sizeof(mPseudoElementRuleHashes));
|
||||
#ifdef MOZ_XUL
|
||||
PL_DHashTableInit(&mXULTreeRules, &RuleHash_TagTable_Ops, nullptr,
|
||||
PL_DHashTableInit(&mXULTreeRules, &RuleHash_TagTable_Ops,
|
||||
sizeof(RuleHashTagTableEntry));
|
||||
#endif
|
||||
}
|
||||
@@ -3373,7 +3373,7 @@ struct CascadeEnumData {
|
||||
mCacheKey(aKey),
|
||||
mSheetType(aSheetType)
|
||||
{
|
||||
if (!PL_DHashTableInit(&mRulesByWeight, &gRulesByWeightOps, nullptr,
|
||||
if (!PL_DHashTableInit(&mRulesByWeight, &gRulesByWeightOps,
|
||||
sizeof(RuleByWeightEntry), fallible_t(), 32))
|
||||
mRulesByWeight.ops = nullptr;
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ nsHTMLStyleSheet::UniqueMappedAttributes(nsMappedAttributes* aMapped)
|
||||
{
|
||||
if (!mMappedAttrTable.ops) {
|
||||
PL_DHashTableInit(&mMappedAttrTable, &MappedAttrTable_Ops,
|
||||
nullptr, sizeof(MappedAttrTableEntry));
|
||||
sizeof(MappedAttrTableEntry));
|
||||
}
|
||||
MappedAttrTableEntry *entry = static_cast<MappedAttrTableEntry*>
|
||||
(PL_DHashTableAdd(&mMappedAttrTable, aMapped));
|
||||
@@ -523,7 +523,7 @@ nsHTMLStyleSheet::LangRuleFor(const nsString& aLanguage)
|
||||
{
|
||||
if (!mLangRuleTable.ops) {
|
||||
PL_DHashTableInit(&mLangRuleTable, &LangRuleTable_Ops,
|
||||
nullptr, sizeof(LangRuleTableEntry));
|
||||
sizeof(LangRuleTableEntry));
|
||||
}
|
||||
LangRuleTableEntry *entry = static_cast<LangRuleTableEntry*>
|
||||
(PL_DHashTableAdd(&mLangRuleTable, &aLanguage));
|
||||
|
||||
@@ -1607,7 +1607,7 @@ nsRuleNode::ConvertChildrenToHash(int32_t aNumKids)
|
||||
{
|
||||
NS_ASSERTION(!ChildrenAreHashed() && HaveChildren(),
|
||||
"must have a non-empty list of children");
|
||||
PLDHashTable *hash = PL_NewDHashTable(&ChildrenHashOps, nullptr,
|
||||
PLDHashTable *hash = PL_NewDHashTable(&ChildrenHashOps,
|
||||
sizeof(ChildrenHashEntry),
|
||||
aNumKids);
|
||||
if (!hash)
|
||||
|
||||
@@ -76,7 +76,7 @@ SpanningCellSorter::AddCell(int32_t aColSpan, int32_t aRow, int32_t aCol)
|
||||
mArray[index] = i;
|
||||
} else {
|
||||
if (!mHashTable.ops) {
|
||||
PL_DHashTableInit(&mHashTable, &HashTableOps, nullptr,
|
||||
PL_DHashTableInit(&mHashTable, &HashTableOps,
|
||||
sizeof(HashTableEntry));
|
||||
}
|
||||
HashTableEntry *entry = static_cast<HashTableEntry*>
|
||||
|
||||
@@ -149,7 +149,7 @@ static nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, u
|
||||
nsresult PREF_Init()
|
||||
{
|
||||
if (!gHashTable.ops) {
|
||||
if (!PL_DHashTableInit(&gHashTable, &pref_HashTableOps, nullptr,
|
||||
if (!PL_DHashTableInit(&gHashTable, &pref_HashTableOps,
|
||||
sizeof(PrefHashEntry), fallible_t(),
|
||||
PREF_HASHTABLE_INITIAL_LENGTH)) {
|
||||
gHashTable.ops = nullptr;
|
||||
|
||||
@@ -1166,7 +1166,7 @@ nsresult nsLoadGroup::Init()
|
||||
RequestHashInitEntry
|
||||
};
|
||||
|
||||
PL_DHashTableInit(&mRequests, &hash_table_ops, nullptr,
|
||||
PL_DHashTableInit(&mRequests, &hash_table_ops,
|
||||
sizeof(RequestMapEntry));
|
||||
|
||||
mConnectionInfo = new nsLoadGroupConnectionInfo();
|
||||
|
||||
2
netwerk/cache/nsCacheEntry.cpp
vendored
2
netwerk/cache/nsCacheEntry.cpp
vendored
@@ -406,7 +406,7 @@ nsresult
|
||||
nsCacheEntryHashTable::Init()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
initialized = PL_DHashTableInit(&table, &ops, nullptr,
|
||||
initialized = PL_DHashTableInit(&table, &ops,
|
||||
sizeof(nsCacheEntryHashTableEntry),
|
||||
fallible_t(), 256);
|
||||
|
||||
|
||||
2
netwerk/cache/nsDiskCacheBinding.cpp
vendored
2
netwerk/cache/nsDiskCacheBinding.cpp
vendored
@@ -150,7 +150,7 @@ nsresult
|
||||
nsDiskCacheBindery::Init()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PL_DHashTableInit(&table, &ops, nullptr, sizeof(HashTableEntry), 0);
|
||||
PL_DHashTableInit(&table, &ops, sizeof(HashTableEntry), 0);
|
||||
initialized = true;
|
||||
|
||||
return rv;
|
||||
|
||||
@@ -557,7 +557,7 @@ nsHostResolver::Init()
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PL_DHashTableInit(&mDB, &gHostDB_ops, nullptr, sizeof(nsHostDBEnt), 0);
|
||||
PL_DHashTableInit(&mDB, &gHostDB_ops, sizeof(nsHostDBEnt), 0);
|
||||
|
||||
mShutdown = false;
|
||||
|
||||
|
||||
@@ -108,8 +108,7 @@ nsHttp::CreateAtomTable()
|
||||
// The initial length for this table is a value greater than the number of
|
||||
// known atoms (NUM_HTTP_ATOMS) because we expect to encounter a few random
|
||||
// headers right off the bat.
|
||||
if (!PL_DHashTableInit(&sAtomTable, &ops, nullptr,
|
||||
sizeof(PLDHashEntryStub),
|
||||
if (!PL_DHashTableInit(&sAtomTable, &ops, sizeof(PLDHashEntryStub),
|
||||
fallible_t(), NUM_HTTP_ATOMS + 10)) {
|
||||
sAtomTable.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@@ -90,13 +90,13 @@ nsHTMLEntities::AddRefTable(void)
|
||||
{
|
||||
if (!gTableRefCnt) {
|
||||
if (!PL_DHashTableInit(&gEntityToUnicode, &EntityToUnicodeOps,
|
||||
nullptr, sizeof(EntityNodeEntry),
|
||||
sizeof(EntityNodeEntry),
|
||||
fallible_t(), NS_HTML_ENTITY_COUNT)) {
|
||||
gEntityToUnicode.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!PL_DHashTableInit(&gUnicodeToEntity, &UnicodeToEntityOps,
|
||||
nullptr, sizeof(EntityNodeEntry),
|
||||
sizeof(EntityNodeEntry),
|
||||
fallible_t(), NS_HTML_ENTITY_COUNT)) {
|
||||
PL_DHashTableFinish(&gEntityToUnicode);
|
||||
gEntityToUnicode.ops = gUnicodeToEntity.ops = nullptr;
|
||||
|
||||
@@ -164,7 +164,7 @@ Assertion::Assertion(nsIRDFResource* aSource)
|
||||
NS_ADDREF(mSource);
|
||||
|
||||
u.hash.mPropertyHash =
|
||||
PL_NewDHashTable(PL_DHashGetStubOps(), nullptr, sizeof(Entry));
|
||||
PL_NewDHashTable(PL_DHashGetStubOps(), sizeof(Entry));
|
||||
}
|
||||
|
||||
Assertion::Assertion(nsIRDFResource* aSource,
|
||||
@@ -790,15 +790,8 @@ InMemoryDataSource::InMemoryDataSource(nsISupports* aOuter)
|
||||
nsresult
|
||||
InMemoryDataSource::Init()
|
||||
{
|
||||
PL_DHashTableInit(&mForwardArcs,
|
||||
PL_DHashGetStubOps(),
|
||||
nullptr,
|
||||
sizeof(Entry));
|
||||
|
||||
PL_DHashTableInit(&mReverseArcs,
|
||||
PL_DHashGetStubOps(),
|
||||
nullptr,
|
||||
sizeof(Entry));
|
||||
PL_DHashTableInit(&mForwardArcs, PL_DHashGetStubOps(), sizeof(Entry));
|
||||
PL_DHashTableInit(&mReverseArcs, PL_DHashGetStubOps(), sizeof(Entry));
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (! gLog)
|
||||
|
||||
@@ -760,20 +760,16 @@ RDFServiceImpl::Init()
|
||||
if (! mNamedDataSources)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PL_DHashTableInit(&mResources, &gResourceTableOps, nullptr,
|
||||
PL_DHashTableInit(&mResources, &gResourceTableOps,
|
||||
sizeof(ResourceHashEntry));
|
||||
|
||||
PL_DHashTableInit(&mLiterals, &gLiteralTableOps, nullptr,
|
||||
sizeof(LiteralHashEntry));
|
||||
PL_DHashTableInit(&mLiterals, &gLiteralTableOps, sizeof(LiteralHashEntry));
|
||||
|
||||
PL_DHashTableInit(&mInts, &gIntTableOps, nullptr,
|
||||
sizeof(IntHashEntry));
|
||||
PL_DHashTableInit(&mInts, &gIntTableOps, sizeof(IntHashEntry));
|
||||
|
||||
PL_DHashTableInit(&mDates, &gDateTableOps, nullptr,
|
||||
sizeof(DateHashEntry));
|
||||
PL_DHashTableInit(&mDates, &gDateTableOps, sizeof(DateHashEntry));
|
||||
|
||||
PL_DHashTableInit(&mBlobs, &gBlobTableOps, nullptr,
|
||||
sizeof(BlobHashEntry));
|
||||
PL_DHashTableInit(&mBlobs, &gBlobTableOps, sizeof(BlobHashEntry));
|
||||
|
||||
mDefaultResourceFactory = do_GetClassObject(kRDFDefaultResourceCID, &rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get default resource factory");
|
||||
|
||||
@@ -476,8 +476,7 @@ void nsSecureBrowserUIImpl::ResetStateTracking()
|
||||
PL_DHashTableFinish(&mTransferringRequests);
|
||||
mTransferringRequests.ops = nullptr;
|
||||
}
|
||||
PL_DHashTableInit(&mTransferringRequests, &gMapOps, nullptr,
|
||||
sizeof(RequestHashEntry));
|
||||
PL_DHashTableInit(&mTransferringRequests, &gMapOps, sizeof(RequestHashEntry));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -186,7 +186,7 @@ void nsCertTree::ClearCompareHash()
|
||||
nsresult nsCertTree::InitCompareHash()
|
||||
{
|
||||
ClearCompareHash();
|
||||
if (!PL_DHashTableInit(&mCompareCache, &gMapOps, nullptr,
|
||||
if (!PL_DHashTableInit(&mCompareCache, &gMapOps,
|
||||
sizeof(CompareCacheHashEntryPtr), fallible_t(), 64)) {
|
||||
mCompareCache.ops = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@@ -51,9 +51,8 @@ nsNSSShutDownList::nsNSSShutDownList()
|
||||
mActiveSSLSockets = 0;
|
||||
mPK11LogoutCancelObjects.ops = nullptr;
|
||||
mObjects.ops = nullptr;
|
||||
PL_DHashTableInit(&mObjects, &gSetOps, nullptr,
|
||||
sizeof(ObjectHashEntry));
|
||||
PL_DHashTableInit(&mPK11LogoutCancelObjects, &gSetOps, nullptr,
|
||||
PL_DHashTableInit(&mObjects, &gSetOps, sizeof(ObjectHashEntry));
|
||||
PL_DHashTableInit(&mPK11LogoutCancelObjects, &gSetOps,
|
||||
sizeof(ObjectHashEntry));
|
||||
}
|
||||
|
||||
|
||||
@@ -124,8 +124,7 @@ nsDocLoader::nsDocLoader()
|
||||
RequestInfoHashInitEntry
|
||||
};
|
||||
|
||||
PL_DHashTableInit(&mRequestInfoHash, &hash_table_ops, nullptr,
|
||||
sizeof(nsRequestInfo));
|
||||
PL_DHashTableInit(&mRequestInfoHash, &hash_table_ops, sizeof(nsRequestInfo));
|
||||
|
||||
ClearInternalProgress();
|
||||
|
||||
|
||||
@@ -849,7 +849,7 @@ public:
|
||||
void Init()
|
||||
{
|
||||
MOZ_ASSERT(IsEmpty(), "Failed to call CCGraph::Clear");
|
||||
PL_DHashTableInit(&mPtrToNodeMap, &PtrNodeOps, nullptr,
|
||||
PL_DHashTableInit(&mPtrToNodeMap, &PtrNodeOps,
|
||||
sizeof(PtrToNodeEntry), 16384);
|
||||
}
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ static inline void
|
||||
EnsureTableExists()
|
||||
{
|
||||
if (!gAtomTable.ops) {
|
||||
PL_DHashTableInit(&gAtomTable, &AtomTableOps, 0,
|
||||
PL_DHashTableInit(&gAtomTable, &AtomTableOps,
|
||||
sizeof(AtomTableEntry), ATOM_HASHTABLE_INITIAL_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ nsPersistentProperties::nsPersistentProperties()
|
||||
{
|
||||
mSubclass = static_cast<nsIPersistentProperties*>(this);
|
||||
|
||||
PL_DHashTableInit(&mTable, &property_HashTableOps, nullptr,
|
||||
PL_DHashTableInit(&mTable, &property_HashTableOps,
|
||||
sizeof(PropertyTableEntry), 16);
|
||||
|
||||
PL_INIT_ARENA_POOL(&mArena, "PersistentPropertyArena", 2048);
|
||||
|
||||
@@ -143,7 +143,7 @@ nsStaticCaseInsensitiveNameTable::Init(const char* const aNames[],
|
||||
}
|
||||
|
||||
if (!PL_DHashTableInit(&mNameTable, &nametable_CaseInsensitiveHashTableOps,
|
||||
nullptr, sizeof(NameTableEntry), fallible_t(),
|
||||
sizeof(NameTableEntry), fallible_t(),
|
||||
aLength)) {
|
||||
mNameTable.ops = nullptr;
|
||||
return false;
|
||||
|
||||
@@ -429,7 +429,7 @@ nsTHashtable<EntryType>::Init(uint32_t aInitLength)
|
||||
s_InitEntry
|
||||
};
|
||||
|
||||
PL_DHashTableInit(&mTable, &sOps, nullptr, sizeof(EntryType), aInitLength);
|
||||
PL_DHashTableInit(&mTable, &sOps, sizeof(EntryType), aInitLength);
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -188,7 +188,7 @@ SizeOfEntryStore(uint32_t aCapacity, uint32_t aEntrySize, uint32_t* aNbytes)
|
||||
}
|
||||
|
||||
PLDHashTable*
|
||||
PL_NewDHashTable(const PLDHashTableOps* aOps, void* aData, uint32_t aEntrySize,
|
||||
PL_NewDHashTable(const PLDHashTableOps* aOps, uint32_t aEntrySize,
|
||||
uint32_t aLength)
|
||||
{
|
||||
PLDHashTable* table = (PLDHashTable*)aOps->allocTable(NULL, sizeof(*table));
|
||||
@@ -196,8 +196,7 @@ PL_NewDHashTable(const PLDHashTableOps* aOps, void* aData, uint32_t aEntrySize,
|
||||
if (!table) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!PL_DHashTableInit(table, aOps, aData, aEntrySize, fallible_t(),
|
||||
aLength)) {
|
||||
if (!PL_DHashTableInit(table, aOps, aEntrySize, fallible_t(), aLength)) {
|
||||
aOps->freeTable(NULL, table);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -241,7 +240,7 @@ MinCapacity(uint32_t aLength)
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE bool
|
||||
PLDHashTable::Init(const PLDHashTableOps* aOps, void* aData,
|
||||
PLDHashTable::Init(const PLDHashTableOps* aOps,
|
||||
uint32_t aEntrySize, const fallible_t&, uint32_t aLength)
|
||||
{
|
||||
if (aLength > PL_DHASH_MAX_INITIAL_LENGTH) {
|
||||
@@ -249,7 +248,6 @@ PLDHashTable::Init(const PLDHashTableOps* aOps, void* aData,
|
||||
}
|
||||
|
||||
ops = aOps;
|
||||
data = aData;
|
||||
|
||||
// Compute the smallest capacity allowing |aLength| elements to be inserted
|
||||
// without rehashing.
|
||||
@@ -287,18 +285,17 @@ PLDHashTable::Init(const PLDHashTableOps* aOps, void* aData,
|
||||
|
||||
bool
|
||||
PL_DHashTableInit(PLDHashTable* aTable, const PLDHashTableOps* aOps,
|
||||
void* aData, uint32_t aEntrySize,
|
||||
uint32_t aEntrySize,
|
||||
const fallible_t& aFallible, uint32_t aLength)
|
||||
{
|
||||
return aTable->Init(aOps, aData, aEntrySize, aFallible, aLength);
|
||||
return aTable->Init(aOps, aEntrySize, aFallible, aLength);
|
||||
}
|
||||
|
||||
void
|
||||
PL_DHashTableInit(PLDHashTable* aTable, const PLDHashTableOps* aOps,
|
||||
void* aData, uint32_t aEntrySize, uint32_t aLength)
|
||||
uint32_t aEntrySize, uint32_t aLength)
|
||||
{
|
||||
if (!PL_DHashTableInit(aTable, aOps, aData, aEntrySize, fallible_t(),
|
||||
aLength)) {
|
||||
if (!PL_DHashTableInit(aTable, aOps, aEntrySize, fallible_t(), aLength)) {
|
||||
if (aLength > PL_DHASH_MAX_INITIAL_LENGTH) {
|
||||
MOZ_CRASH(); // the asked-for length was too big
|
||||
}
|
||||
|
||||
@@ -184,8 +184,6 @@ struct PLDHashTable
|
||||
*/
|
||||
const PLDHashTableOps* ops;
|
||||
|
||||
void* data; /* ops- and instance-specific data */
|
||||
|
||||
private:
|
||||
int16_t mHashShift; /* multiplicative hash shift */
|
||||
/*
|
||||
@@ -239,7 +237,7 @@ public:
|
||||
uint32_t EntryCount() const { return mEntryCount; }
|
||||
uint32_t Generation() const { return mGeneration; }
|
||||
|
||||
bool Init(const PLDHashTableOps* aOps, void* aData, uint32_t aEntrySize,
|
||||
bool Init(const PLDHashTableOps* aOps, uint32_t aEntrySize,
|
||||
const mozilla::fallible_t&, uint32_t aLength);
|
||||
|
||||
void Finish();
|
||||
@@ -454,7 +452,7 @@ const PLDHashTableOps* PL_DHashGetStubOps(void);
|
||||
* the aOps->allocTable callback.
|
||||
*/
|
||||
PLDHashTable* PL_NewDHashTable(
|
||||
const PLDHashTableOps* aOps, void* aData, uint32_t aEntrySize,
|
||||
const PLDHashTableOps* aOps, uint32_t aEntrySize,
|
||||
uint32_t aLength = PL_DHASH_DEFAULT_INITIAL_LENGTH);
|
||||
|
||||
/*
|
||||
@@ -464,16 +462,15 @@ PLDHashTable* PL_NewDHashTable(
|
||||
void PL_DHashTableDestroy(PLDHashTable* aTable);
|
||||
|
||||
/*
|
||||
* Initialize aTable with aOps, aData, aEntrySize, and aCapacity. The table's
|
||||
* initial capacity will be chosen such that |aLength| elements can be inserted
|
||||
* without rehashing. If |aLength| is a power-of-two, this capacity will be
|
||||
* |2*length|.
|
||||
* Initialize aTable with aOps, aEntrySize, and aCapacity. The table's initial
|
||||
* capacity will be chosen such that |aLength| elements can be inserted without
|
||||
* rehashing. If |aLength| is a power-of-two, this capacity will be |2*length|.
|
||||
*
|
||||
* This function will crash if it can't allocate enough memory, or if
|
||||
* |aEntrySize| and/or |aLength| are too large.
|
||||
*/
|
||||
void PL_DHashTableInit(
|
||||
PLDHashTable* aTable, const PLDHashTableOps* aOps, void* aData,
|
||||
PLDHashTable* aTable, const PLDHashTableOps* aOps,
|
||||
uint32_t aEntrySize, uint32_t aLength = PL_DHASH_DEFAULT_INITIAL_LENGTH);
|
||||
|
||||
/*
|
||||
@@ -481,7 +478,7 @@ void PL_DHashTableInit(
|
||||
* returns a boolean indicating success, rather than crashing on failure.
|
||||
*/
|
||||
MOZ_WARN_UNUSED_RESULT bool PL_DHashTableInit(
|
||||
PLDHashTable* aTable, const PLDHashTableOps* aOps, void* aData,
|
||||
PLDHashTable* aTable, const PLDHashTableOps* aOps,
|
||||
uint32_t aEntrySize, const mozilla::fallible_t&,
|
||||
uint32_t aLength = PL_DHASH_DEFAULT_INITIAL_LENGTH);
|
||||
|
||||
@@ -558,7 +555,7 @@ PL_DHashTableEnumerate(PLDHashTable* aTable, PLDHashEnumerator aEtor,
|
||||
* Measure the size of the table's entry storage, and if
|
||||
* |aSizeOfEntryExcludingThis| is non-nullptr, measure the size of things
|
||||
* pointed to by entries. Doesn't measure |ops| because it's often shared
|
||||
* between tables, nor |data| because it's opaque.
|
||||
* between tables.
|
||||
*/
|
||||
size_t PL_DHashTableSizeOfExcludingThis(
|
||||
const PLDHashTable* aTable,
|
||||
|
||||
@@ -20,7 +20,7 @@ static bool test_pldhash_Init_capacity_ok()
|
||||
// will allocate 0.5GB of entry store on 32-bit platforms and 1GB on 64-bit
|
||||
// platforms.
|
||||
PLDHashTable t;
|
||||
bool ok = PL_DHashTableInit(&t, PL_DHashGetStubOps(), nullptr,
|
||||
bool ok = PL_DHashTableInit(&t, PL_DHashGetStubOps(),
|
||||
sizeof(PLDHashEntryStub),
|
||||
mozilla::fallible_t(),
|
||||
PL_DHASH_MAX_INITIAL_LENGTH);
|
||||
@@ -34,7 +34,7 @@ static bool test_pldhash_Init_capacity_too_large()
|
||||
{
|
||||
// Try the smallest too-large capacity.
|
||||
PLDHashTable t;
|
||||
bool ok = PL_DHashTableInit(&t, PL_DHashGetStubOps(), nullptr,
|
||||
bool ok = PL_DHashTableInit(&t, PL_DHashGetStubOps(),
|
||||
sizeof(PLDHashEntryStub),
|
||||
mozilla::fallible_t(),
|
||||
PL_DHASH_MAX_INITIAL_LENGTH + 1);
|
||||
@@ -59,7 +59,7 @@ static bool test_pldhash_Init_overflow()
|
||||
|
||||
// |nullptr| for |ops| is ok because it's unused due to the failure.
|
||||
PLDHashTable t;
|
||||
bool ok = PL_DHashTableInit(&t, /* ops = */nullptr, nullptr,
|
||||
bool ok = PL_DHashTableInit(&t, /* ops = */nullptr,
|
||||
sizeof(OneKBEntry), mozilla::fallible_t(),
|
||||
PL_DHASH_MAX_INITIAL_LENGTH);
|
||||
|
||||
@@ -91,7 +91,7 @@ static bool test_pldhash_grow_to_max_capacity()
|
||||
};
|
||||
|
||||
PLDHashTable t;
|
||||
bool ok = PL_DHashTableInit(&t, &ops, nullptr, sizeof(PLDHashEntryStub),
|
||||
bool ok = PL_DHashTableInit(&t, &ops, sizeof(PLDHashEntryStub),
|
||||
mozilla::fallible_t(), 128);
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user