This changes a couple of spots in ax-general.c to use ARRAY_SIZE.
While making this change, I noticed that one of the bounds checks was
incorrect.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
{
enum agent_op op = (enum agent_op) x->buf[i];
- if (op >= (sizeof (aop_map) / sizeof (aop_map[0]))
- || !aop_map[op].name)
+ if (op >= ARRAY_SIZE (aop_map) || aop_map[op].name == nullptr)
{
gdb_printf (f, _("%3d <bad opcode %02x>\n"), i, op);
i++;
for (i = 0; i < ax->buf.size (); i += 1 + op->op_size)
{
- if (ax->buf[i] > (sizeof (aop_map) / sizeof (aop_map[0])))
+ if (ax->buf[i] >= ARRAY_SIZE (aop_map))
{
ax->flaw = agent_flaw_bad_instruction;
return;