Skip to content

Commit 0d86f4d

Browse files
committed
refactor: consolidate PASTE macros
1 parent 6e43129 commit 0d86f4d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ BITCOIN_CORE_H = \
209209
util/error.h \
210210
util/fees.h \
211211
util/system.h \
212+
util/macros.h \
212213
util/memory.h \
213214
util/moneystr.h \
214215
util/rbf.h \

src/sync.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#define BITCOIN_SYNC_H
88

99
#include <threadsafety.h>
10+
#include <util/macros.h>
1011

1112
#include <condition_variable>
1213
#include <thread>
@@ -176,9 +177,6 @@ class SCOPED_LOCKABLE UniqueLock : public Base
176177
template<typename MutexArg>
177178
using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove_pointer<MutexArg>::type>::type>;
178179

179-
#define PASTE(x, y) x ## y
180-
#define PASTE2(x, y) PASTE(x, y)
181-
182180
#define LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__)
183181
#define LOCK2(cs1, cs2) \
184182
DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, __LINE__); \

src/util/macros.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) 2019 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef BITCOIN_UTIL_MACROS_H
6+
#define BITCOIN_UTIL_MACROS_H
7+
8+
#define PASTE(x, y) x ## y
9+
#define PASTE2(x, y) PASTE(x, y)
10+
11+
#endif // BITCOIN_UTIL_MACROS_H

0 commit comments

Comments
 (0)