diff options
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 } |