diff options
author | fanquake <fanquake@gmail.com> | 2020-02-11 14:51:08 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-02-11 15:26:31 +0800 |
commit | 35b7a8e539fae30b0d0bc0ae4a3a994091626cbe (patch) | |
tree | 5e5e97c659eb49c6578f768ed9bd347eb1d98cf5 /src/serialize.h | |
parent | 646f0ada0205ae4b3952107e3b1542f06adda32b (diff) | |
parent | 0e0fa27acb74b4f0075afcf59a0dff51a21baddb (diff) | |
download | bitcoin-35b7a8e539fae30b0d0bc0ae4a3a994091626cbe.tar.xz |
Merge #18087: Get rid of VARINT default argument
0e0fa27acb74b4f0075afcf59a0dff51a21baddb Get rid of VARINT default argument (Pieter Wuille)
Pull request description:
This removes the need for the non-strandard use of variadic macros.
ACKs for top commit:
ryanofsky:
Code review ACK 0e0fa27acb74b4f0075afcf59a0dff51a21baddb. Only change since last review reverting outdated documentation change from earlier version of pr
jonatack:
ACK 0e0fa27 code review, built/ran tests/bitcoind
practicalswift:
ACK 0e0fa27acb74b4f0075afcf59a0dff51a21baddb -- diff looks correct
MarcoFalke:
ACK 0e0fa27acb74b4f0075afcf59a0dff51a21baddb 📯
Tree-SHA512: 6e335e4b586d62112b7260a12481cd949d1b3bbdb83edf8db690348f0a01852e68504336ff3e072e5131a7c8cb404ef11a2f786f842b8d08bbf6ea0e688777b1
Diffstat (limited to 'src/serialize.h')
-rw-r--r-- | src/serialize.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/serialize.h b/src/serialize.h index 75d6b52154..cee7225bcb 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -493,12 +493,13 @@ public: template<typename Formatter, typename T> static inline Wrapper<Formatter, T&> Using(T&& t) { return Wrapper<Formatter, T&>(t); } -#define VARINT(obj, ...) Using<VarIntFormatter<__VA_ARGS__>>(obj) +#define VARINT_MODE(obj, mode) Using<VarIntFormatter<mode>>(obj) +#define VARINT(obj) Using<VarIntFormatter<VarIntMode::DEFAULT>>(obj) #define COMPACTSIZE(obj) CCompactSize(REF(obj)) #define LIMITED_STRING(obj,n) LimitedString< n >(REF(obj)) /** Serialization wrapper class for integers in VarInt format. */ -template<VarIntMode Mode=VarIntMode::DEFAULT> +template<VarIntMode Mode> struct VarIntFormatter { template<typename Stream, typename I> void Ser(Stream &s, I v) |