mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-09 14:14:11 +08:00
Compare commits
2 Commits
305bdf2a80
...
e8d5e56135
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8d5e56135 | ||
|
|
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