-
Notifications
You must be signed in to change notification settings - Fork 301
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
pe: simplify generate_hash() #411
Conversation
Given that there is no "datasize_out" and that most of the function code uses "datasize" maybe it's better to rename the function argument to "datasize" and then drop all references to "size" and "datasize_in"? this should make the diff smaller, no? |
@xnox: Thank you for reviewing. I will update the patch and force push it. |
1a5e1d6
to
ef870d7
Compare
@xnox: I have update the patch according to your recommendation. Please, review again. |
ef870d7
to
96a3804
Compare
Rebased on current origin/main |
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.
While the rest of the code is fine, I don't think making the function parameter const increases readability, or really gains anything. If anything, it's unusual enough that it makes the function harder to read in my opinion.
Code seems fine otherwise.
cd6660d
to
3e68352
Compare
Copying the value of datasize_in to two further variables and then using all three randomly in the code makes it hard to read. datasize_in is never changed in generate_hash() so we can do with this parameter alone. Rename it to datasize. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3e68352
to
0cc4db3
Compare
@frozencemetery: thank you for reviewing. I removed const and force pushed to corrected patch. |
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.
Thanks, I'm happy with this.
Copying the value of datasize_in to two further variables and then using
all three randomly in the code makes it hard to read.
datasize_in is never changed in generate_hash() so we can do with this
parameter alone. Let's declare it as const to verify that its value
is invariant.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com