#include "copy.h"
#include "cp-hash.h"
#include "hash.h"
+#include "hash-pjw.h"
#include "same.h"
#include "dirname.h"
#include "full-write.h"
}
}
-/* A hash function for null-terminated char* strings using
- the method described in Aho, Sethi, & Ullman, p 436. */
-/* FIXME: this is copied from remove.c */
-
-static unsigned int
-hash_pjw (const void *x, unsigned int tablesize)
-{
- const char *s = x;
- unsigned int h = 0;
- unsigned int g;
-
- while (*s != 0)
- {
- h = (h << 4) + *s++;
- if ((g = h & (unsigned int) 0xf0000000) != 0)
- h = (h ^ (g >> 24)) ^ g;
- }
-
- return (h % tablesize);
-}
-
/* Hash a dest_info entry. */
static unsigned int
dest_info_hash (void const *x, unsigned int table_size)
#include "error.h"
#include "obstack.h"
#include "hash.h"
+#include "hash-pjw.h"
#include "quote.h"
#include "remove.h"
return SAME_INODE (*a, *b) ? true : false;
}
-/* A hash function for null-terminated char* strings using
- the method described in Aho, Sethi, & Ullman, p 436. */
-
-static unsigned int
-hash_pjw (const void *x, unsigned int tablesize)
-{
- const char *s = x;
- unsigned int h = 0;
- unsigned int g;
-
- while (*s != 0)
- {
- h = (h << 4) + *s++;
- if ((g = h & (unsigned int) 0xf0000000) != 0)
- h = (h ^ (g >> 24)) ^ g;
- }
-
- return (h % tablesize);
-}
-
static bool
hash_compare_strings (void const *x, void const *y)
{