From: Akim Demaille Date: Wed, 5 Dec 2001 09:27:35 +0000 (+0000) Subject: * src/nullable.c (set_nullable): Use a for loop to de-obfuscate X-Git-Tag: before-m4-back-end~213 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/e3e4e81446edb4e92e21cde1fc873f517b9402ea * src/nullable.c (set_nullable): Use a for loop to de-obfuscate the handling of squeue. `symbol >= 0' is wrong now, use `rule_table[ruleno].useful'. --- diff --git a/ChangeLog b/ChangeLog index d08aba9f..f59d0292 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-12-05 Akim Demaille + + * src/nullable.c (set_nullable): Use a for loop to de-obfuscate + the handling of squeue. + `symbol >= 0' is wrong now, use `rule_table[ruleno].useful'. + + 2001-12-05 Akim Demaille Because useless nonterminals are now kept alive (instead of being diff --git a/src/nullable.c b/src/nullable.c index 2797180c..8e8809e2 100644 --- a/src/nullable.c +++ b/src/nullable.c @@ -107,23 +107,16 @@ set_nullable (void) } while (s1 < s2) - { - p = rsets[*s1++]; - while (p) - { - int ruleno = p->value; - p = p->next; - if (--rcount[ruleno] == 0) + for (p = rsets[*s1++]; p; p = p->next) + { + int ruleno = p->value; + if (--rcount[ruleno] == 0) + if (rule_table[ruleno].useful && !nullable[rule_table[ruleno].lhs]) { - int symbol = rule_table[ruleno].lhs; - if (symbol >= 0 && !nullable[symbol]) - { - nullable[symbol] = 1; - *s2++ = symbol; - } + nullable[rule_table[ruleno].lhs] = 1; + *s2++ = rule_table[ruleno].lhs; } - } - } + } XFREE (squeue); XFREE (rcount);