mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-30 15:54:03 +02:00
Merge #21404: refactor: Remove MakeUnique<T>()
1a6323bdbedoc: update developer notes for removal of MakeUnique (fanquake)3ba2840e7escripted-diff: remove MakeUnique<T>() (fanquake) Pull request description: Since requiring C++17, this is just pointless abstraction. I think we should just "tear the band-aid off" and remove it. Similar to the changes happening in #21366. Also, having a comment saying this is deprecated doesn't prevent it's usage in new code. i.e : https://github.com/bitcoin/bitcoin/pull/20946#discussion_r561949731. The repository is fairly quiet at the moment, so any potential complaints about having to rebase should be minimal. Might as well get this over and done with. ACKs for top commit: jnewbery: utACK1a6323bdbepracticalswift: cr ACK1a6323bdbe: patch looks correct ajtowns: ACK1a6323bdbe-- code review only glozow: ACK1a6323bdbelooks correct Tree-SHA512: 4a14b9611b60b9b3026b54d6f5a2dce4c5d9b63a7b93d7de1307512df736503ed84bac66e7b93372c76e3117f49bf9f29cd473d3a47cb41fb2775bc10234736f
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2020 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_UTIL_MEMORY_H
|
||||
#define BITCOIN_UTIL_MEMORY_H
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
//! Substitute for C++14 std::make_unique.
|
||||
//! DEPRECATED use std::make_unique in new code.
|
||||
template <typename T, typename... Args>
|
||||
std::unique_ptr<T> MakeUnique(Args&&... args)
|
||||
{
|
||||
return std::make_unique<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -100,7 +100,7 @@ bool LockDirectory(const fs::path& directory, const std::string lockfile_name, b
|
||||
// Create empty lock file if it doesn't exist.
|
||||
FILE* file = fsbridge::fopen(pathLockFile, "a");
|
||||
if (file) fclose(file);
|
||||
auto lock = MakeUnique<fsbridge::FileLock>(pathLockFile);
|
||||
auto lock = std::make_unique<fsbridge::FileLock>(pathLockFile);
|
||||
if (!lock->TryLock()) {
|
||||
return error("Error while attempting to lock directory %s: %s", directory.string(), lock->GetReason());
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <optional.h>
|
||||
#include <sync.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/memory.h>
|
||||
#include <util/settings.h>
|
||||
#include <util/threadnames.h>
|
||||
#include <util/time.h>
|
||||
|
||||
Reference in New Issue
Block a user