diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-09-16 14:40:56 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-09-16 14:40:56 +0000 |
commit | 6345042a457de84d0b4fdb0ffe8e21052479fdbc (patch) | |
tree | a033285b86728a45a837dff5d7d34369d7055e0a /mdoc.c | |
parent | 464bf99c7bec33718cdc95c963d3e5d3a28b3124 (diff) | |
download | mandoc-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.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -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); |