diff options
author | Joe <rbo@gmx.us> | 2024-01-09 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-09 20:20:20 +0100 |
commit | d614eb676448a8b03de7a54b738446caf64343ee (patch) | |
tree | f918a9817a243f9c5d52979b3c90b3d18b0f7067 /c_ldirs.go | |
parent | this fucking bug (diff) | |
download | hardflip-d614eb676448a8b03de7a54b738446caf64343ee.tar.gz hardflip-d614eb676448a8b03de7a54b738446caf64343ee.tar.bz2 hardflip-d614eb676448a8b03de7a54b738446caf64343ee.tar.xz hardflip-d614eb676448a8b03de7a54b738446caf64343ee.tar.zst hardflip-d614eb676448a8b03de7a54b738446caf64343ee.zip |
i can't fix that shit
Diffstat (limited to '')
-rw-r--r-- | c_ldirs.go | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -110,9 +110,21 @@ func (dir *DirsNode) path() string { return path } +// returns the number of hosts of the dir func (dir *DirsNode) count_hosts() int { - if dir.lhost.head == nil { + if dir.lhost.head == nil || dir.lhost.last == nil { return 0 } return dir.lhost.last.ID + 1 } + +// return the number of hosts and subfolders of the dir +func (dir *DirsNode) count_elements() int { + items := 0 + + items += dir.count_hosts() + for ptr := dir.next; ptr != nil && ptr.Depth > dir.Depth; ptr = ptr.next { + items += ptr.count_hosts() + 1 + } + return items +} |