mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-27 23:39:46 +02:00
Merge bitcoin/bitcoin#31650: refactor: Avoid copies by using const references or by move-construction
fa64d8424brefactor: Enforce readability-avoid-const-params-in-decls (MarcoFalke)faf0c2d942refactor: Avoid copies by using const references or by move-construction (MarcoFalke) Pull request description: Top level `const` in declarations is problematic for many reasons: * It is often a typo, where one wanted to denote a const reference. For example `bool PSBTInputSignedAndVerified(const PartiallySignedTransaction psbt, ...` is missing the `&`. This will create a redundant copy of the value. * In constructors it prevents move construction. * It can incorrectly imply some data is const, like in an imaginary example `std::span<int> Shuffle(const std::span<int>);`, where the `int`s are *not* const. * The compiler ignores the `const` from the declaration in the implementation. * It isn't used consistently anyway, not even on the same line. Fix some issues by: * Using a const reference to avoid a copy, where read-only of the value is intended. This is only done for values that may be expensive to copy. * Using move-construction to avoid a copy * Applying `readability-avoid-const-params-in-decls` via clang-tidy ACKs for top commit: l0rinc: diff reACKfa64d8424bhebasto: ACKfa64d8424b, I have reviewed the code and it looks OK. sedited: ACKfa64d8424bTree-SHA512: 293c000b4ebf8fdcc75259eb0283a2e4e7892c73facfb5c3182464d6cb6a868b7f4a6682d664426bf2edecd665cf839d790bef0bae43a8c3bf1ddfdd3d068d38
This commit is contained in:
@@ -760,7 +760,7 @@ BITCOINKERNEL_API void btck_logging_disable();
|
||||
*
|
||||
* @param[in] options Sets formatting options of the log messages.
|
||||
*/
|
||||
BITCOINKERNEL_API void btck_logging_set_options(const btck_LoggingOptions options);
|
||||
BITCOINKERNEL_API void btck_logging_set_options(btck_LoggingOptions options);
|
||||
|
||||
/**
|
||||
* @brief Set the log level of the global internal logger. This does not
|
||||
@@ -835,7 +835,7 @@ BITCOINKERNEL_API void btck_logging_connection_destroy(btck_LoggingConnection* l
|
||||
* @return An allocated chain parameters opaque struct.
|
||||
*/
|
||||
BITCOINKERNEL_API btck_ChainParameters* BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_parameters_create(
|
||||
const btck_ChainType chain_type);
|
||||
btck_ChainType chain_type);
|
||||
|
||||
/**
|
||||
* Copy the chain parameters.
|
||||
|
||||
Reference in New Issue
Block a user