mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-13 11:34:22 +00:00
refract: reduce mem alloc while building str (#10261)
Signed-off-by: jayl1e <jayl1e@outlook.com>
This commit is contained in:
@@ -1123,9 +1123,9 @@ func encodePath(pathName string) string {
|
||||
if runeLen < 0 {
|
||||
return pathName
|
||||
}
|
||||
u := make([]byte, runeLen)
|
||||
utf8.EncodeRune(u, s)
|
||||
for _, r := range u {
|
||||
var u [utf8.UTFMax]byte
|
||||
utf8.EncodeRune(u[:], s)
|
||||
for _, r := range u[:runeLen] {
|
||||
buf.WriteByte('%')
|
||||
buf.WriteByte(pathHexTable[r>>4])
|
||||
buf.WriteByte(pathHexTable[r&0x0f])
|
||||
|
||||
Reference in New Issue
Block a user