diff options
author | Joe <rbo@gmx.us> | 2023-12-27 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2023-12-27 20:20:20 +0100 |
commit | f2590365561991f352091a12178bfd074ce3256a (patch) | |
tree | 74a44ba79fb7eee93a7f5bb2404543cb510a3169 /c_litems.go | |
parent | not quite clean (diff) | |
download | hardflip-f2590365561991f352091a12178bfd074ce3256a.tar.gz hardflip-f2590365561991f352091a12178bfd074ce3256a.tar.bz2 hardflip-f2590365561991f352091a12178bfd074ce3256a.tar.xz hardflip-f2590365561991f352091a12178bfd074ce3256a.tar.zst hardflip-f2590365561991f352091a12178bfd074ce3256a.zip |
dirty but that's the way
Diffstat (limited to 'c_litems.go')
-rw-r--r-- | c_litems.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/c_litems.go b/c_litems.go index e607d19..05ffbe2 100644 --- a/c_litems.go +++ b/c_litems.go @@ -56,6 +56,7 @@ type ItemsNode struct { type ItemsList struct { head *ItemsNode + last *ItemsNode } func (litems *ItemsList) add_back(node *ItemsNode) { @@ -63,13 +64,15 @@ func (litems *ItemsList) add_back(node *ItemsNode) { if litems.head == nil { litems.head = new_node + litems.last = litems.head return } - curr := litems.head + curr := litems.last for curr.next != nil { curr = curr.next } new_node.ID = curr.ID + 1 curr.next = new_node + litems.last = curr.next } |