aboutsummaryrefslogtreecommitdiffstats
path: root/prog/resources.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-01-04 10:35:26 +0100
committerDmitry Vyukov <dvyukov@google.com>2022-01-11 16:30:08 +0100
commit983508d80442a85b78118e6c6a03d5ae4897e4df (patch)
tree4d45c36a95a2ae407fa780a68925e0014c75e7e6 /prog/resources.go
parentbad18a53de8fa8d3d097e3d701efb72a014661cb (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/resources.go')
-rw-r--r--prog/resources.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/prog/resources.go b/prog/resources.go
index 3a38236aa..5af129d00 100644
--- a/prog/resources.go
+++ b/prog/resources.go
@@ -45,7 +45,7 @@ func (target *Target) calcResourceCtors(res *ResourceDesc, precise bool) []*Sysc
func (target *Target) populateResourceCtors() {
// Find resources that are created by each call.
callsResources := make([][]*ResourceDesc, len(target.Syscalls))
- ForeachType(target.Syscalls, func(typ Type, ctx TypeCtx) {
+ ForeachType(target.Syscalls, func(typ Type, ctx *TypeCtx) {
switch typ1 := typ.(type) {
case *ResourceType:
if ctx.Dir != DirIn {
@@ -124,7 +124,7 @@ func isCompatibleResourceImpl(dst, src []string, precise bool) bool {
func (target *Target) getInputResources(c *Syscall) []*ResourceDesc {
var resources []*ResourceDesc
- ForeachCallType(c, func(typ Type, ctx TypeCtx) {
+ ForeachCallType(c, func(typ Type, ctx *TypeCtx) {
if ctx.Dir == DirOut {
return
}
@@ -144,7 +144,7 @@ func (target *Target) getInputResources(c *Syscall) []*ResourceDesc {
func (target *Target) getOutputResources(c *Syscall) []*ResourceDesc {
var resources []*ResourceDesc
- ForeachCallType(c, func(typ Type, ctx TypeCtx) {
+ ForeachCallType(c, func(typ Type, ctx *TypeCtx) {
switch typ1 := typ.(type) {
case *ResourceType:
if ctx.Dir != DirIn {