Merge two ifs

This commit is contained in:
Sebastian Ramacher 2020-03-09 13:25:56 +01:00
parent 155e538d26
commit d80c654b8b
2 changed files with 8 additions and 12 deletions

View file

@ -463,14 +463,11 @@ plain_remove_bookmark(zathura_database_t* db, const char* file, const char* id)
}
char* name = prepare_filename(file);
if (g_key_file_has_group(priv->bookmarks, name) == TRUE) {
if (g_key_file_remove_key(priv->bookmarks, name, id, NULL) == TRUE) {
if (g_key_file_has_group(priv->bookmarks, name) == TRUE && g_key_file_remove_key(priv->bookmarks, name, id, NULL) == TRUE) {
zathura_db_write_key_file_to_file(priv->bookmark_path, priv->bookmarks);
g_free(name);
zathura_db_write_key_file_to_file(priv->bookmark_path, priv->bookmarks);
g_free(name);
return true;
}
return true;
}
g_free(name);

View file

@ -155,11 +155,10 @@ check_column_type(sqlite3* session, const char* table, const char* col, const ch
*res = false;
while (sqlite3_step(stmt) == SQLITE_ROW) {
if (strcmp((const char*) sqlite3_column_text(stmt, 1), col) == 0) {
if (strcmp((const char*) sqlite3_column_text(stmt, 2), type) == 0) {
*res = true;
break;
}
if (strcmp((const char*) sqlite3_column_text(stmt, 1), col) == 0 &&
strcmp((const char*) sqlite3_column_text(stmt, 2), type) == 0) {
*res = true;
break;
}
}