From d8771e87f9afc4bf8ec60ad6899211ee58a7ecd7 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 14 Mar 1991 13:43:45 +0000 Subject: [PATCH] minor mods --- modules/src/idf/idf_pkg.body | 30 ++++++++++++++++-------------- modules/src/idf/idf_pkg.spec | 4 ++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/modules/src/idf/idf_pkg.body b/modules/src/idf/idf_pkg.body index 66a1af7cd..316d88b15 100644 --- a/modules/src/idf/idf_pkg.body +++ b/modules/src/idf/idf_pkg.body @@ -24,6 +24,8 @@ IDF_new(tg, size, cpy) { static int nidf; static struct idf *pidf; + static struct idf null_idf; + register struct idf *id; #define NIDS 50 #define IBUFSIZ 2048 static unsigned int icnt; @@ -34,9 +36,12 @@ IDF_new(tg, size, cpy) if (! nidf--) { nidf += NIDS; pidf = (struct idf *) Malloc(NIDS * sizeof (struct idf)); - clear((char *) pidf, NIDS * sizeof(struct idf)); } + id = *pidf; + pidf++; + *id = null_idf; + if (cpy) { if (size > icnt) { icnt = size > IBUFSIZ ? size : IBUFSIZ; @@ -44,14 +49,14 @@ IDF_new(tg, size, cpy) } else p = ip; icnt -= size; - pidf->id_text = p; + id->id_text = p; while (size--) { *p++ = *tg++; } ip = p; } - else pidf->id_text = tg; - return pidf++; + else id->id_text = tg; + return id; } #ifdef IDF_DEBUG @@ -85,14 +90,15 @@ str2idf(tg, cpy) struct idf **hook; register struct idf *notch; register unsigned int hash; + register int c; int size; IDF_STARTHASH(hash); - while (*cp) { - IDF_ENHASH(hash, *cp++); + while (c = *cp++) { + IDF_ENHASH(hash, c); } IDF_STOPHASH(hash); - size = cp - tg + 1; + size = cp - tg; /* The tag tg with length size and known hash value hash is looked up in the identifier table; if not found, it is @@ -103,18 +109,17 @@ str2idf(tg, cpy) while ((notch = *hook)) { register char *s1 = tg; - int cmp; cp = notch->id_text; - while (!(cmp = (*s1 - *cp++))) { + while (!(c = (*s1 - *cp++))) { if (*s1++ == '\0') { break; } } - if (cmp == 0) return notch; - if (cmp < 0) break; + if (c == 0) return notch; + if (c < 0) break; hook = ¬ch->id_next; } /* a new struct idf must be inserted at the hook */ @@ -124,6 +129,3 @@ str2idf(tg, cpy) *hook = notch; /* hooked in */ return notch; } - -init_idf() { -} diff --git a/modules/src/idf/idf_pkg.spec b/modules/src/idf/idf_pkg.spec index 193006626..5a4a5da9a 100644 --- a/modules/src/idf/idf_pkg.spec +++ b/modules/src/idf/idf_pkg.spec @@ -23,9 +23,9 @@ struct idf { /* init_idf() - Initializes the namelist + Initializes the namelist. Empty for now. */ -extern init_idf(); +#define init_idf() /* struct idf * str2idf(tg, cp) char *tg; -- 2.34.1