mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Declare single-argument (non-converting) constructors "explicit"
In order to avoid unintended implicit conversions.
This commit is contained in:
@@ -196,7 +196,7 @@ private:
|
||||
int value;
|
||||
|
||||
public:
|
||||
CSemaphore(int init) : value(init) {}
|
||||
explicit CSemaphore(int init) : value(init) {}
|
||||
|
||||
void wait()
|
||||
{
|
||||
@@ -267,7 +267,7 @@ public:
|
||||
|
||||
CSemaphoreGrant() : sem(nullptr), fHaveGrant(false) {}
|
||||
|
||||
CSemaphoreGrant(CSemaphore& sema, bool fTry = false) : sem(&sema), fHaveGrant(false)
|
||||
explicit CSemaphoreGrant(CSemaphore& sema, bool fTry = false) : sem(&sema), fHaveGrant(false)
|
||||
{
|
||||
if (fTry)
|
||||
TryAcquire();
|
||||
|
||||
Reference in New Issue
Block a user