mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-29 09:55:49 +02:00
Merge bitcoin/bitcoin#24355: util, refactor: Add UNIQUE_NAME helper macro
1633f5ec88util, refactor: Add UNIQUE_NAME helper macro (Hennadii Stepanov) Pull request description: This PR replaces repetitive code with a helper macro. ACKs for top commit: laanwj: Tested ACK1633f5ec88Tree-SHA512: 5f04e472c5f3184c0a9df75395377c6744bfb2cd8f95f8427c1c5e20daa7d6a9b29e45424b88391fc6326d365907a750ab50fda534b49d1df80dccf0e18467a4
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#define BITCOIN_UTIL_EPOCHGUARD_H
|
||||
|
||||
#include <threadsafety.h>
|
||||
#include <util/macros.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -96,6 +97,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#define WITH_FRESH_EPOCH(epoch) const Epoch::Guard PASTE2(epoch_guard_, __COUNTER__)(epoch)
|
||||
#define WITH_FRESH_EPOCH(epoch) const Epoch::Guard UNIQUE_NAME(epoch_guard_)(epoch)
|
||||
|
||||
#endif // BITCOIN_UTIL_EPOCHGUARD_H
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#define PASTE(x, y) x ## y
|
||||
#define PASTE2(x, y) PASTE(x, y)
|
||||
|
||||
#define UNIQUE_NAME(name) PASTE2(name, __COUNTER__)
|
||||
|
||||
/**
|
||||
* Converts the parameter X to a string after macro replacement on X has been performed.
|
||||
* Don't merge these into one macro!
|
||||
|
||||
Reference in New Issue
Block a user