diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-09-20 17:57:13 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-09-20 17:57:20 -0400 |
commit | 2796c6e5ec9055545e987023b04eb5ebe64d5320 (patch) | |
tree | 4ab72e1699f43cb0e860a6f3f401644d59eaaeb3 /src/rpc | |
parent | 9a3a984bb884c1153866b64845db7300121966b3 (diff) | |
parent | 3ccfa34b32b7ed9d7bef05baa36827b4b262197e (diff) |
Merge #14214: convert C-style (void) parameter lists to C++ style ()
3ccfa34b32 convert C-style (void) parameter lists to C++ style () (Arvid Norberg)
Pull request description:
In C, an empty parameter list, `()`, means the function takes any arguments, and `(void)` means the function does not take any parameters.
In C++, an empty parameter list means the function does not take any parameters.
So, C++ still supports `(void)` parameter lists with the same semantics, why change to `()`?
1. removing the redundant `void` improves signal-to-noise ratio of the code
2. using `(void)` exposes a rare inconsistency in that a template taking a template `(T)` parameter list, cannot be instantiated with `T=void`
Tree-SHA512: be2897b6c5e474873aa878ed6bac098382cd21866aec33752fe40b089a6331aa6263cae749aba1b4a41e8467f1a47086d32eb74abaf09927fd5a2f44a4b2109a
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/server.cpp | 2 | ||||
-rw-r--r-- | src/rpc/server.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 8f3fe31ce8..9eb55880b3 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -540,7 +540,7 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface) timerInterface = nullptr; } -void RPCRunLater(const std::string& name, std::function<void(void)> func, int64_t nSeconds) +void RPCRunLater(const std::string& name, std::function<void()> func, int64_t nSeconds) { if (!timerInterface) throw JSONRPCError(RPC_INTERNAL_ERROR, "No timer handler registered for RPC"); diff --git a/src/rpc/server.h b/src/rpc/server.h index 15d0ec80f5..2d62a76f3c 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -110,7 +110,7 @@ public: * This is needed to cope with the case in which there is no HTTP server, but * only GUI RPC console, and to break the dependency of pcserver on httprpc. */ - virtual RPCTimerBase* NewTimer(std::function<void(void)>& func, int64_t millis) = 0; + virtual RPCTimerBase* NewTimer(std::function<void()>& func, int64_t millis) = 0; }; /** Set the factory function for timers */ @@ -124,7 +124,7 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface); * Run func nSeconds from now. * Overrides previous timer <name> (if any). */ -void RPCRunLater(const std::string& name, std::function<void(void)> func, int64_t nSeconds); +void RPCRunLater(const std::string& name, std::function<void()> func, int64_t nSeconds); typedef UniValue(*rpcfn_type)(const JSONRPCRequest& jsonRequest); |