aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-08-22 08:26:11 +0200
committerMacroFake <falke.marco@gmail.com>2022-08-22 08:26:16 +0200
commit027b6729bce7f59a0744e17b210e347a098631ad (patch)
tree1a49a1c0f46725718523246ad9e7deaef0f39c49
parentc73c8d53fe27956faacb3e8ca0e94adf071de6ec (diff)
parent706c8e096978b694fb56dee9e8ed8f55373ad5a0 (diff)
downloadbitcoin-027b6729bce7f59a0744e17b210e347a098631ad.tar.xz
Merge bitcoin/bitcoin#25888: refactor: use `strprintf` for creating unknown-service-flag string
706c8e096978b694fb56dee9e8ed8f55373ad5a0 refactor: use `strprintf` for creating unknown-service-flag string (Sebastian Falbesoner) Pull request description: No need to use a stringstream here. The trivial change can be verified by running the functional test `rpc_net.py`: https://github.com/bitcoin/bitcoin/blob/c73c8d53fe27956faacb3e8ca0e94adf071de6ec/test/functional/rpc_net.py#L181-L184 As far as I could tell, this is the only instace left where we used `std::ostringstream` for the creation of simple strings (in `FormatSubVersion` using a stream makes sense since the number of placeholders is not constant). ACKs for top commit: kristapsk: ACK 706c8e096978b694fb56dee9e8ed8f55373ad5a0 Tree-SHA512: 069cea29aef03996ae16a0dc3ed87b1b2cf2ab0bf5987c225b10da12d0f4b62b7c3faf3a169c0b912eb2ad60c6ea0a09a622be7eaadad78cee0463ef4ffc0e19
-rw-r--r--src/protocol.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 139405170b..bdd1cc2aff 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -199,12 +199,7 @@ static std::string serviceFlagToStr(size_t bit)
// Not using default, so we get warned when a case is missing
}
- std::ostringstream stream;
- stream.imbue(std::locale::classic());
- stream << "UNKNOWN[";
- stream << "2^" << bit;
- stream << "]";
- return stream.str();
+ return strprintf("UNKNOWN[2^%u]", bit);
}
std::vector<std::string> serviceFlagsToStr(uint64_t flags)