aboutsummaryrefslogtreecommitdiffstats
path: root/c_lhosts.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
commitbe73738c35a3371684927146b263a3f013a1dedc (patch)
treeaec9164520ded8b1174196a074b9ce7c271cab62 /c_lhosts.go
parentfix that shiet (diff)
downloadhardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.gz
hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.bz2
hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.xz
hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.zst
hardflip-be73738c35a3371684927146b263a3f013a1dedc.zip
in progress
Diffstat (limited to '')
-rw-r--r--c_lhosts.go31
1 files changed, 21 insertions, 10 deletions
diff --git a/c_lhosts.go b/c_lhosts.go
index 791e885..74726d8 100644
--- a/c_lhosts.go
+++ b/c_lhosts.go
@@ -43,7 +43,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/c_lhosts.go
- * Fri Jan 05 12:29:56 2024
+ * Tue Jan 09 11:16:59 2024
* Joe
*
* the hosts linked list
@@ -103,20 +103,31 @@ func (lhost *HostList) del(host *HostNode) {
}
if lhost.head == host {
lhost.head = lhost.head.next
- for curr:= lhost.head; curr != nil; curr = curr.next {
- curr.ID -= 1
+ if lhost.head == nil {
+ lhost.last = nil
+ return
+ }
+ for ptr := lhost.head; ptr != nil; ptr = ptr.next {
+ ptr.ID -= 1
}
return
}
- curr := lhost.head
- for curr.next != nil && curr.next != host {
- curr = curr.next
+ ptr := lhost.head
+ for ptr.next != nil && ptr.next != host {
+ ptr = ptr.next
}
- if curr.next == host {
- curr.next = curr.next.next
+ if ptr.next == host {
+ ptr.next = ptr.next.next
}
- for curr := curr.next; curr != nil; curr = curr.next {
- curr.ID -= 1
+ for ptr := ptr.next; ptr != nil; ptr = ptr.next {
+ ptr.ID -= 1
+ }
+ if lhost.last == host {
+ ptr := lhost.head
+ for ptr.next != nil {
+ ptr = ptr.next
+ }
+ lhost.last = ptr
}
}