style: cex: prefer the array notation

Prefer `&foos[i]` to `foos + i` when `foos` is an array.  IMHO, it
makes the semantics clearer.

* src/counterexample.c, src/lssi.c, src/parse-simulation.c,
* src/state-item.c: With arrays, prefer the array notation rather than
the pointer one.
This commit is contained in:
Akim Demaille
2020-07-11 17:59:30 +02:00
parent 5b2b7b1ffb
commit a2ad33dca6
4 changed files with 41 additions and 43 deletions

View File

@@ -100,7 +100,7 @@ append_lssi (lssi *sn, Hash_table *visited, gl_list_t queue)
static void
lssi_print (lssi *l)
{
print_state_item (state_items + l->si, stdout);
print_state_item (&state_items[l->si], stdout);
if (l->lookahead)
{
printf ("FOLLOWL = { ");
@@ -175,7 +175,7 @@ shortest_path_from_start (state_item_number target, symbol_number next_sym)
finished = true;
break;
}
state_item *si = state_items + last;
state_item *si = &state_items[last];
// Transitions don't change follow_L
if (si->trans >= 0)
{
@@ -243,7 +243,7 @@ shortest_path_from_start (state_item_number target, symbol_number next_sym)
gl_list_t res =
gl_list_create_empty (GL_LINKED_LIST, NULL, NULL, NULL, true);
for (lssi *sn = n; sn != NULL; sn = sn->parent)
gl_list_add_first (res, state_items + sn->si);
gl_list_add_first (res, &state_items[sn->si]);
hash_free (visited);
gl_list_free (queue);
@@ -320,7 +320,7 @@ lssi_reverse_production (const state_item *si, bitset lookahead)
state_item_number sin;
BITSET_FOR_EACH (biter, si->revs, sin, 0)
{
state_item *prevsi = state_items + sin;
state_item *prevsi = &state_items[sin];
if (!production_allowed (prevsi, si))
continue;
bitset prev_lookahead = prevsi->lookahead;