Merge fb022f54c074086fd6085cacd9731260089b8f3a into 19b877fa50cbbb9282763099fb177a1e5cc5c850

This commit is contained in:
白茶清欢 2025-12-06 10:55:06 +08:00 committed by GitHub
commit 788454ac13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,10 +59,12 @@ func (trees methodTrees) get(method string) *node {
return nil return nil
} }
// calculate the length of the longest common prefix of two strings
func longestCommonPrefix(a, b string) int { func longestCommonPrefix(a, b string) int {
i := 0 i := 0
max_ := min(len(a), len(b)) // commonPrefixMaxLen is the min value of a and b's length.
for i < max_ && a[i] == b[i] { commonPrefixMaxLen := min(len(a), len(b))
for i < commonPrefixMaxLen && a[i] == b[i] {
i++ i++
} }
return i return i