Fix -Wterminate warnings in rollback.cpp as well

Fix #4137 for rollback.cpp as well.
This commit is contained in:
est31 2016-07-08 07:26:00 +02:00
parent 483cca78a1
commit 9db78dc4c4

@ -42,6 +42,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
} }
#define SQLOK(f) SQLRES(f, SQLITE_OK) #define SQLOK(f) SQLRES(f, SQLITE_OK)
#define SQLOK_ERRSTREAM(s, m) \
if ((s) != SQLITE_OK) { \
errorstream << "RollbackManager: " << (m) << ": " \
<< sqlite3_errmsg(db) << std::endl; \
}
#define FINALIZE_STATEMENT(statement) \
SQLOK_ERRSTREAM(sqlite3_finalize(statement), "Failed to finalize " #statement)
class ItemStackRow : public ItemStack { class ItemStackRow : public ItemStack {
public: public:
@ -109,17 +117,17 @@ RollbackManager::~RollbackManager()
{ {
flush(); flush();
SQLOK(sqlite3_finalize(stmt_insert)); FINALIZE_STATEMENT(stmt_insert);
SQLOK(sqlite3_finalize(stmt_replace)); FINALIZE_STATEMENT(stmt_replace);
SQLOK(sqlite3_finalize(stmt_select)); FINALIZE_STATEMENT(stmt_select);
SQLOK(sqlite3_finalize(stmt_select_range)); FINALIZE_STATEMENT(stmt_select_range);
SQLOK(sqlite3_finalize(stmt_select_withActor)); FINALIZE_STATEMENT(stmt_select_withActor);
SQLOK(sqlite3_finalize(stmt_knownActor_select)); FINALIZE_STATEMENT(stmt_knownActor_select);
SQLOK(sqlite3_finalize(stmt_knownActor_insert)); FINALIZE_STATEMENT(stmt_knownActor_insert);
SQLOK(sqlite3_finalize(stmt_knownNode_select)); FINALIZE_STATEMENT(stmt_knownNode_select);
SQLOK(sqlite3_finalize(stmt_knownNode_insert)); FINALIZE_STATEMENT(stmt_knownNode_insert);
SQLOK(sqlite3_close(db)); SQLOK_ERRSTREAM(sqlite3_close(db), "Could not close db");
} }