aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-05 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-05 20:20:20 +0100
commit4b06549cd72411db72ae231e5ad6b1ae16ca0fbf (patch)
tree7ec03fae7cb66b388d3939658523e8be603c6387
parenttodolist (diff)
downloadhardflip-4b06549cd72411db72ae231e5ad6b1ae16ca0fbf.tar.gz
hardflip-4b06549cd72411db72ae231e5ad6b1ae16ca0fbf.tar.bz2
hardflip-4b06549cd72411db72ae231e5ad6b1ae16ca0fbf.tar.xz
hardflip-4b06549cd72411db72ae231e5ad6b1ae16ca0fbf.tar.zst
hardflip-4b06549cd72411db72ae231e5ad6b1ae16ca0fbf.zip
cool
-rw-r--r--c_hardflip.go4
-rw-r--r--c_init.go10
-rw-r--r--c_litems.go18
3 files changed, 11 insertions, 21 deletions
diff --git a/c_hardflip.go b/c_hardflip.go
index e6bdbe0..c3945c1 100644
--- a/c_hardflip.go
+++ b/c_hardflip.go
@@ -94,8 +94,7 @@ func (data *HardData) sel_unique_id(id int) {
}
func main() {
- // TODO: fill litems
- // TODO: delete data.ptr | replace with litems
+ // TODO: delete data.ptr | replace everything ui with litems
data_dir := c_get_data_dir()
opts := HardOpts{true, true, false}
ldirs := c_load_data_dir(data_dir, opts)
@@ -144,6 +143,7 @@ func main() {
}
}
+ return
// PERF: test performance over a large amount of hosts with litems
i_ui(&data)
}
diff --git a/c_init.go b/c_init.go
index b5caf6a..222c796 100644
--- a/c_init.go
+++ b/c_init.go
@@ -113,10 +113,18 @@ func c_load_data_dir(dir string, opts HardOpts) *DirsList {
return &ldirs
}
+// fills litems sorting with dirs last
+// other sorting algos are concievable
func c_load_litems(ldirs *DirsList) *ItemsList {
litems := ItemsList{}
- for dir := ldirs.head; dir != nil; dir = dir.next {
+ for ptr := ldirs.head; ptr != nil; ptr = ptr.next {
+ item := ItemsNode{ Dirs: ptr, Host: nil }
+ litems.add_back(&item)
+ for ptr := ptr.lhost.head; ptr != nil; ptr = ptr.next {
+ item := ItemsNode{ Dirs: nil, Host: ptr }
+ litems.add_back(&item)
+ }
}
return &litems
}
diff --git a/c_litems.go b/c_litems.go
index 7fa93c3..44831ff 100644
--- a/c_litems.go
+++ b/c_litems.go
@@ -64,24 +64,6 @@ type ItemsList struct {
last *ItemsNode
}
-func (litems *ItemsList) is_dir(id int) bool {
- curr := litems.head
-
- if curr == nil {
- return false
- }
- for curr.next != nil && curr.ID != id {
- curr = curr.next
- }
- if curr.ID != id {
- return false
- }
- if curr.Dirs != nil {
- return true
- }
- return false
-}
-
func (litems *ItemsList) add_back(node *ItemsNode) {
if litems.head == nil {
litems.head = node