mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
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
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user