From f2590365561991f352091a12178bfd074ce3256a Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 27 Dec 2023 20:20:20 +0100 Subject: dirty but that's the way --- c_ldirs.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'c_ldirs.go') diff --git a/c_ldirs.go b/c_ldirs.go index 468b542..199927a 100644 --- a/c_ldirs.go +++ b/c_ldirs.go @@ -59,6 +59,7 @@ type DirsNode struct { type DirsList struct { head *DirsNode + last *DirsNode } // adds a directory node to the list @@ -67,13 +68,15 @@ func (ldirs *DirsList) add_back(node *DirsNode) { if ldirs.head == nil { ldirs.head = new_node + ldirs.last = ldirs.head return } - curr := ldirs.head + curr := ldirs.last for curr.next != nil { curr = curr.next } curr.next = new_node + ldirs.last = curr.next } // return the list node with the according id -- cgit v1.2.3