mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-12 00:28:37 +08:00
Merge 8fe5246e5b845f2ae8ec42b6a414ec8979793985 into b2b489dbf4826c2c630717a77fd5e42774625410
This commit is contained in:
commit
6ee49941a5
7
tree.go
7
tree.go
@ -671,12 +671,7 @@ walk: // Outer loop for walking the tree
|
|||||||
func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) ([]byte, bool) {
|
func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) ([]byte, bool) {
|
||||||
const stackBufSize = 128
|
const stackBufSize = 128
|
||||||
|
|
||||||
// Use a static sized buffer on the stack in the common case.
|
buf := make([]byte, 0, max(stackBufSize, len(path)+1))
|
||||||
// If the path is too long, allocate a buffer on the heap instead.
|
|
||||||
buf := make([]byte, 0, stackBufSize)
|
|
||||||
if length := len(path) + 1; length > stackBufSize {
|
|
||||||
buf = make([]byte, 0, length)
|
|
||||||
}
|
|
||||||
|
|
||||||
ciPath := n.findCaseInsensitivePathRec(
|
ciPath := n.findCaseInsensitivePathRec(
|
||||||
path,
|
path,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user