mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-06 12:08:20 +08:00
Compare commits
2 Commits
4c2617b61c
...
66e9e92846
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66e9e92846 | ||
|
|
fb022f54c0 |
6
tree.go
6
tree.go
@ -58,10 +58,12 @@ func (trees methodTrees) get(method string) *node {
|
||||
return nil
|
||||
}
|
||||
|
||||
// calculate the length of the longest common prefix of two strings
|
||||
func longestCommonPrefix(a, b string) int {
|
||||
i := 0
|
||||
max_ := min(len(a), len(b))
|
||||
for i < max_ && a[i] == b[i] {
|
||||
// commonPrefixMaxLen is the min value of a and b's length.
|
||||
commonPrefixMaxLen := min(len(a), len(b))
|
||||
for i < commonPrefixMaxLen && a[i] == b[i] {
|
||||
i++
|
||||
}
|
||||
return i
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user