From: Paul Eggert Date: Fri, 13 Dec 2002 04:45:04 +0000 (+0000) Subject: All uses of XCALLOC, XMALLOC, and XREALLOC changed to use new macros X-Git-Tag: BISON-1_875~103 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/bb7c2bc6236c317205e0dc3323633f1d3cee2c49?ds=inline All uses of XCALLOC, XMALLOC, and XREALLOC changed to use new macros CALLOC, MALLOC, REALLOC. All uses of XFREE changed to free. Don't subtract from the value that malloc returns; it's not portable. --- diff --git a/src/closure.c b/src/closure.c index 618846dc..0b06e99c 100644 --- a/src/closure.c +++ b/src/closure.c @@ -128,9 +128,9 @@ set_firsts (void) firsts = bitsetv_create (nvars, nvars, BITSET_FIXED); for (i = ntokens; i < nsyms; i++) - for (j = 0; derives[i][j]; ++j) + for (j = 0; derives[i - ntokens][j]; ++j) { - item_number sym = derives[i][j]->rhs[0]; + item_number sym = derives[i - ntokens][j]->rhs[0]; if (ISVAR (sym)) bitset_set (FIRSTS (i), sym - ntokens); } @@ -168,8 +168,8 @@ set_fderives (void) for (i = ntokens; i < nsyms; ++i) for (j = ntokens; j < nsyms; ++j) if (bitset_test (FIRSTS (i), j - ntokens)) - for (k = 0; derives[j][k]; ++k) - bitset_set (FDERIVES (i), derives[j][k]->number); + for (k = 0; derives[j - ntokens][k]; ++k) + bitset_set (FDERIVES (i), derives[j - ntokens][k]->number); if (trace_flag & trace_sets) print_fderives (); @@ -182,7 +182,7 @@ set_fderives (void) void new_closure (int n) { - itemset = XCALLOC (item_number, n); + CALLOC (itemset, n); ruleset = bitset_create (nrules, BITSET_FIXED); @@ -241,7 +241,7 @@ closure (item_number *core, int n) void free_closure (void) { - XFREE (itemset); + free (itemset); bitset_free (ruleset); bitsetv_free (fderives); }