Skip to content

Commit 719e522

Browse files
committed
tree: simplify empty tree check
1 parent f028acf commit 719e522

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

tree.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func (n *node) incrementChildPrio(pos int) int {
9292
for ; newPos > 0 && cs[newPos-1].priority < prio; newPos-- {
9393
// Swap node positions
9494
cs[newPos-1], cs[newPos] = cs[newPos], cs[newPos-1]
95-
9695
}
9796

9897
// Build new index char string
@@ -112,7 +111,7 @@ func (n *node) addRoute(path string, handle Handle) {
112111
n.priority++
113112

114113
// Empty tree
115-
if len(n.path) == 0 && len(n.indices) == 0 {
114+
if n.path == "" && n.indices == "" {
116115
n.insertChild(path, fullPath, handle)
117116
n.nType = root
118117
return
@@ -348,7 +347,6 @@ walk: // Outer loop for walking the tree
348347
// trailing slash if a leaf exists for that path.
349348
tsr = (path == "/" && n.handle != nil)
350349
return
351-
352350
}
353351

354352
// Handle wildcard child

0 commit comments

Comments
 (0)