chiark / gitweb /
buf: Fix two embarassing bugs found while writing Lisp bindings.
[mLib] / hash.c
diff --git a/hash.c b/hash.c
index 3945755004ca82fa7dc3907ce1fb9fd0961d874e..92ca39b063689042db830c285baa3a47413fd1cd 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: hash.c,v 1.2 2000/06/17 10:37:39 mdw Exp $
+ * $Id: hash.c,v 1.4 2004/04/08 01:36:11 mdw Exp $
  *
  * General hashtable infrastructure
  *
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: hash.c,v $
- * Revision 1.2  2000/06/17 10:37:39  mdw
- * Add support for arena management.
- *
- * Revision 1.1  1999/08/02 14:45:48  mdw
- * Break low-level hashtable code out from sym.
- *
- */
-
 /*----- Header files ------------------------------------------------------*/
 
 #include <stdio.h>
@@ -85,10 +74,7 @@ void hash_create(hash_table *t, size_t n)
  *             responsibility of the implementation.
  */
 
-void hash_destroy(hash_table *t)
-{
-  x_free(t->a, t->v);
-}
+void hash_destroy(hash_table *t) { x_free(t->a, t->v); }
 
 /* --- @hash_bin@ --- *
  *
@@ -102,9 +88,7 @@ void hash_destroy(hash_table *t)
  */
 
 hash_base **hash_bin(hash_table *t, uint32 hash)
-{
-  return (HASH_BIN(t, hash));
-}
+  { return (HASH_BIN(t, hash)); }
 
 /* --- @hash_extend@ --- *
  *
@@ -124,7 +108,9 @@ int hash_extend(hash_table *t)
 
   /* --- Allocate a new hash bin vector --- */
 
-  if ((v = A_REALLOC(t->a, t->v, m * 2 * sizeof(hash_base *))) == 0) {
+  if ((v = A_REALLOC(t->a, t->v,
+                    2 * m * sizeof(hash_base *),
+                    m * sizeof(hash_base *))) == 0) {
     return (0);
   }
   t->v = v;