-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
src: use const parameters in base64_decode_slow() #12144
Conversation
Make parameters as const since it's both better at its own and consistent with base64_decode_fast() and base64_decode().
a5e8045
to
008bbbc
Compare
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.
size_t base64_decode_slow(char* dst, size_t dstlen, | ||
const TypeName* src, size_t srclen) { | ||
size_t base64_decode_slow(char* const dst, const size_t dstlen, | ||
const TypeName* const src, const size_t srclen) { |
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.
Is the second const
for src
necessary?
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.
Not strictly necessary, but why not add it if we don't mutate the pointer? And that would be consistent with base64_decode_slow()
(line 90) and base64_decode()
(line 122).
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.
@richardlau The first const
declares the pointed-to memory immutable, the second one declares the pointer itself immutable (i.e., not reassignable.)
Well, I've just tried to do something more interesting, so this PR will be a bit obsolete if everything's okay with #12146. |
Closing this as #12146 has landed. |
Make parameters as
const
since it's both better at its own and consistent withbase64_decode_fast()
andbase64_decode()
.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
src