aboutsummaryrefslogtreecommitdiffhomepage
path: root/ldd/ldd.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-14 18:32:47 +0900
committerOphestra <cat@gensokyo.uk>2025-11-14 18:32:47 +0900
commit8e2d2c8246409dca96cee8589c0d841ef878d802 (patch)
tree58d00b08d6b05dac6988a0994cfc0b71988580c7 /ldd/ldd.go
parent299685775a373bfcf18f03a1c2b7db996ff90267 (diff)
ldd: check decoder scan guard
This was unreachable via the Parse wrapper. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'ldd/ldd.go')
-rw-r--r--ldd/ldd.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/ldd/ldd.go b/ldd/ldd.go
index 9611c7b4..7b88e698 100644
--- a/ldd/ldd.go
+++ b/ldd/ldd.go
@@ -44,21 +44,6 @@ type Entry struct {
Location uint64 `json:"location"`
}
-// Path returns a deduplicated slice of absolute directory paths in entries.
-func Path(entries []*Entry) []*check.Absolute {
- p := make([]*check.Absolute, 0, len(entries)*2)
- for _, entry := range entries {
- if entry.Path != nil {
- p = append(p, entry.Path.Dir())
- }
- if a, err := check.NewAbs(entry.Name); err == nil {
- p = append(p, a.Dir())
- }
- }
- check.SortAbs(p)
- return check.CompactAbs(p)
-}
-
const (
// entrySegmentIndexName is the index of the segment holding [Entry.Name].
entrySegmentIndexName = 0
@@ -132,6 +117,21 @@ func (e *Entry) UnmarshalText(data []byte) error {
return e.decodeLocationSegment(segments[iL])
}
+// Path returns a deduplicated slice of absolute directory paths in entries.
+func Path(entries []*Entry) []*check.Absolute {
+ p := make([]*check.Absolute, 0, len(entries)*2)
+ for _, entry := range entries {
+ if entry.Path != nil {
+ p = append(p, entry.Path.Dir())
+ }
+ if a, err := check.NewAbs(entry.Name); err == nil {
+ p = append(p, a.Dir())
+ }
+ }
+ check.SortAbs(p)
+ return check.CompactAbs(p)
+}
+
// A Decoder reads and decodes [Entry] values from an input stream.
//
// The zero value is not safe for use.