Skip to content

Commit

Permalink
Use EqualFold ti avoid memory reallocations
Browse files Browse the repository at this point in the history
  • Loading branch information
bitomaxsp authored and daveshanley committed Jun 17, 2023
1 parent a09916e commit fa33764
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion datamodel/low/extraction_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func FindItemInMap[T any](item string, collection map[KeyReference[string]]Value
if n.Value == item {
return &o
}
if strings.ToLower(n.Value) == strings.ToLower(item) {
if strings.EqualFold(item, n.Value) {
return &o
}
}
Expand Down
3 changes: 2 additions & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ func FindKeyNodeTop(key string, nodes []*yaml.Node) (keyNode *yaml.Node, valueNo
if i%2 != 0 {
continue
}
if strings.ToLower(key) == strings.ToLower(v.Value) {

if strings.EqualFold(key, v.Value) {
return v, nodes[i+1] // next node is what we need.
}
}
Expand Down

0 comments on commit fa33764

Please sign in to comment.