From 2cc5d6269d2ad3326c4ba4c6378fb0e9404646d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 11:03:57 +0100 Subject: [chore]: Bump codeberg.org/gruf/go-structr from 0.9.0 to 0.9.6 (#3973) Bumps codeberg.org/gruf/go-structr from 0.9.0 to 0.9.6. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-structr dependency-version: 0.9.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- vendor/codeberg.org/gruf/go-structr/index.go | 37 +++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'vendor/codeberg.org/gruf/go-structr/index.go') diff --git a/vendor/codeberg.org/gruf/go-structr/index.go b/vendor/codeberg.org/gruf/go-structr/index.go index eed2e4eea..23d3ffaee 100644 --- a/vendor/codeberg.org/gruf/go-structr/index.go +++ b/vendor/codeberg.org/gruf/go-structr/index.go @@ -1,6 +1,7 @@ package structr import ( + "os" "reflect" "strings" "sync" @@ -244,6 +245,39 @@ func (i *Index) key(buf *byteutil.Buffer, parts []unsafe.Pointer) string { return string(buf.B) } +// add will attempt to add given index entry to appropriate +// doubly-linked-list in index hashmap. in the case of an +// existing entry in a "unique" index, it will return false. +func (i *Index) add(key string, item *indexed_item) bool { + // Look for existing. + l := i.data.Get(key) + + if l == nil { + + // Allocate new. + l = new_list() + i.data.Put(key, l) + + } else if is_unique(i.flags) { + + // Collision! + return false + } + + // Prepare new index entry. + entry := new_index_entry() + entry.item = item + entry.key = key + entry.index = i + + // Add ourselves to item's index tracker. + item.indexed = append(item.indexed, entry) + + // Add entry to index list. + l.push_front(&entry.elem) + return true +} + // append will append the given index entry to appropriate // doubly-linked-list in index hashmap. this handles case of // overwriting "unique" index entries, and removes from given @@ -403,7 +437,8 @@ func new_index_entry() *index_entry { func free_index_entry(entry *index_entry) { if entry.elem.next != nil || entry.elem.prev != nil { - should_not_reach(false) + msg := assert("entry not in use") + os.Stderr.WriteString(msg + "\n") return } entry.key = "" -- cgit v1.2.3