Bug 1620198 - Part 2: Remove FunctionInfo::type. r=asuth

Differential Revision: https://phabricator.services.mozilla.com/D65506
This commit is contained in:
Simon Giesecke 2020-06-08 10:00:14 +00:00
parent f3d8e02f37
commit 4fa00c14c3
2 changed files with 6 additions and 19 deletions

View File

@ -1545,20 +1545,11 @@ nsresult Connection::initializeClone(Connection* aClone, bool aReadOnly) {
const nsACString& key = iter.Key();
Connection::FunctionInfo data = iter.UserData();
MOZ_ASSERT(data.type == Connection::FunctionInfo::SIMPLE ||
data.type == Connection::FunctionInfo::AGGREGATE,
"Invalid function type!");
if (data.type == Connection::FunctionInfo::SIMPLE) {
mozIStorageFunction* function =
static_cast<mozIStorageFunction*>(data.function.get());
rv = aClone->CreateFunction(key, data.numArgs, function);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to copy function to cloned connection");
}
} else {
MOZ_CRASH("Not implemented.");
mozIStorageFunction* function =
static_cast<mozIStorageFunction*>(data.function.get());
rv = aClone->CreateFunction(key, data.numArgs, function);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to copy function to cloned connection");
}
}
@ -2036,8 +2027,7 @@ Connection::CreateFunction(const nsACString& aFunctionName,
SQLITE_ANY, aFunction, basicFunctionHelper, nullptr, nullptr);
if (srv != SQLITE_OK) return convertResultCode(srv);
FunctionInfo info = {aFunction, Connection::FunctionInfo::SIMPLE,
aNumArguments};
FunctionInfo info = {aFunction, aNumArguments};
mFunctions.Put(aFunctionName, info);
return NS_OK;

View File

@ -55,10 +55,7 @@ class Connection final : public mozIStorageConnection,
* Structure used to describe user functions on the database connection.
*/
struct FunctionInfo {
enum FunctionType { SIMPLE, AGGREGATE };
nsCOMPtr<nsISupports> function;
FunctionType type;
int32_t numArgs;
};