From c17abea92162f0ac1ccfff4223e26eac431c1198 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Wed, 2 Oct 2024 10:58:20 +0000 Subject: update go-structr to v0.8.11 (#3380) --- vendor/codeberg.org/gruf/go-structr/queue.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'vendor/codeberg.org/gruf/go-structr/queue.go') diff --git a/vendor/codeberg.org/gruf/go-structr/queue.go b/vendor/codeberg.org/gruf/go-structr/queue.go index 0e4f4e3cf..dab925f95 100644 --- a/vendor/codeberg.org/gruf/go-structr/queue.go +++ b/vendor/codeberg.org/gruf/go-structr/queue.go @@ -68,9 +68,9 @@ func (q *Queue[T]) Init(config QueueConfig[T]) { // Index selects index with given name from queue, else panics. func (q *Queue[T]) Index(name string) *Index { - for i := range q.indices { - if q.indices[i].name == name { - return &q.indices[i] + for i, idx := range q.indices { + if idx.name == name { + return &(q.indices[i]) } } panic("unknown index: " + name) @@ -207,17 +207,17 @@ func (q *Queue[T]) Len() int { // Debug returns debug stats about queue. func (q *Queue[T]) Debug() map[string]any { - m := make(map[string]any) + m := make(map[string]any, 2) q.mutex.Lock() m["queue"] = q.queue.len - indices := make(map[string]any) + indices := make(map[string]any, len(q.indices)) m["indices"] = indices - for i := range q.indices { + for _, idx := range q.indices { var n uint64 - for _, l := range q.indices[i].data.m { + for _, l := range idx.data.m { n += uint64(l.len) } - indices[q.indices[i].name] = n + indices[idx.name] = n } q.mutex.Unlock() return m -- cgit v1.2.3