--- ray/src/cv/mgflib/lookup.h 1994/06/25 16:34:50 1.4 +++ ray/src/cv/mgflib/lookup.h 1998/09/04 09:05:09 1.9 @@ -12,8 +12,9 @@ typedef struct { char *data; /* pointer to client data */ } LUENT; +#ifdef NOPROTO typedef struct { - long (*hashf)(); /* key hash function */ + unsigned long (*hashf)(); /* key hash function */ int (*keycmp)(); /* key comparison function */ void (*freek)(); /* free a key */ void (*freed)(); /* free the data */ @@ -21,6 +22,17 @@ typedef struct { LUENT *tabl; /* table, if allocated */ int ndel; /* number of deleted entries */ } LUTAB; +#else +typedef struct { + unsigned long (*hashf)(char *); /* key hash function */ + int (*keycmp)(const char *, const char *); /* key comparison function */ + void (*freek)(char *); /* free a key */ + void (*freed)(char *); /* free the data */ + int tsiz; /* current table size */ + LUENT *tabl; /* table, if allocated */ + int ndel; /* number of deleted entries */ +} LUTAB; +#endif #define LU_SINIT(fk,fd) {lu_shash,strcmp,(void (*)())(fk),\ (void (*)())(fd),0,NULL,0} @@ -56,6 +68,8 @@ typedef struct { * The lu_delete routine frees an entry's data (if any) by calling * the freed member function, but does not free the key field. This * will be freed later during (or instead of) table reallocation. + * It is therefore an error to reuse or do anything with the key + * field after calling lu_delete. * * The lu_done routine calls the given free function once for each * assigned table entry (i.e. each entry with an assigned key value). @@ -69,13 +83,11 @@ extern int lu_init(); extern LUENT *lu_find(); extern void lu_delete(); extern void lu_done(); -extern long lu_shash(); +extern unsigned long lu_shash(); #else extern int lu_init(LUTAB *, int); extern LUENT *lu_find(LUTAB *, char *); extern void lu_delete(LUTAB *, char *); extern void lu_done(LUTAB *); -extern long lu_shash(char *); +extern unsigned long lu_shash(char *); #endif - -extern int strcmp();