diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2016-05-14 12:23:15 +0200 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2016-05-17 06:52:16 +0200 |
commit | 143401451c457da5079b2970fe260acea45bd85a (patch) | |
tree | 390c729ba28f974bf422d441dfd8dd7e817e4127 /src/database-leveldb.cpp | |
parent | decbd396df0855f0a356c836cf7c0c5b133964cf (diff) | |
download | minetest-143401451c457da5079b2970fe260acea45bd85a.tar.gz minetest-143401451c457da5079b2970fe260acea45bd85a.tar.bz2 minetest-143401451c457da5079b2970fe260acea45bd85a.zip |
DB::loadBlock copy removal & DB backend cleanup
* Remove the copy from db::loadBlock by using a pointer to the destination
* cleanup db backend, the child backend doesn't have to set their functions as virtual
Diffstat (limited to 'src/database-leveldb.cpp')
-rw-r--r-- | src/database-leveldb.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/database-leveldb.cpp b/src/database-leveldb.cpp index acd0fd1eb..f46f82b98 100644 --- a/src/database-leveldb.cpp +++ b/src/database-leveldb.cpp @@ -65,16 +65,13 @@ bool Database_LevelDB::saveBlock(const v3s16 &pos, const std::string &data) return true; } -std::string Database_LevelDB::loadBlock(const v3s16 &pos) +void Database_LevelDB::loadBlock(const v3s16 &pos, std::string *block) { std::string datastr; leveldb::Status status = m_database->Get(leveldb::ReadOptions(), i64tos(getBlockAsInteger(pos)), &datastr); - if(status.ok()) - return datastr; - else - return ""; + *block = (status.ok()) ? datastr : ""; } bool Database_LevelDB::deleteBlock(const v3s16 &pos) |