tables: scope reduction

* src/tables.c (save_row): here.
This commit is contained in:
Akim Demaille
2012-12-26 18:14:47 +01:00
parent 28be3b8e53
commit c95f5dadd6

View File

@@ -382,26 +382,20 @@ static void
save_row (state_number s) save_row (state_number s)
{ {
symbol_number i; symbol_number i;
size_t count;
base_number *sp;
base_number *sp1;
base_number *sp2;
unsigned int *sp3;
/* Number of non default actions in S. */ /* Number of non default actions in S. */
count = 0; size_t count = 0;
for (i = 0; i < ntokens; i++) for (i = 0; i < ntokens; i++)
if (actrow[i] != 0) if (actrow[i] != 0)
count++; count++;
if (count == 0) if (count)
return; {
/* Allocate non defaulted actions. */ /* Allocate non defaulted actions. */
froms[s] = sp = sp1 = xnmalloc (count, sizeof *sp1); base_number *sp1 = froms[s] = xnmalloc (count, sizeof *sp1);
tos[s] = sp2 = xnmalloc (count, sizeof *sp2); base_number *sp2 = tos[s] = xnmalloc (count, sizeof *sp2);
conflict_tos[s] = sp3 = unsigned int *sp3 = conflict_tos[s] =
nondeterministic_parser ? xnmalloc (count, sizeof *sp3) : NULL; nondeterministic_parser ? xnmalloc (count, sizeof *sp3) : NULL;;
/* Store non defaulted actions. */ /* Store non defaulted actions. */
for (i = 0; i < ntokens; i++) for (i = 0; i < ntokens; i++)
@@ -414,7 +408,8 @@ save_row (state_number s)
} }
tally[s] = count; tally[s] = count;
width[s] = sp1[-1] - sp[0] + 1; width[s] = sp1[-1] - froms[s][0] + 1;
}
} }