* Moved function scm_string_hash to hash.c.
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Tue, 12 Dec 2000 13:57:26 +0000 (13:57 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Tue, 12 Dec 2000 13:57:26 +0000 (13:57 +0000)
libguile/ChangeLog
libguile/hash.c
libguile/hash.h
libguile/symbols.c
libguile/symbols.h

index 8b13ca6..9485de2 100644 (file)
@@ -1,3 +1,8 @@
+2000-12-12  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * hash.[ch] (scm_string_hash), symbols.[ch] (scm_string_hash):
+       Moved function scm_string_hash to hash.c.
+
 2000-12-11  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * gc_os_dep.c (scm_get_stack_base) [MSWIN32]: Added detection of
index 529ad9f..ff9e45f 100644 (file)
@@ -61,6 +61,28 @@ extern double floor();
 #endif
 
 
+unsigned long 
+scm_string_hash (const unsigned char *str, scm_sizet len)
+{
+  if (len > 5)
+    {
+      scm_sizet i = 5;
+      unsigned long h = 264;
+      while (i--)
+       h = (h << 8) + ((unsigned) (scm_downcase (str[h % len])));
+      return h;
+    }
+  else
+    {
+      scm_sizet i = len;
+      unsigned long h = 0;
+      while (i)
+       h = (h << 8) + ((unsigned) (scm_downcase (str[--i])));
+      return h;
+    }
+}
+
+
 /* Dirk:FIXME:: why downcase for characters? (2x: scm_hasher, scm_ihashv) */
 /* Dirk:FIXME:: scm_hasher could be made static. */
 
index 6017a5e..0b2ba10 100644 (file)
@@ -48,6 +48,7 @@
 
 \f
 
+extern unsigned long scm_string_hash (const unsigned char *str, scm_sizet len);
 extern unsigned long scm_hasher (SCM obj, unsigned long n, scm_sizet d);
 extern unsigned int scm_ihashq (SCM obj, unsigned int n);
 extern SCM scm_hashq (SCM obj, SCM n);
index a50c573..dc5be47 100644 (file)
@@ -48,6 +48,7 @@
 #include "libguile/_scm.h"
 #include "libguile/chars.h"
 #include "libguile/eval.h"
+#include "libguile/hash.h"
 #include "libguile/smob.h"
 #include "libguile/variable.h"
 #include "libguile/alist.h"
@@ -81,28 +82,6 @@ duplicate_string (const char * src, unsigned long length)
  */
 
 
-unsigned long 
-scm_string_hash (const unsigned char *str, scm_sizet len)
-{
-  if (len > 5)
-    {
-      scm_sizet i = 5;
-      unsigned long h = 264;
-      while (i--)
-       h = (h << 8) + ((unsigned) (scm_downcase (str[h % len])));
-      return h;
-    }
-  else
-    {
-      scm_sizet i = len;
-      unsigned long h = 0;
-      while (i)
-       h = (h << 8) + ((unsigned) (scm_downcase (str[--i])));
-      return h;
-    }
-}
-
-
 /* scm_sym2vcell
  * looks up the symbol in the symhash table. 
  */
index 848d985..423a7a1 100644 (file)
@@ -71,8 +71,6 @@
 
 \f
 
-extern unsigned long scm_string_hash (const unsigned char *str, scm_sizet len);
-
 extern SCM scm_mem2symbol (const char*, scm_sizet);
 extern SCM scm_str2symbol (const char*);