You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Cleanup database code
This commit is contained in:
@@ -201,7 +201,7 @@ void scan_deny_apps() {
|
||||
LOGI("denylist rm: [%s]\n", it->first.data());
|
||||
ssprintf(sql, sizeof(sql), "DELETE FROM denylist WHERE package_name='%s'",
|
||||
it->first.data());
|
||||
db_exec(sql).check_err();
|
||||
db_exec(sql);
|
||||
it = pkg_to_procs.erase(it);
|
||||
} else {
|
||||
update_app_id(app_id, it->first, false);
|
||||
@@ -222,11 +222,11 @@ static bool ensure_data() {
|
||||
LOGI("denylist: initializing internal data structures\n");
|
||||
|
||||
default_new(pkg_to_procs_);
|
||||
auto res = db_exec("SELECT * FROM denylist", [](db_row &row) -> bool {
|
||||
bool res = db_exec("SELECT * FROM denylist", [](db_row &row) -> bool {
|
||||
add_hide_set(row["package_name"].data(), row["process"].data());
|
||||
return true;
|
||||
});
|
||||
if (res.check_err())
|
||||
if (!res)
|
||||
goto error;
|
||||
|
||||
default_new(app_id_to_pkgs_);
|
||||
@@ -263,7 +263,7 @@ static int add_list(const char *pkg, const char *proc) {
|
||||
char sql[4096];
|
||||
ssprintf(sql, sizeof(sql),
|
||||
"INSERT INTO denylist (package_name, process) VALUES('%s', '%s')", pkg, proc);
|
||||
return db_exec(sql).check_err() ? DenyResponse::ERROR : DenyResponse::OK;
|
||||
return db_exec(sql) ? DenyResponse::OK : DenyResponse::ERROR;
|
||||
}
|
||||
|
||||
int add_list(int client) {
|
||||
@@ -307,7 +307,7 @@ static int rm_list(const char *pkg, const char *proc) {
|
||||
else
|
||||
ssprintf(sql, sizeof(sql),
|
||||
"DELETE FROM denylist WHERE package_name='%s' AND process='%s'", pkg, proc);
|
||||
return db_exec(sql).check_err() ? DenyResponse::ERROR : DenyResponse::OK;
|
||||
return db_exec(sql) ? DenyResponse::OK : DenyResponse::ERROR;
|
||||
}
|
||||
|
||||
int rm_list(int client) {
|
||||
|
||||
Reference in New Issue
Block a user