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

baggage: Member.String encodes only when necessary #4775

Merged
merged 10 commits into from
Dec 28, 2023
Prev Previous commit
Next Next commit
Move upperhex near usage
  • Loading branch information
pellared committed Dec 21, 2023
commit c660273d0a30a012fef6b62a1f50d4a56a802e7e
3 changes: 1 addition & 2 deletions baggage/baggage.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ func valueEscape(s string) string {
for i := 0; i < len(s); i++ {
c := s[i]
if shouldEscape(s[i]) {
const upperhex = "0123456789ABCDEF"
t[j] = '%'
t[j+1] = upperhex[c>>4]
t[j+2] = upperhex[c&15]
Expand All @@ -713,5 +714,3 @@ func shouldEscape(c byte) bool {
}
return !validateValueChar(int32(c))
}

const upperhex = "0123456789ABCDEF"