diff options
Diffstat (limited to 'mdoc.c')
-rw-r--r-- | mdoc.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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); |