From d80c654b8b1079b89d4c3909ede7f85292842f4c Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 9 Mar 2020 13:25:56 +0100 Subject: [PATCH] Merge two ifs --- zathura/database-plain.c | 11 ++++------- zathura/database-sqlite.c | 9 ++++----- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/zathura/database-plain.c b/zathura/database-plain.c index bba4175..8b28383 100644 --- a/zathura/database-plain.c +++ b/zathura/database-plain.c @@ -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); diff --git a/zathura/database-sqlite.c b/zathura/database-sqlite.c index 212cce6..411ffec 100644 --- a/zathura/database-sqlite.c +++ b/zathura/database-sqlite.c @@ -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; } }