mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 04:20:17 +00:00
Use EqualFold ti avoid memory reallocations
This commit is contained in:
@@ -22,7 +22,7 @@ func FindItemInMap[T any](item string, collection map[KeyReference[string]]Value
|
|||||||
if n.Value == item {
|
if n.Value == item {
|
||||||
return &o
|
return &o
|
||||||
}
|
}
|
||||||
if strings.ToLower(n.Value) == strings.ToLower(item) {
|
if strings.EqualFold(item, n.Value) {
|
||||||
return &o
|
return &o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,7 +233,8 @@ func FindKeyNodeTop(key string, nodes []*yaml.Node) (keyNode *yaml.Node, valueNo
|
|||||||
if i%2 != 0 {
|
if i%2 != 0 {
|
||||||
continue
|
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.
|
return v, nodes[i+1] // next node is what we need.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user