|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T h
Length: 1441 (0x5a1) Types: TextFile Names: »hashuid.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─⟦this⟧ »EUUGD11/euug-87hel/sec8/sps/hashuid.c«
# include "sps.h" /* The hashing functions themselves ... */ # define HASHFN1( a ) (((unsigned)(a)*91 + 17) % MAXUSERID) # define HASHFN2( a ) (((unsigned)(a) + 47) % MAXUSERID) /* ** HASHUID - Returns a pointer to a slot in the hash table that corresponds ** to the hash table entry for `uid'. It returns a null pointer if there is ** no such slot. */ struct hashtab *hashuid ( uid ) int uid ; { register struct hashtab *hp ; register int i ; register int j ; extern struct info Info ; j = HASHFN1( uid ) ; for ( i = 0 ; i < MAXUSERID ; i++ ) { hp = &Info.i_hnames[ j ] ; if ( !hp->h_uname[0] ) return ( (struct hashtab*)0 ) ; if ( hp->h_uid == uid ) return ( hp ) ; j = HASHFN2( j ) ; } return ( (struct hashtab*)0 ) ; } /* ** HASHNEXT - Returns a pointer to the next slot in the hash table that ** may be use for storing information for `uid'. It returns a null pointer ** if there are no more free slots available. */ struct hashtab *hashnext ( uid ) int uid ; { register struct hashtab *hp ; register int i ; register int j ; extern struct info Info ; j = HASHFN1( uid ) ; for ( i = 0 ; i < MAXUSERID ; i++ ) { hp = &Info.i_hnames[ j ] ; if ( !hp->h_uname[0] ) return ( hp ) ; j = HASHFN2( j ) ; } return ( (struct hashtab*)0 ) ; }