Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 479244f

Browse files
committed
Bug 1121760 (part 2) - Remove PL_DHashTableAdd(). r=poiru.
--HG-- extra : rebase_source : 41eb939bfb5c925cba58b1af57abce9a4e5fdb30
1 parent fcfdd8f commit 479244f

39 files changed

Lines changed: 121 additions & 177 deletions

dom/base/nsContentList.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,9 @@ NS_GetContentList(nsINode* aRootNode,
220220
new PLDHashTable(&hash_table_ops, sizeof(ContentListHashEntry));
221221
}
222222

223-
ContentListHashEntry *entry = nullptr;
224223
// First we look in our hashtable. Then we create a content list if needed
225-
entry = static_cast<ContentListHashEntry *>
226-
(PL_DHashTableAdd(gContentListHashTable, &hashKey, fallible));
224+
auto entry = static_cast<ContentListHashEntry*>
225+
(gContentListHashTable->Add(&hashKey, fallible));
227226
if (entry)
228227
list = entry->mContentList;
229228

@@ -329,8 +328,8 @@ GetFuncStringContentList(nsINode* aRootNode,
329328
if (gFuncStringContentListHashTable) {
330329
nsFuncStringCacheKey hashKey(aRootNode, aFunc, aString);
331330

332-
entry = static_cast<FuncStringContentListHashEntry *>
333-
(PL_DHashTableAdd(gFuncStringContentListHashTable, &hashKey, fallible));
331+
entry = static_cast<FuncStringContentListHashEntry*>
332+
(gFuncStringContentListHashTable->Add(&hashKey, fallible));
334333
if (entry) {
335334
list = entry->mContentList;
336335
#ifdef DEBUG

dom/base/nsContentUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4140,9 +4140,9 @@ nsContentUtils::GetListenerManagerForNode(nsINode *aNode)
41404140
return nullptr;
41414141
}
41424142

4143-
EventListenerManagerMapEntry *entry =
4144-
static_cast<EventListenerManagerMapEntry *>
4145-
(PL_DHashTableAdd(sEventListenerManagersHash, aNode, fallible));
4143+
auto entry =
4144+
static_cast<EventListenerManagerMapEntry*>
4145+
(sEventListenerManagersHash->Add(aNode, fallible));
41464146

41474147
if (!entry) {
41484148
return nullptr;

dom/base/nsDocument.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3967,8 +3967,8 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
39673967
}
39683968

39693969
// Add a mapping to the hash table
3970-
SubDocMapEntry *entry = static_cast<SubDocMapEntry*>
3971-
(PL_DHashTableAdd(mSubDocuments, aElement, fallible));
3970+
auto entry =
3971+
static_cast<SubDocMapEntry*>(mSubDocuments->Add(aElement, fallible));
39723972

39733973
if (!entry) {
39743974
return NS_ERROR_OUT_OF_MEMORY;

dom/base/nsPropertyTable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ nsPropertyTable::SetPropertyInternal(nsPropertyOwner aObject,
206206
// The current property value (if there is one) is replaced and the current
207207
// value is destroyed
208208
nsresult result = NS_OK;
209-
PropertyListMapEntry *entry = static_cast<PropertyListMapEntry*>
210-
(PL_DHashTableAdd(&propertyList->mObjectValueMap, aObject, mozilla::fallible));
209+
auto entry = static_cast<PropertyListMapEntry*>
210+
(propertyList->mObjectValueMap.Add(aObject, mozilla::fallible));
211211
if (!entry)
212212
return NS_ERROR_OUT_OF_MEMORY;
213213
// A nullptr entry->key is the sign that the entry has just been allocated

dom/base/nsScriptNameSpaceManager.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ nsGlobalNameStruct *
132132
nsScriptNameSpaceManager::AddToHash(PLDHashTable *aTable, const nsAString *aKey,
133133
const char16_t **aClassName)
134134
{
135-
GlobalNameMapEntry *entry = static_cast<GlobalNameMapEntry *>
136-
(PL_DHashTableAdd(aTable, aKey, fallible));
137-
135+
auto entry = static_cast<GlobalNameMapEntry*>(aTable->Add(aKey, fallible));
138136
if (!entry) {
139137
return nullptr;
140138
}

dom/plugins/base/nsJSNPRuntime.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,8 +1886,8 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
18861886
}
18871887
}
18881888

1889-
NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
1890-
(PL_DHashTableAdd(sNPObjWrappers, npobj, fallible));
1889+
auto entry =
1890+
static_cast<NPObjWrapperHashEntry*>(sNPObjWrappers->Add(npobj, fallible));
18911891

18921892
if (!entry) {
18931893
// Out of memory
@@ -2044,8 +2044,8 @@ LookupNPP(NPObject *npobj)
20442044
return o->mNpp;
20452045
}
20462046

2047-
NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
2048-
(PL_DHashTableAdd(sNPObjWrappers, npobj, fallible));
2047+
auto entry =
2048+
static_cast<NPObjWrapperHashEntry*>(sNPObjWrappers->Add(npobj, fallible));
20492049

20502050
if (!entry) {
20512051
return nullptr;

dom/xul/XULDocument.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
767767
(mBroadcasterMap->Search(&aBroadcaster));
768768
if (!entry) {
769769
entry = static_cast<BroadcasterMapEntry*>
770-
(PL_DHashTableAdd(mBroadcasterMap, &aBroadcaster, fallible));
770+
(mBroadcasterMap->Add(&aBroadcaster, fallible));
771771

772772
if (! entry) {
773773
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);

dom/xul/templates/nsContentSupportMap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ class nsContentSupportMap {
2525
~nsContentSupportMap() { }
2626

2727
nsresult Put(nsIContent* aElement, nsTemplateMatch* aMatch) {
28-
PLDHashEntryHdr* hdr =
29-
PL_DHashTableAdd(&mMap, aElement, mozilla::fallible);
28+
PLDHashEntryHdr* hdr = mMap.Add(aElement, mozilla::fallible);
3029
if (!hdr)
3130
return NS_ERROR_OUT_OF_MEMORY;
3231

dom/xul/templates/nsTemplateMap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class nsTemplateMap {
2727
Put(nsIContent* aContent, nsIContent* aTemplate) {
2828
NS_ASSERTION(!mTable.Search(aContent), "aContent already in map");
2929

30-
Entry* entry = static_cast<Entry*>
31-
(PL_DHashTableAdd(&mTable, aContent, fallible));
30+
auto entry = static_cast<Entry*>(mTable.Add(aContent, fallible));
3231

3332
if (entry) {
3433
entry->mContent = aContent;

embedding/components/commandhandler/nsCommandParams.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ nsCommandParams::GetOrMakeEntry(const char* aName, uint8_t aEntryType)
219219
return foundEntry;
220220
}
221221

222-
foundEntry = static_cast<HashEntry*>(
223-
PL_DHashTableAdd(&mValuesHash, (void*)aName, fallible));
222+
foundEntry = static_cast<HashEntry*>(mValuesHash.Add((void*)aName, fallible));
224223
if (!foundEntry) {
225224
return nullptr;
226225
}

0 commit comments

Comments
 (0)