aboutsummaryrefslogtreecommitdiffstats
path: root/c_ldirs.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-09 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-09 20:20:20 +0100
commitd614eb676448a8b03de7a54b738446caf64343ee (patch)
treef918a9817a243f9c5d52979b3c90b3d18b0f7067 /c_ldirs.go
parentthis fucking bug (diff)
downloadhardflip-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.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/c_ldirs.go b/c_ldirs.go
index d707686..d7628e7 100644
--- a/c_ldirs.go
+++ b/c_ldirs.go
@@ -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
+}