From d9ec2d0749d86ef1ac10f9145abef98bec8339ef Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 19 Nov 2001 10:39:35 +0000 Subject: [PATCH] * src/print.c (print_actions): Better locality of variables. --- ChangeLog | 5 +++++ src/print.c | 37 +++++++++++++++---------------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c43d62a..2b1f368a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-11-19 Akim Demaille + + * src/print.c (print_actions): Better locality of variables. + + 2001-11-19 Akim Demaille * src/derives.c (print_derives): Fix and enrich. diff --git a/src/print.c b/src/print.c index 2c2b8420..faa6c0a1 100644 --- a/src/print.c +++ b/src/print.c @@ -87,16 +87,10 @@ print_actions (FILE *out, int state) { int i; int k; - int state1; - int symbol; - shifts *shiftp; - errs *errp; - reductions *redp; - int rule; - shiftp = state_table[state].shift_table; - redp = state_table[state].reduction_table; - errp = err_table[state]; + shifts *shiftp = state_table[state].shift_table; + reductions *redp = state_table[state].reduction_table; + errs *errp = err_table[state]; if (!shiftp && !redp) { @@ -113,9 +107,10 @@ print_actions (FILE *out, int state) for (i = 0; i < k; i++) { - if (!shiftp->shifts[i]) + int symbol; + int state1 = shiftp->shifts[i]; + if (!state1) continue; - state1 = shiftp->shifts[i]; symbol = state_table[state1].accessing_symbol; /* The following line used to be turned off. */ if (ISVAR (symbol)) @@ -140,15 +135,12 @@ print_actions (FILE *out, int state) if (errp) { - int j, nerrs; - - nerrs = errp->nerrs; - - for (j = 0; j < nerrs; j++) + int j; + for (j = 0; j < errp->nerrs; j++) { - if (!errp->errs[j]) + int symbol = errp->errs[j]; + if (!symbol) continue; - symbol = errp->errs[j]; fprintf (out, _(" %-4s\terror (nonassociative)\n"), tags[symbol]); } @@ -159,8 +151,8 @@ print_actions (FILE *out, int state) if (state_table[state].consistent && redp) { - rule = redp->rules[0]; - symbol = rule_table[rule].lhs; + int rule = redp->rules[0]; + int symbol = rule_table[rule].lhs; fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"), rule, tags[symbol]); } @@ -173,9 +165,10 @@ print_actions (FILE *out, int state) { for (; i < k; i++) { - if (!shiftp->shifts[i]) + int symbol; + int state1 = shiftp->shifts[i]; + if (!state1) continue; - state1 = shiftp->shifts[i]; symbol = state_table[state1].accessing_symbol; fprintf (out, _(" %-4s\tgo to state %d\n"), tags[symbol], state1); -- 2.45.2