aboutsummaryrefslogtreecommitdiffstats
path: root/c_lhosts.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2023-12-18 20:20:20 +0100
committerJoe <rbo@gmx.us>2023-12-18 20:20:20 +0100
commitff46232876da57297d6f8b46e311fcd0f659b5cf (patch)
tree300b49d4c3ba84d1a7ac8e0a06ba68563c03395d /c_lhosts.go
parentadded LICENSE (diff)
downloadhardflip-ff46232876da57297d6f8b46e311fcd0f659b5cf.tar.gz
hardflip-ff46232876da57297d6f8b46e311fcd0f659b5cf.tar.bz2
hardflip-ff46232876da57297d6f8b46e311fcd0f659b5cf.tar.xz
hardflip-ff46232876da57297d6f8b46e311fcd0f659b5cf.tar.zst
hardflip-ff46232876da57297d6f8b46e311fcd0f659b5cf.zip
up
Diffstat (limited to '')
-rw-r--r--c_lhosts.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/c_lhosts.go b/c_lhosts.go
index 8e9a416..d98305c 100644
--- a/c_lhosts.go
+++ b/c_lhosts.go
@@ -110,6 +110,7 @@ func (lhost *HostList) del(id uint64) {
// return the list node with the according id
func (lhost *HostList) sel(id uint64) *HostNode {
curr := lhost.head
+
for curr.next != nil && curr.ID != id {
curr = curr.next
}
@@ -118,3 +119,14 @@ func (lhost *HostList) sel(id uint64) *HostNode {
}
return curr
}
+
+func (lhost *HostList) count() uint64 {
+ curr := lhost.head
+ var count uint64 = 0
+
+ for curr != nil {
+ curr = curr.next
+ count++
+ }
+ return count
+}