summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-10 11:22:28 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-05-10 11:22:28 (GMT)
commit3e5d6e9683d5d3efa3a82556d0f73892d674ed71 (patch) (side-by-side diff)
tree0baa7d3cecce3b984e85eef238887d501b780744 /src
parent8bd6f1e59b1663089bf8c81d8d2b14e20010c6e4 (diff)
downloadgrecs-3e5d6e9683d5d3efa3a82556d0f73892d674ed71.tar.gz
grecs-3e5d6e9683d5d3efa3a82556d0f73892d674ed71.tar.bz2
Bugfixes.
* Makefile.am (gitid.h): Fix sed expression. * src/grecs.h (grecs_hash_string): New proto. * src/symtab.c (grecs_hash_string): New function.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/grecs.h3
-rw-r--r--src/symtab.c13
2 files changed, 12 insertions, 4 deletions
diff --git a/src/grecs.h b/src/grecs.h
index decde1d..40ade87 100644
--- a/src/grecs.h
+++ b/src/grecs.h
@@ -318,6 +318,9 @@ int grecs_symtab_enumerate(struct grecs_symtab *st,
grecs_symtab_enumerator_t fun, void *data);
size_t grecs_symtab_count_entries(struct grecs_symtab *st);
+
+unsigned grecs_hash_string(const char *name, unsigned long hashsize);
+
void grecs_value_free(struct grecs_value *val);
void grecs_node_free(struct grecs_node *node);
diff --git a/src/symtab.c b/src/symtab.c
index ac1581b..297787c 100644
--- a/src/symtab.c
+++ b/src/symtab.c
@@ -73,11 +73,9 @@ syment_alloc(struct grecs_symtab *st, void *key)
}
-static unsigned
-def_hash(void *data, unsigned long hashsize)
+unsigned
+grecs_hash_string(const char *name, unsigned long hashsize)
{
- struct grecs_syment *sym = data;
- const char *name = sym->name;
unsigned i;
for (i = 0; *name; name++) {
@@ -87,6 +85,13 @@ def_hash(void *data, unsigned long hashsize)
return i % hashsize;
}
+static unsigned
+def_hash(void *data, unsigned long hashsize)
+{
+ struct grecs_syment *sym = data;
+ return grecs_hash_string(sym->name, hashsize);
+}
+
static int
def_cmp(const void *a, const void *b)
{

Return to:

Send suggestions and report system problems to the System administrator.