Skip to content

Commit

Permalink
Bug 1186791 (part 2) - Replace nsBaseHashtable::EnumerateRead() calls…
Browse files Browse the repository at this point in the history
… in storage/ with iterators. r=mak.

--HG--
extra : rebase_source : defddc0f2e490b5b1b41fd71bebedfc8b31a35bb
  • Loading branch information
nnethercote committed Oct 29, 2015
1 parent 23e7f15 commit acb6e8f
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions storage/mozStorageConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,6 @@ void tracefunc (void *aClosure, const char *aStmt)
aStmt));
}

struct FFEArguments
{
nsISupports *target;
bool found;
};
PLDHashOperator
findFunctionEnumerator(const nsACString &aKey,
Connection::FunctionInfo aData,
void *aUserArg)
{
FFEArguments *args = static_cast<FFEArguments *>(aUserArg);
if (aData.function == args->target) {
args->found = true;
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}

PLDHashOperator
copyFunctionEnumerator(const nsACString &aKey,
Connection::FunctionInfo aData,
Expand Down Expand Up @@ -864,9 +846,13 @@ bool
Connection::findFunctionByInstance(nsISupports *aInstance)
{
sharedDBMutex.assertCurrentThreadOwns();
FFEArguments args = { aInstance, false };
(void)mFunctions.EnumerateRead(findFunctionEnumerator, &args);
return args.found;

for (auto iter = mFunctions.Iter(); !iter.Done(); iter.Next()) {
if (iter.UserData().function == aInstance) {
return true;
}
}
return false;
}

/* static */ int
Expand Down

0 comments on commit acb6e8f

Please sign in to comment.