-
Notifications
You must be signed in to change notification settings - Fork 38.7k
refactor: Replace memset calls with array initialization #21939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
re-ACK 1c9255c Checked the disassembly with It doesn't generate memsets, but the Second constructor DetailsThis one is more complex, but it works out, contains the same clearing code: |
|
For reference, from https://en.cppreference.com/w/c/language/array_initialization
|
kristapsk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 5d2e40c4d2394758e8026f796de89e8569f8dc86, code looks correct.
| memset(pchChecksum, 0, CHECKSUM_SIZE); | ||
| } | ||
|
|
||
| CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also change the type here to std::string or std::span instead of a loose pointer, at some point and clean up the loop (oh and rename the argument to message_type maybe instead of command, when we're at it). No need to do so in this PR though.
|
Code review ACK 1c9255c Looking at the code I noticed both |
|
I have a patchset to remove |
Another good point. There are only very few places where bare 'char' is a good choice. But let's leave it for a future PR. |
…lization 1c9255c refactor: Replace memset calls with array initialization (João Barbosa) Pull request description: Follow up to bitcoin#21905 (review). ACKs for top commit: laanwj: re-ACK 1c9255c Crypt-iQ: Code review ACK 1c9255c Tree-SHA512: 4b61dec2094f4781ef1c0427ee3bda3cfea12111274eebc7bc40a84f261d9c1681dd0860c57200bea2456588e44e8e0aecd18545c25f1f1250dd331ab7d05f28
Follow up to #21905 (review).