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 | be73738c35a3371684927146b263a3f013a1dedc (patch) | |
tree | aec9164520ded8b1174196a074b9ce7c271cab62 /c_litems.go | |
parent | fix that shiet (diff) | |
download | hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.gz hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.bz2 hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.xz hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.zst hardflip-be73738c35a3371684927146b263a3f013a1dedc.zip |
in progress
Diffstat (limited to 'c_litems.go')
-rw-r--r-- | c_litems.go | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/c_litems.go b/c_litems.go index df20520..c5e93ff 100644 --- a/c_litems.go +++ b/c_litems.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/c_litems.go - * Mon Jan 08 13:36:49 2024 + * Tue Jan 09 10:51:22 2024 * Joe * * the dir and hosts linked list @@ -87,22 +87,39 @@ func (litems *ItemsList) del(item *ItemsNode) { } if litems.head == item { litems.head = litems.head.next + if litems.head == nil { + litems.last = nil + litems.curr = nil + litems.draw_start = nil + return + } litems.head.prev = nil - for curr := litems.head; curr != nil; curr = curr.next { - curr.ID -= 1 + litems.curr = litems.head + litems.draw_start = litems.head + for ptr := litems.head; ptr != nil; ptr = ptr.next { + ptr.ID -= 1 } return } - curr := litems.head - for curr.next != nil && curr.next != item { - curr = curr.next + if litems.last == item { + litems.last = litems.last.prev + litems.last.next = nil + litems.curr = litems.last + if litems.draw_start == item { + litems.draw_start = litems.last + } + return + } + ptr := litems.head + for ptr.next != nil && ptr.next != item { + ptr = ptr.next } - if curr.next == item { - curr.next = curr.next.next - curr.next.prev = curr + if ptr.next == item { + ptr.next = ptr.next.next + ptr.next.prev = ptr } - for curr := curr.next; curr != nil; curr = curr.next { - curr.ID -= 1 + for ptr := ptr.next; ptr != nil; ptr = ptr.next { + ptr.ID -= 1 } } |