aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2016-07-08 07:26:00 +0200
committerest31 <MTest31@outlook.com>2016-07-08 07:27:49 +0200
commit9db78dc4c4130c1ef08696e5d381a157cb66e656 (patch)
tree5fefc1e3590bbe0ea9c1db3533a0e4b43dc15294 /src
parent483cca78a1312aa3b9c01049b5ebf6842929ec7a (diff)
downloadminetest-9db78dc4c4130c1ef08696e5d381a157cb66e656.tar.gz
minetest-9db78dc4c4130c1ef08696e5d381a157cb66e656.tar.bz2
minetest-9db78dc4c4130c1ef08696e5d381a157cb66e656.zip
Fix -Wterminate warnings in rollback.cpp as well
Fix #4137 for rollback.cpp as well.
Diffstat (limited to 'src')
-rw-r--r--src/rollback.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/rollback.cpp b/src/rollback.cpp
index ac4324cab..4d34decf3 100644
--- a/src/rollback.cpp
+++ b/src/rollback.cpp
@@ -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_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 {
public:
@@ -109,17 +117,17 @@ RollbackManager::~RollbackManager()
{
flush();
- SQLOK(sqlite3_finalize(stmt_insert));
- SQLOK(sqlite3_finalize(stmt_replace));
- SQLOK(sqlite3_finalize(stmt_select));
- SQLOK(sqlite3_finalize(stmt_select_range));
- SQLOK(sqlite3_finalize(stmt_select_withActor));
- SQLOK(sqlite3_finalize(stmt_knownActor_select));
- SQLOK(sqlite3_finalize(stmt_knownActor_insert));
- SQLOK(sqlite3_finalize(stmt_knownNode_select));
- SQLOK(sqlite3_finalize(stmt_knownNode_insert));
-
- SQLOK(sqlite3_close(db));
+ FINALIZE_STATEMENT(stmt_insert);
+ FINALIZE_STATEMENT(stmt_replace);
+ FINALIZE_STATEMENT(stmt_select);
+ FINALIZE_STATEMENT(stmt_select_range);
+ FINALIZE_STATEMENT(stmt_select_withActor);
+ FINALIZE_STATEMENT(stmt_knownActor_select);
+ FINALIZE_STATEMENT(stmt_knownActor_insert);
+ FINALIZE_STATEMENT(stmt_knownNode_select);
+ FINALIZE_STATEMENT(stmt_knownNode_insert);
+
+ SQLOK_ERRSTREAM(sqlite3_close(db), "Could not close db");
}