summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-28 17:35:43 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-28 17:35:43 +0000
commite65351f6a3dd637d14b3fcf8be0e8367a1aacc0d (patch)
tree492cb187aebcd5f308bdfabec30d31afbaa8de63 /usr.bin/mandoc/html.c
parent24322f395665631cc678573c61a088bf15bc333c (diff)
Make the character table available to libroff so it can check the
validity of character escape names and warn about unknown ones. This requires mchars_spec2cp() to report unknown names again. Fortunately, that doesn't require changing the calling code because according to groff, invalid character escapes should not produce output anyway, and now that we warn about them, that's fine.
Diffstat (limited to 'usr.bin/mandoc/html.c')
-rw-r--r--usr.bin/mandoc/html.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index a0c2f20eaae..14fe83c629b 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: html.c,v 1.49 2014/10/27 16:28:30 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.50 2014/10/28 17:35:42 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -125,11 +125,10 @@ static int print_escape(char);
static int print_encode(struct html *, const char *, int);
static void print_metaf(struct html *, enum mandoc_esc);
static void print_attr(struct html *, const char *, const char *);
-static void *ml_alloc(char *);
-static void *
-ml_alloc(char *outopts)
+void *
+html_alloc(const struct mchars *mchars, char *outopts)
{
struct html *h;
const char *toks[5];
@@ -144,7 +143,7 @@ ml_alloc(char *outopts)
h = mandoc_calloc(1, sizeof(struct html));
h->tags.head = NULL;
- h->symtab = mchars_alloc();
+ h->symtab = mchars;
while (outopts && *outopts)
switch (getsubopt(&outopts, UNCONST(toks), &v)) {
@@ -167,20 +166,6 @@ ml_alloc(char *outopts)
return(h);
}
-void *
-html_alloc(char *outopts)
-{
-
- return(ml_alloc(outopts));
-}
-
-void *
-xhtml_alloc(char *outopts)
-{
-
- return(ml_alloc(outopts));
-}
-
void
html_free(void *p)
{
@@ -194,9 +179,6 @@ html_free(void *p)
free(tag);
}
- if (h->symtab)
- mchars_free(h->symtab);
-
free(h);
}