diff options
author | Kenneth G Raeburn <raeburn@mit.edu> | 1990-08-16 18:43:01 +0000 |
---|---|---|
committer | Kenneth G Raeburn <raeburn@mit.edu> | 1990-08-16 18:43:01 +0000 |
commit | 96f3768384ea4fcfbb38fa9645e13b1cae7830b0 (patch) | |
tree | ccd98c3df7ac387c87a95a31ec23d62b27025fa4 /server/class.c | |
parent | 88452efca5ec64de75f1653cfe823a204a63b0c6 (diff) |
[tytso] Don't #ifdef out class_restrict. (Auditor: raeburn.)
[raeburn] Fix up hash function to be faster. (Auditor: tytso.)
Diffstat (limited to 'server/class.c')
-rw-r--r-- | server/class.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/server/class.c b/server/class.c index 80c0d90..0525631 100644 --- a/server/class.c +++ b/server/class.c @@ -331,8 +331,6 @@ char *class; return(NULLZACLT); } -#ifdef notdef -/* currently not used */ /* * restrict class by associating it with the acl structure acl. * return ZERR_NONE if no error, or ZSRV_NOCLASS if there is no such @@ -361,7 +359,6 @@ ZAcl_t *acl; /* fell off the end, no match */ return(ZSRV_NOCLASS); } -#endif notdef /* * restrict class by registering it and associating it with the acl @@ -417,17 +414,16 @@ static unsigned int hash(string) char *string; { - register unsigned int hval = 0; + register int hval = 0; register unsigned char *cp = (unsigned char *) string; while (*cp) { - if (isupper(*cp)) { - hval = (hval + (tolower(*cp)) * HASHMUL) % HASHSIZE; - cp++; - } else - hval = (hval + (*cp++) * HASHMUL) % HASHSIZE; + hval *= HASHMUL; + hval += (isascii(*cp) && isupper(*cp)) ? tolower(*cp) : *cp; + hval %= HASHSIZE; + cp++; } - return(hval); + return hval; } /* set up the class.instance in the class_buf, and return its hash val */ |