netmap: Fix string escape in PlacementPolicy.String() #207

Merged
fyrchik merged 1 commit from fyrchik/frostfs-sdk-go:fix-parser into master 2024-03-01 15:02:07 +00:00
Owner

Signed-off-by: Evgenii Stratonikov e.stratonikov@yadro.com

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
fyrchik requested review from storage-core-committers 2024-03-01 14:34:28 +00:00
fyrchik requested review from storage-core-developers 2024-03-01 14:34:28 +00:00
fyrchik force-pushed fix-parser from 4eea81fe56 to 083cc88a43 2024-03-01 14:35:21 +00:00 Compare
fyrchik reviewed 2024-03-01 14:39:41 +00:00
@ -945,2 +946,3 @@
func escapeString(s string) string {
if strings.ContainsAny(s, " -\t") {
for _, r := range s {
if 'a' <= r && r <= 'z' || 'A' <= r && r <= 'Z' || '0' <= r && r <= '9' || r == '_' {
Author
Owner

I have benchmarked strings.ContainsAny, regexp and this.
regexp was twice as slow
strings.ContainsAny was less readable (good luck counting symbols)
this is maintainable and obvious

I have benchmarked `strings.ContainsAny`, regexp and this. regexp was twice as slow strings.ContainsAny was less readable (good luck counting symbols) this is maintainable and obvious
dkirillov approved these changes 2024-03-01 14:55:41 +00:00
fyrchik merged commit 6fe4e2541d into master 2024-03-01 15:02:07 +00:00
fyrchik deleted branch fix-parser 2024-03-01 15:02:08 +00:00
acid-ant approved these changes 2024-03-01 16:40:38 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-sdk-go#207
No description provided.