From 59a295a756b27f33a066e9fb67baeaa1944f54fa Mon Sep 17 00:00:00 2001 From: anon Date: Fri, 4 Aug 2023 16:24:07 +0200 Subject: [PATCH] DBERR to function, fixed what Emil broke --- src/api.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/api.c b/src/api.c index 7cdc33a..8d724a3 100644 --- a/src/api.c +++ b/src/api.c @@ -1,15 +1,5 @@ #define DBFILE "probotic_data.sqlite" -#define DBERR(l) do { \ - if(l != SQLITE_OK && l != SQLITE_ROW && l != SQLITE_DONE) \ - { \ - fprintf(stderr, \ - "sqlite (%d): %s\n", \ - sqlite3_errcode(connection), sqlite3_errmsg(connection)); \ - exit(DB_ERROR); \ - } \ - } while (0) - #define stmt_prepare(stmt) \ sqlite3_prepare_v2(connection, stmt ## _template, -1, &stmt, NULL) @@ -64,6 +54,16 @@ VARDECL char const * db = DBFILE; VARDECL sqlite3 * connection = NULL; +DECL void DBERR(const int l){ + if(l != SQLITE_OK && l != SQLITE_ROW && l != SQLITE_DONE) + { + fprintf(stderr, + "sqlite (%d): %s\n", + sqlite3_errcode(connection), sqlite3_errmsg(connection)); + exit(DB_ERROR); + } +} + DECL int api_init(void) {