Skip to content
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

replace std:string to absl::string #19032

Merged
merged 1 commit into from
Nov 19, 2021
Merged

Conversation

ME-ON1
Copy link
Contributor

@ME-ON1 ME-ON1 commented Nov 17, 2021

Signed-off-by: Tarun Sharma [email protected]

Commit Message: replace std:string to absl::string
Additional Description: #11318
Risk Level: N/A
Testing: N/A
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
[Optional Runtime guard:] N/A
[Optional Fixes #Issue] N/A
[Optional Fixes commit #PR or SHA] N/A
[Optional Deprecated:] N/A
[Optional API Considerations:] N/A

@rojkov
Copy link
Member

rojkov commented Nov 18, 2021

/assign-from @envoyproxy/first-pass-reviewers

@repokitteh-read-only
Copy link

@envoyproxy/first-pass-reviewers assignee is @dmitri-d

🐱

Caused by: a #19032 (comment) was created by @rojkov.

see: more, trace.

@rojkov
Copy link
Member

rojkov commented Nov 18, 2021

/assign-from @envoyproxy/first-pass-reviewers

@repokitteh-read-only
Copy link

@envoyproxy/first-pass-reviewers assignee is @jmarantz

🐱

Caused by: a #19032 (comment) was created by @rojkov.

see: more, trace.

@rojkov rojkov assigned rojkov and unassigned jmarantz Nov 18, 2021
Copy link
Member

@rojkov rojkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the cleanup! Added a suggestion.

@@ -143,7 +143,7 @@ inline void encodeLast(uint64_t pos, uint8_t last_char, std::string& ret,

} // namespace

std::string Base64::decode(const std::string& input) {
std::string Base64::decode(absl::string_view input) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think preserving const-ness won't do much harm, but will help to detect erroneous mutation of input inside the function.

Suggested change
std::string Base64::decode(absl::string_view input) {
std::string Base64::decode(const absl::string_view input) {

Here and in the other functions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel that strongly about this, but we don't tend to do this from what I've seen in the Envoy codebase. Also why would we do this for absl::string_view and not for (say) int on input params?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

top level const shouldn't be in declaration because it doesn't affect method signature (https://clang.llvm.org/extra/clang-tidy/checks/readability-avoid-const-params-in-decls.html)
but in implementation it is encouraged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @lizan! I stand corrected )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank y'all got a great insight!!

Copy link
Contributor

@jmarantz jmarantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const input tweaks notwithstanding this lgtm.

Also IMO this is not deep enough to require senior maintainer attention but I'll ask for it anyway to adjudicate on const input params :)

/assign-from @envoyproxy/senior-maintainers

While we're waiting for that can you fill out the fields in the PR description, noting "N/A" for fields you feel are not applicable?

Thank you!

@repokitteh-read-only
Copy link

@envoyproxy/senior-maintainers assignee is @zuercher

🐱

Caused by: a #19032 (review) was submitted by @jmarantz.

see: more, trace.

Copy link
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! lgtm

@jmarantz I'll leave the merge to you when you're happy with the description, etc.

Copy link
Member

@rojkov rojkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -143,7 +143,7 @@ inline void encodeLast(uint64_t pos, uint8_t last_char, std::string& ret,

} // namespace

std::string Base64::decode(const std::string& input) {
std::string Base64::decode(absl::string_view input) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @lizan! I stand corrected )

@rojkov rojkov merged commit 8538792 into envoyproxy:main Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants