aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/lhash
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/lhash')
-rw-r--r--crypto/lhash/lhash.c21
-rw-r--r--crypto/lhash/lhash.h9
2 files changed, 20 insertions, 10 deletions
diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c
index 7eb92a18bca..6a340a24038 100644
--- a/crypto/lhash/lhash.c
+++ b/crypto/lhash/lhash.c
@@ -159,7 +159,7 @@ void lh_free(LHASH *lh)
unsigned int i;
LHASH_NODE *n,*nn;
- if (lh == NULL)
+ if(lh == NULL)
return;
for (i=0; i<lh->num_nodes; i++)
@@ -422,6 +422,21 @@ static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash)
return(ret);
}
+/*
+unsigned long lh_strhash(char *str)
+ {
+ int i,l;
+ unsigned long ret=0;
+ unsigned short *s;
+
+ if (str == NULL) return(0);
+ l=(strlen(str)+1)/2;
+ s=(unsigned short *)str;
+ for (i=0; i<l; i++)
+ ret^=(s[i]<<(i&0x0f));
+ return(ret);
+ } */
+
/* The following hash seems to work very well on normal text strings
* no collisions on /usr/dict/words and it distributes on %2^n quite
* well, not as good as MD5, but still good.
@@ -455,7 +470,3 @@ unsigned long lh_strhash(const char *c)
return((ret>>16)^ret);
}
-unsigned long lh_num_items(LHASH *lh)
- {
- return lh ? lh->num_items : 0;
- }
diff --git a/crypto/lhash/lhash.h b/crypto/lhash/lhash.h
index 868d5352605..6f6eeb2698a 100644
--- a/crypto/lhash/lhash.h
+++ b/crypto/lhash/lhash.h
@@ -63,14 +63,14 @@
#ifndef HEADER_LHASH_H
#define HEADER_LHASH_H
-#ifndef NO_FP_API
-#include <stdio.h>
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
+#ifndef NO_FP_API
+#include <stdio.h>
+#endif
+
typedef struct lhash_node_st
{
void *data;
@@ -124,7 +124,6 @@ void *lh_retrieve(LHASH *lh, void *data);
void lh_doall(LHASH *lh, void (*func)(/*void *b*/));
void lh_doall_arg(LHASH *lh, void (*func)(/*void *a,void *b*/),void *arg);
unsigned long lh_strhash(const char *c);
-unsigned long lh_num_items(LHASH *lh);
#ifndef NO_FP_API
void lh_stats(LHASH *lh, FILE *out);