summaryrefslogtreecommitdiffstats
path: root/man.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-09-16 14:40:56 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-09-16 14:40:56 +0000
commit6345042a457de84d0b4fdb0ffe8e21052479fdbc (patch)
treea033285b86728a45a837dff5d7d34369d7055e0a /man.c
parent464bf99c7bec33718cdc95c963d3e5d3a28b3124 (diff)
downloadmandoc-6345042a457de84d0b4fdb0ffe8e21052479fdbc.tar.gz
Lookup hashes are now static tables, ordered first-level by second character, then randomly along a chain. Improves performance by a small fraction and considerably cleans up hash sources.
Diffstat (limited to 'man.c')
-rw-r--r--man.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/man.c b/man.c
index 7e69564b..486c352f 100644
--- a/man.c
+++ b/man.c
@@ -105,9 +105,6 @@ man_free(struct man *man)
{
man_free1(man);
-
- if (man->htab)
- man_hash_free(man->htab);
free(man);
}
@@ -125,14 +122,11 @@ man_alloc(void *data, int pflags, const struct man_cb *cb)
return(NULL);
}
+ man_hash_init();
+
p->data = data;
p->pflags = pflags;
(void)memcpy(&p->cb, cb, sizeof(struct man_cb));
-
- if (NULL == (p->htab = man_hash_alloc())) {
- free(p);
- return(NULL);
- }
return(p);
}
@@ -513,7 +507,7 @@ man_pmacro(struct man *m, int ln, char *buf)
return(1);
}
- if (MAN_MAX == (c = man_hash_find(m->htab, mac))) {
+ if (MAN_MAX == (c = man_hash_find(mac))) {
if ( ! (MAN_IGN_MACRO & m->pflags)) {
(void)man_perr(m, ln, ppos, WMACRO);
goto err;