Remove use of FOREACH macros

This commit is contained in:
Sebastian Ramacher 2023-12-03 23:27:03 +01:00
parent 63c8c3f3e9
commit cb11a67add

View File

@ -574,17 +574,16 @@ sqlite_save_jumplist(zathura_database_t* db, const char* file, girara_list_t* ju
} }
bool status = true; bool status = true;
GIRARA_LIST_FOREACH_BODY(jumplist, zathura_jump_t*, jump, for (size_t idx = 0; idx != girara_list_size(jumplist) && status; ++idx) {
stmt = prepare_statement(priv->session, SQL_INSERT_JUMP); zathura_jump_t* jump = girara_list_nth(jumplist, idx);
stmt = prepare_statement(priv->session, SQL_INSERT_JUMP);
if (stmt == NULL) { if (stmt == NULL) {
status = false; status = false;
break; break;
} }
if (sqlite3_bind_text(stmt, 1, file, -1, NULL) != SQLITE_OK || if (sqlite3_bind_text(stmt, 1, file, -1, NULL) != SQLITE_OK || sqlite3_bind_int(stmt, 2, jump->page) != SQLITE_OK ||
sqlite3_bind_int(stmt, 2, jump->page) != SQLITE_OK || sqlite3_bind_double(stmt, 3, jump->x) != SQLITE_OK || sqlite3_bind_double(stmt, 4, jump->y) != SQLITE_OK) {
sqlite3_bind_double(stmt, 3, jump->x) != SQLITE_OK ||
sqlite3_bind_double(stmt, 4, jump->y) != SQLITE_OK) {
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
girara_error("Failed to bind arguments."); girara_error("Failed to bind arguments.");
status = false; status = false;
@ -596,9 +595,8 @@ sqlite_save_jumplist(zathura_database_t* db, const char* file, girara_list_t* ju
if (res != SQLITE_DONE) { if (res != SQLITE_DONE) {
status = false; status = false;
break;
} }
); }
if (status == false) { if (status == false) {
sqlite3_exec(priv->session, "ROLLBACK;", NULL, 0, NULL); sqlite3_exec(priv->session, "ROLLBACK;", NULL, 0, NULL);