Bug 1124973 (part 2) - Introduce PL_DHashTableSearch(), and replace most PL_DHashTableLookup() calls with it. r=froydnj.

It feels safer to use a function with a new name, rather than just changing the
behaviour of the existing function.

For most of these cases the PL_DHashTableLookup() result was checked with
PL_DHASH_ENTRY_IS_{FREE,BUSY} so the conversion was easy. A few of them
preceded that check with a useless null check, but the intent of these was
still easy to determine.

I'll do the trickier ones in subsequent patches.
This commit is contained in:
Nicholas Nethercote
2015-01-22 21:06:55 -08:00
parent 8b74e08651
commit c38455902a
28 changed files with 217 additions and 318 deletions

View File

@@ -217,20 +217,15 @@ nsCommandParams::RemoveValue(const char* aName)
nsCommandParams::HashEntry*
nsCommandParams::GetNamedEntry(const char* aName)
{
HashEntry *foundEntry =
(HashEntry *)PL_DHashTableLookup(&mValuesHash, (void *)aName);
if (PL_DHASH_ENTRY_IS_BUSY(foundEntry)) {
return foundEntry;
}
return nullptr;
return (HashEntry *)PL_DHashTableSearch(&mValuesHash, (void *)aName);
}
nsCommandParams::HashEntry*
nsCommandParams::GetOrMakeEntry(const char* aName, uint8_t entryType)
{
HashEntry *foundEntry =
(HashEntry *)PL_DHashTableLookup(&mValuesHash, (void *)aName);
if (PL_DHASH_ENTRY_IS_BUSY(foundEntry)) { // reuse existing entry
(HashEntry *)PL_DHashTableSearch(&mValuesHash, (void *)aName);
if (foundEntry) { // reuse existing entry
foundEntry->Reset(entryType);
return foundEntry;
}