Skip to content

Commit

Permalink
Pass unique_ptr to functions by value instead of by rvalue-reference
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Jan 29, 2018
1 parent c0a6f0e commit f8d7446
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libdevcore/LevelDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ std::unique_ptr<WriteBatchFace> LevelDB::createWriteBatch() const
return std::unique_ptr<WriteBatchFace>(new LevelDBWriteBatch());
}

void LevelDB::commit(std::unique_ptr<WriteBatchFace>&& _batch)
void LevelDB::commit(std::unique_ptr<WriteBatchFace> _batch)
{
if (!_batch)
{
Expand Down
2 changes: 1 addition & 1 deletion libdevcore/LevelDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class LevelDB : public DatabaseFace
void kill(Slice _key) override;

std::unique_ptr<WriteBatchFace> createWriteBatch() const override;
void commit(std::unique_ptr<WriteBatchFace>&& _batch) override;
void commit(std::unique_ptr<WriteBatchFace> _batch) override;

void forEach(std::function<bool(Slice, Slice)> f) const override;

Expand Down
2 changes: 1 addition & 1 deletion libdevcore/OverlayDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct DBDetail: public LogChannel { static const char* name() { return "DBDetai
class OverlayDB: public MemoryDB
{
public:
explicit OverlayDB(std::unique_ptr<db::DatabaseFace>&& _db = nullptr)
explicit OverlayDB(std::unique_ptr<db::DatabaseFace> _db = nullptr)
: m_db(_db.release(), [](db::DatabaseFace* db) {
clog(DBDetail) << "Closing state DB";
delete db;
Expand Down
2 changes: 1 addition & 1 deletion libdevcore/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DatabaseFace
virtual void kill(Slice _key) = 0;

virtual std::unique_ptr<WriteBatchFace> createWriteBatch() const = 0;
virtual void commit(std::unique_ptr<WriteBatchFace>&& _batch) = 0;
virtual void commit(std::unique_ptr<WriteBatchFace> _batch) = 0;

// A database must implement the `forEach` method that allows the caller
// to pass in a function `f`, which will be called with the key and value
Expand Down

0 comments on commit f8d7446

Please sign in to comment.