diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-01-04 10:35:26 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-01-11 16:30:08 +0100 |
| commit | 983508d80442a85b78118e6c6a03d5ae4897e4df (patch) | |
| tree | 4d45c36a95a2ae407fa780a68925e0014c75e7e6 /prog/target.go | |
| parent | bad18a53de8fa8d3d097e3d701efb72a014661cb (diff) | |
prog: pass ctx by pointer to ForeachType callback
This will allow callbacks to stop iteration early by
setting ctx.Stop flag (as it works for ForeachArg).
Diffstat (limited to 'prog/target.go')
| -rw-r--r-- | prog/target.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/prog/target.go b/prog/target.go index cb485c069..182d46391 100644 --- a/prog/target.go +++ b/prog/target.go @@ -205,7 +205,7 @@ func restoreLinks(syscalls []*Syscall, resources []*ResourceDesc, types []Type) resourceMap[res.Name] = res } - ForeachType(syscalls, func(typ Type, ctx TypeCtx) { + ForeachType(syscalls, func(typ Type, ctx *TypeCtx) { if ref, ok := typ.(Ref); ok { typ = types[ref] *ctx.Ptr = typ @@ -230,7 +230,7 @@ func (target *Target) DefaultChoiceTable() *ChoiceTable { func (target *Target) GetGlobs() map[string]bool { globs := make(map[string]bool) - ForeachType(target.Syscalls, func(typ Type, ctx TypeCtx) { + ForeachType(target.Syscalls, func(typ Type, ctx *TypeCtx) { switch a := typ.(type) { case *BufferType: if a.Kind == BufferGlob { @@ -242,7 +242,7 @@ func (target *Target) GetGlobs() map[string]bool { } func (target *Target) UpdateGlobs(globFiles map[string][]string) { - ForeachType(target.Syscalls, func(typ Type, ctx TypeCtx) { + ForeachType(target.Syscalls, func(typ Type, ctx *TypeCtx) { switch a := typ.(type) { case *BufferType: if a.Kind == BufferGlob { |
