Skip to content

Commit

Permalink
Define the iterator in the for scope
Browse files Browse the repository at this point in the history
Otherwise running two FOREACHes in the same scope won't work as it tries to
redefine the variable.
  • Loading branch information
haesbaert committed May 2, 2024
1 parent 4805fa0 commit d95292f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions GPL/Events/EbpfEventProto.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ enum ebpf_varlen_field_type {

// Convenience macro to iterate all the variable length fields in an event
#define FOR_EACH_VARLEN_FIELD(vl_fields_start, cursor) \
uint32_t __i = 0; \
cursor = (struct ebpf_varlen_field *)vl_fields_start.data; \
for (; __i < vl_fields_start.nfields; \
for (uint32_t __i = 0; __i < vl_fields_start.nfields; \
cursor = (struct ebpf_varlen_field *)((char *)cursor + cursor->size + \
sizeof(struct ebpf_varlen_field)), \
__i++)
Expand Down

0 comments on commit d95292f

Please sign in to comment.