Bug 1181445 (part 4) - Use nsTHashTable::Iterator in nsCategoryManager. r=froydnj.

--HG--
extra : rebase_source : dd2ca157bf07f49a25d501986d3338e0f525348f
This commit is contained in:
Nicholas Nethercote 2015-07-09 16:54:58 -07:00
parent 8626fc2a98
commit 35b8916e86

View File

@ -167,24 +167,9 @@ class EntryEnumerator
{
public:
static EntryEnumerator* Create(nsTHashtable<CategoryLeaf>& aTable);
private:
static PLDHashOperator enumfunc_createenumerator(CategoryLeaf* aLeaf,
void* aUserArg);
};
PLDHashOperator
EntryEnumerator::enumfunc_createenumerator(CategoryLeaf* aLeaf, void* aUserArg)
{
EntryEnumerator* mythis = static_cast<EntryEnumerator*>(aUserArg);
if (aLeaf->value) {
mythis->mArray[mythis->mCount++] = aLeaf->GetKey();
}
return PL_DHASH_NEXT;
}
EntryEnumerator*
EntryEnumerator::Create(nsTHashtable<CategoryLeaf>& aTable)
{
@ -199,7 +184,12 @@ EntryEnumerator::Create(nsTHashtable<CategoryLeaf>& aTable)
return nullptr;
}
aTable.EnumerateEntries(enumfunc_createenumerator, enumObj);
for (auto iter = aTable.Iter(); !iter.Done(); iter.Next()) {
CategoryLeaf* leaf = iter.Get();
if (leaf->value) {
enumObj->mArray[enumObj->mCount++] = leaf->GetKey();
}
}
enumObj->Sort();