/* -*-c-*-
*
- * $Id: sym.c,v 1.13 2001/01/25 21:14:49 mdw Exp $
+ * $Id: sym.c,v 1.14 2003/12/15 20:53:47 mdw Exp $
*
* Symbol table management
*
/*----- Revision history --------------------------------------------------*
*
* $Log: sym.c,v $
+ * Revision 1.14 2003/12/15 20:53:47 mdw
+ * Add global unihash table; use universal hashing instead of CRC.
+ *
* Revision 1.13 2001/01/25 21:14:49 mdw
* Always add a terminating null, and don't count it in the length.
*
#include "alloc.h"
#include "arena.h"
#include "bits.h"
-#include "crc32.h"
#include "exc.h"
#include "hash.h"
#include "sub.h"
#include "sym.h"
+#include "unihash.h"
/*----- Main code ---------------------------------------------------------*/
/* --- @sym_find@ --- *
*
* Arguments: @sym_table *t@ = pointer to symbol table in question
- * @const char *n@ = pointer to symbol table to look up
+ * @const char *n@ = pointer to symbol name to look up
* @long l@ = length of the name string or negative to measure
* @size_t sz@ = size of desired symbol object, or zero
* @unsigned *f@ = pointer to a flag, or null.
/* --- Find the correct bin --- */
len = l < 0 ? strlen(n) : l;
- CRC32(hash, 0, n, len);
+ hash = UNIHASH(&unihash_global, n, len);
bin = HASH_BIN(&t->t, hash);
/* --- Search the bin list --- */