X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/cc84fd5dc79495429d3406f9088d01f477b52a7b..573c1d9ff8aca759e7d01405c809b0318e2edfb2:/src/derives.c diff --git a/src/derives.c b/src/derives.c index 5f8637ca..49b4edff 100644 --- a/src/derives.c +++ b/src/derives.c @@ -1,5 +1,5 @@ /* Match rules with nonterminals for bison, - Copyright (C) 1984, 1989, 2000 Free Software Foundation, Inc. + Copyright 1984, 1989, 2000 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -25,21 +25,24 @@ */ #include "system.h" -#include "alloc.h" +#include "xalloc.h" #include "types.h" #include "gram.h" #include "derives.h" +short **derives; + #if DEBUG -extern char **tags; 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++) { @@ -56,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--) @@ -84,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++) { @@ -103,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); }