summaryrefslogtreecommitdiffstats
path: root/mdoc.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 /mdoc.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 'mdoc.c')
-rw-r--r--mdoc.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/mdoc.c b/mdoc.c
index 354a2e8f..48dedb0b 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -230,8 +230,6 @@ mdoc_free(struct mdoc *mdoc)
{
mdoc_free1(mdoc);
- if (mdoc->htab)
- mdoc_hash_free(mdoc->htab);
free(mdoc);
}
@@ -249,13 +247,12 @@ mdoc_alloc(void *data, int pflags, const struct mdoc_cb *cb)
if (cb)
(void)memcpy(&p->cb, cb, sizeof(struct mdoc_cb));
+ mdoc_hash_init();
+
p->data = data;
p->pflags = pflags;
- if (NULL == (p->htab = mdoc_hash_alloc())) {
- free(p);
- return(NULL);
- } else if (mdoc_alloc1(p))
+ if (mdoc_alloc1(p))
return(p);
free(p);
@@ -725,7 +722,7 @@ parsemacro(struct mdoc *m, int ln, char *buf)
return(1);
}
- if (MDOC_MAX == (c = mdoc_hash_find(m->htab, mac))) {
+ if (MDOC_MAX == (c = mdoc_hash_find(mac))) {
if ( ! macrowarn(m, ln, mac))
goto err;
return(1);