X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/b2ca4022ea6c61e10ac87a0a92bb0f998ecf8b48..444c570aad15bb220e7dce3949b38081f17313e8:/src/derives.c diff --git a/src/derives.c b/src/derives.c index 3c1d3f62..41e16c0e 100644 --- a/src/derives.c +++ b/src/derives.c @@ -25,20 +25,24 @@ */ #include "system.h" -#include "alloc.h" +#include "xalloc.h" #include "types.h" #include "gram.h" #include "derives.h" +short **derives; + #if DEBUG static void print_derives (void) { - register int i; - register short *sp; + int i; + short *sp; - printf (_("\n\n\nDERIVES\n\n")); + fputs ("\n\n\n", stdout); + printf (_("DERIVES")); + fputs ("\n\n", stdout); for (i = ntokens; i < nsyms; i++) { @@ -55,20 +59,18 @@ print_derives (void) #endif -short **derives; - void set_derives (void) { - register int i; - register int lhs; - register shorts *p; - register short *q; - register shorts **dset; - register shorts *delts; + int i; + int lhs; + shorts *p; + short *q; + shorts **dset; + shorts *delts; - dset = NEW2 (nvars, shorts *) - ntokens; - delts = NEW2 (nrules + 1, shorts); + dset = XCALLOC (shorts *, nvars) - ntokens; + delts = XCALLOC (shorts, nrules + 1); p = delts; for (i = nrules; i > 0; i--) @@ -83,8 +85,8 @@ set_derives (void) } } - derives = NEW2 (nvars, short *) - ntokens; - q = NEW2 (nvars + nrules, short); + derives = XCALLOC (short *, nvars) - ntokens; + q = XCALLOC (short, nvars + nrules); for (i = ntokens; i < nsyms; i++) { @@ -102,13 +104,13 @@ set_derives (void) print_derives (); #endif - FREE (dset + ntokens); - FREE (delts); + XFREE (dset + ntokens); + XFREE (delts); } void free_derives (void) { - FREE (derives[ntokens]); - FREE (derives + ntokens); + XFREE (derives[ntokens]); + XFREE (derives + ntokens); }