summaryrefslogtreecommitdiffstats
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-04-02 06:51:44 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-04-02 06:51:44 +0000
commit8a03dc6dd4f8c96b6231d1f60da2bd65f437a8b4 (patch)
tree121b76378b915aba7ec64f61d34338b21358fd46 /mdoc.c
parente487e44b52bbc7bfdb77346cc9a44d1a7c825d2c (diff)
downloadmandoc-8a03dc6dd4f8c96b6231d1f60da2bd65f437a8b4.tar.gz
mdoc_tokhash -> hash
Initial man hashtab (BROKEN).
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/mdoc.c b/mdoc.c
index 82408d8a..273c8ed5 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -180,7 +180,7 @@ mdoc_free(struct mdoc *mdoc)
mdoc_free1(mdoc);
if (mdoc->htab)
- mdoc_tokhash_free(mdoc->htab);
+ mdoc_hash_free(mdoc->htab);
free(mdoc);
}
@@ -192,16 +192,18 @@ mdoc_alloc(void *data, int pflags, const struct mdoc_cb *cb)
if (NULL == (p = calloc(1, sizeof(struct mdoc))))
return(NULL);
+ if (cb)
+ (void)memcpy(&p->cb, cb, sizeof(struct mdoc_cb));
p->data = data;
- p->htab = mdoc_tokhash_alloc();
p->pflags = pflags;
- if (cb)
- (void)memcpy(&p->cb, cb, sizeof(struct mdoc_cb));
-
- if (mdoc_alloc1(p))
+ if (NULL == (p->htab = mdoc_hash_alloc())) {
+ free(p);
+ return(NULL);
+ } else if (mdoc_alloc1(p))
return(p);
+
free(p);
return(NULL);
}
@@ -624,7 +626,7 @@ parsemacro(struct mdoc *m, int ln, char *buf)
return(1);
}
- if (MDOC_MAX == (c = mdoc_tokhash_find(m->htab, mac))) {
+ if (MDOC_MAX == (c = mdoc_hash_find(m->htab, mac))) {
if ( ! macrowarn(m, ln, mac))
goto err;
return(1);