Merge 4aa07a2bb2ac8bc06ba0a28f63a983d6a96a8eb0 into 077a2f39c85700ba0823f85ed29cec0c8f2cbdfc

This commit is contained in:
Jian Lim 2025-08-15 19:32:10 +09:00 committed by GitHub
commit 1702740c25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -5,6 +5,8 @@
package gin package gin
const stackBufSize = 128
// cleanPath is the URL version of path.Clean, it returns a canonical URL path // cleanPath is the URL version of path.Clean, it returns a canonical URL path
// for p, eliminating . and .. elements. // for p, eliminating . and .. elements.
// //
@ -19,7 +21,6 @@ package gin
// //
// If the result of this process is an empty string, "/" is returned. // If the result of this process is an empty string, "/" is returned.
func cleanPath(p string) string { func cleanPath(p string) string {
const stackBufSize = 128
// Turn empty string into "/" // Turn empty string into "/"
if p == "" { if p == "" {
return "/" return "/"

View File

@ -679,8 +679,6 @@ walk: // Outer loop for walking the tree
// It returns the case-corrected path and a bool indicating whether the lookup // It returns the case-corrected path and a bool indicating whether the lookup
// was successful. // was successful.
func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) ([]byte, bool) { func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) ([]byte, bool) {
const stackBufSize = 128
// Use a static sized buffer on the stack in the common case. // Use a static sized buffer on the stack in the common case.
// If the path is too long, allocate a buffer on the heap instead. // If the path is too long, allocate a buffer on the heap instead.
buf := make([]byte, 0, stackBufSize) buf := make([]byte, 0, stackBufSize)