summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sendmail/src/stab.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/sendmail/src/stab.c')
-rw-r--r--usr.sbin/sendmail/src/stab.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/usr.sbin/sendmail/src/stab.c b/usr.sbin/sendmail/src/stab.c
index 07893e5..cfb02c6 100644
--- a/usr.sbin/sendmail/src/stab.c
+++ b/usr.sbin/sendmail/src/stab.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1983 Eric P. Allman
+ * Copyright (c) 1983, 1995 Eric P. Allman
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)stab.c 8.1 (Berkeley) 6/7/93";
+static char sccsid[] = "@(#)stab.c 8.6 (Berkeley) 8/31/95";
#endif /* not lint */
# include "sendmail.h"
@@ -57,7 +57,7 @@ static char sccsid[] = "@(#)stab.c 8.1 (Berkeley) 6/7/93";
** can update the symbol table.
*/
-# define STABSIZE 400
+# define STABSIZE 2003
static STAB *SymTab[STABSIZE];
@@ -78,20 +78,28 @@ stab(name, type, op)
/*
** Compute the hashing function
- **
- ** We could probably do better....
*/
hfunc = type;
for (p = name; *p != '\0'; p++)
- hfunc = (((hfunc << 7) | lower(*p)) & 077777) % STABSIZE;
+ hfunc = ((hfunc << 1) ^ (lower(*p) & 0377)) % STABSIZE;
if (tTd(36, 9))
printf("(hfunc=%d) ", hfunc);
ps = &SymTab[hfunc];
- while ((s = *ps) != NULL && (strcasecmp(name, s->s_name) || s->s_type != type))
- ps = &s->s_next;
+ if (type == ST_MACRO || type == ST_RULESET)
+ {
+ while ((s = *ps) != NULL &&
+ (s->s_type != type || strcmp(name, s->s_name)))
+ ps = &s->s_next;
+ }
+ else
+ {
+ while ((s = *ps) != NULL &&
+ (s->s_type != type || strcasecmp(name, s->s_name)))
+ ps = &s->s_next;
+ }
/*
** Dispose of the entry.
@@ -125,7 +133,6 @@ stab(name, type, op)
s = (STAB *) xalloc(sizeof *s);
bzero((char *) s, sizeof *s);
s->s_name = newstr(name);
- makelower(s->s_name);
s->s_type = type;
/* link it in */
@@ -157,7 +164,7 @@ stabapply(func, arg)
{
for (s = *shead; s != NULL; s = s->s_next)
{
- if (tTd(38, 90))
+ if (tTd(36, 90))
printf("stabapply: trying %d/%s\n",
s->s_type, s->s_name);
func(s, arg);
OpenPOWER on IntegriCloud