diff options
Diffstat (limited to 'src/crepe/facade/DB.cpp')
-rw-r--r-- | src/crepe/facade/DB.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/crepe/facade/DB.cpp b/src/crepe/facade/DB.cpp index 0a2f455..0805a08 100644 --- a/src/crepe/facade/DB.cpp +++ b/src/crepe/facade/DB.cpp @@ -19,15 +19,14 @@ DB::DB(const string & path) { this->db = {db, [](libdb::DB * db) { db->close(db, 0); }}; // load or create database file - if ((ret = this->db->open(this->db.get(), NULL, path.c_str(), NULL, - libdb::DB_BTREE, DB_CREATE, 0)) - != 0) - throw Exception("db->open: %s", libdb::db_strerror(ret)); + ret = this->db->open(this->db.get(), NULL, path.c_str(), NULL, + libdb::DB_BTREE, DB_CREATE, 0); + if (ret != 0) throw Exception("db->open: %s", libdb::db_strerror(ret)); // create cursor libdb::DBC * cursor; - if ((ret = this->db->cursor(this->db.get(), NULL, &cursor, 0)) != 0) - throw Exception("db->cursor: %s", libdb::db_strerror(ret)); + ret = this->db->cursor(this->db.get(), NULL, &cursor, 0); + if (ret != 0) throw Exception("db->cursor: %s", libdb::db_strerror(ret)); this->cursor = {cursor, [](libdb::DBC * cursor) { cursor->close(cursor); }}; } @@ -64,3 +63,4 @@ bool DB::has(const std::string & key) noexcept { } return true; } + |