-/* $Id: mdoc.c,v 1.73 2009/03/31 13:50:19 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.74 2009/04/02 06:51:44 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
mdoc_free1(mdoc);
if (mdoc->htab)
- mdoc_tokhash_free(mdoc->htab);
+ mdoc_hash_free(mdoc->htab);
free(mdoc);
}
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);
}
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);