Skip to content

Commit

Permalink
Ensure that a group is never added twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Feb 15, 2024
1 parent 3d72a0a commit a498f60
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ void map_implicit_writes(MCInst *MI, const insn_map *imap)
}

/// Adds a given group to @MI->flat_insn.
/// A group is never added twice.
void add_group(MCInst *MI, unsigned /* arch_group */ group)
{
#ifndef CAPSTONE_DIET
Expand All @@ -192,6 +193,11 @@ void add_group(MCInst *MI, unsigned /* arch_group */ group)
printf("ERROR: Too many groups defined.\n");
return;
}
for (int i = 0; i < detail->groups_count; ++i) {
if (detail->groups[i] == group) {
return;
}
}
detail->groups[detail->groups_count++] = group;
#endif // CAPSTONE_DIET
}
Expand Down

0 comments on commit a498f60

Please sign in to comment.