X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=support%2Fcpp%2Fcpphash.c;h=ae3f09e115842b3d421ef813120ee310c70cc463;hb=541d83d9229c4cae95e807891dc56cceba4a5bd5;hp=e9645aa68f5ea2e33aaf18495fdda874aee8a7de;hpb=b09af35f2f1cde7649d3ac4a6f5d2af6d97895a0;p=fw%2Fsdcc diff --git a/support/cpp/cpphash.c b/support/cpp/cpphash.c index e9645aa6..ae3f09e1 100644 --- a/support/cpp/cpphash.c +++ b/support/cpp/cpphash.c @@ -24,7 +24,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "cpplib.h" #include "cpphash.h" -extern char *xmalloc PARAMS ((unsigned)); +//extern char *xmalloc PARAMS ((unsigned)); + +#include "newalloc.h" + +#include +#include /* Define a generic NULL if one hasn't already been defined. */ @@ -37,6 +42,8 @@ extern char *xmalloc PARAMS ((unsigned)); #define volatile #endif +static HASHNODE *hashtab[HASHSIZE]; + /* * return hash function on name. must be compatible with the one * computed a step at a time, elsewhere @@ -130,14 +137,14 @@ delete_macro ( for (ap = d->pattern; ap != NULL; ap = nextap) { nextap = ap->next; - free (ap); + Safe_free (ap); } if (d->nargs >= 0) - free (d->args.argnames); - free (d); + Safe_free (d->args.argnames); + Safe_free (d); } - free (hp); + Safe_free (hp); } /* * install a name in the main hash table, even if it is already there. @@ -177,7 +184,7 @@ install ( hash = hashf (name, len, HASHSIZE); i = sizeof (HASHNODE) + len + 1; - hp = (HASHNODE *) xmalloc (i); + hp = (HASHNODE *) Safe_malloc (i); bucket = hash; hp->bucket_hdr = &hashtab[bucket]; hp->next = hashtab[bucket];