/* -*-c-*-
*
- * $Id: sym.c,v 1.13 2001/01/25 21:14:49 mdw Exp $
+ * $Id: sym.c,v 1.15 2004/04/08 01:36:13 mdw Exp $
*
* Symbol table management
*
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of the mLib utilities library.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* mLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with mLib; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: sym.c,v $
- * Revision 1.13 2001/01/25 21:14:49 mdw
- * Always add a terminating null, and don't count it in the length.
- *
- * Revision 1.12 2001/01/20 11:49:37 mdw
- * Export tuning parameters from header file, for the benefit of other
- * hashtable implementations. Change the storage of symbol names: store
- * the name after the allocated symbol block in all cases. This replaces
- * the previous complicated and slightly wasteful arrangement.
- *
- * Revision 1.11 2000/06/17 10:37:39 mdw
- * Add support for arena management.
- *
- * Revision 1.10 1999/12/10 23:42:04 mdw
- * Change header file guard names.
- *
- * Revision 1.9 1999/10/22 22:36:37 mdw
- * New test structure for symbol tables.
- *
- * Revision 1.8 1999/08/02 14:45:48 mdw
- * Break low-level hashtable code out from sym.
- *
- * Revision 1.7 1999/06/01 09:49:08 mdw
- * Allow things to be looked up by just their caller-supplied hashes. This
- * actually needs to be thought through better.
- *
- * Revision 1.6 1999/05/26 21:08:31 mdw
- * Rename symbols in line with newer conventions.
- *
- * Revision 1.5 1999/05/13 22:48:37 mdw
- * Twiddle the extension threshold. Change `-ise' to `-ize' throughout.
- *
- * Revision 1.4 1999/05/06 19:51:35 mdw
- * Reformatted the LGPL notice a little bit.
- *
- * Revision 1.3 1999/05/05 18:50:31 mdw
- * Change licensing conditions to LGPL.
- *
- * Revision 1.2 1998/11/26 19:27:33 mdw
- * Move SYM_NAME into the header file. Fix bugs.
- *
- * Revision 1.1.1.1 1998/06/17 23:44:42 mdw
- * Initial version of mLib
- *
- */
-
/*----- Header files ------------------------------------------------------*/
/* --- ANSI headers --- */
#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 --- */