@@ -39,7 +39,7 @@ type nodeType uint8
3939const (
4040 static nodeType = iota // default
4141 root
42- param
42+ parameter
4343 catchAll
4444)
4545
@@ -161,7 +161,7 @@ func (n *node) addRoute(path string, handler xhandler.HandlerC) {
161161 c := path [0 ]
162162
163163 // slash after param
164- if n .nType == param && c == '/' && len (n .children ) == 1 {
164+ if n .nType == parameter && c == '/' && len (n .children ) == 1 {
165165 n = n .children [0 ]
166166 n .priority ++
167167 continue walk
@@ -247,7 +247,7 @@ func (n *node) insertChild(numParams uint8, path, fullPath string, handler xhand
247247 }
248248
249249 child := & node {
250- nType : param ,
250+ nType : parameter ,
251251 maxParams : numParams ,
252252 }
253253 n .children = []* node {child }
@@ -322,13 +322,13 @@ func (n *node) insertChild(numParams uint8, path, fullPath string, handler xhand
322322// If no handle can be found, a TSR (trailing slash redirect) recommendation is
323323// made if a handler exists with an extra (without the) trailing slash for the
324324// given path.
325- func (n * node ) getValue (path string ) (handler xhandler.HandlerC , p Params , tsr bool ) {
325+ func (n * node ) getValue (path string ) (handler xhandler.HandlerC , p ParamHolder , tsr bool ) {
326326walk: // Outer loop for walking the tree
327327 for {
328328 if len (path ) > len (n .path ) {
329329 if path [:len (n .path )] == n .path {
330330 path = path [len (n .path ):]
331- // If this node does not have a wildcard (param or catchAll)
331+ // If this node does not have a wildcard (parameter or catchAll)
332332 // child, we can just look up the next child node and continue
333333 // to walk down the tree
334334 if ! n .wildChild {
@@ -351,8 +351,8 @@ walk: // Outer loop for walking the tree
351351 // handle wildcard child
352352 n = n .children [0 ]
353353 switch n .nType {
354- case param :
355- // find param end (either '/' or path end)
354+ case parameter :
355+ // find parameter end (either '/' or path end)
356356 end := 0
357357 for end < len (path ) && path [end ] != '/' {
358358 end ++
@@ -361,10 +361,7 @@ walk: // Outer loop for walking the tree
361361 // save param value
362362 if p .params == nil {
363363 // lazy allocation
364- p .params = make ([]struct {
365- key string
366- value string
367- }, 0 , n .maxParams )
364+ p .params = make ([]param , 0 , n .maxParams )
368365 }
369366 i := len (p .params )
370367 p .params = p .params [:i + 1 ] // expand slice within preallocated capacity
@@ -405,10 +402,7 @@ walk: // Outer loop for walking the tree
405402 // save param value
406403 if p .params == nil {
407404 // lazy allocation
408- p .params = make ([]struct {
409- key string
410- value string
411- }, 0 , n .maxParams )
405+ p .params = make ([]param , 0 , n .maxParams )
412406 }
413407 i := len (p .params )
414408 p .params = p .params [:i + 1 ] // expand slice within preallocated capacity
@@ -469,7 +463,7 @@ func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPa
469463 ciPath = append (ciPath , n .path ... )
470464
471465 if len (path ) > 0 {
472- // If this node does not have a wildcard (param or catchAll) child,
466+ // If this node does not have a wildcard (parameter or catchAll) child,
473467 // we can just look up the next child node and continue to walk down
474468 // the tree
475469 if ! n .wildChild {
@@ -493,14 +487,14 @@ func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPa
493487
494488 n = n .children [0 ]
495489 switch n .nType {
496- case param :
497- // find param end (either '/' or path end)
490+ case parameter :
491+ // find parameter end (either '/' or path end)
498492 k := 0
499493 for k < len (path ) && path [k ] != '/' {
500494 k ++
501495 }
502496
503- // add param value to case insensitive path
497+ // add parameter value to case insensitive path
504498 ciPath = append (ciPath , path [:k ]... )
505499
506500 // we need to go deeper!
0 commit comments