summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/cgi.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-10-13 22:57:50 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-10-13 22:57:50 +0000
commitc50fea35705e12062d913205519e3a1b4b80703a (patch)
tree20fdd6861b6fd407e9da1d595e6e81655c8b2fcb /usr.bin/mandoc/cgi.c
parent94310d765551a9e6c4aaae651d793404f2f33c1b (diff)
Major character table cleanup:
* Use ohash(3) rather than a hand-rolled hash table. * Make the character table static in the chars.c module: There is no need to pass a pointer around, we most certainly never want to use two different character tables concurrently. * No need to keep the characters in a separate file chars.in; that merely encourages downstream porters to mess with them. * Sort the characters to agree with the mandoc_chars(7) manual page. * Specify Unicode codepoints in hex, not decimal (that's the detail that originally triggered this patch). No functional change, minus 100 LOC, and i don't see a performance change.
Diffstat (limited to 'usr.bin/mandoc/cgi.c')
-rw-r--r--usr.bin/mandoc/cgi.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c
index ffa6b6bf801..b2fc30caf16 100644
--- a/usr.bin/mandoc/cgi.c
+++ b/usr.bin/mandoc/cgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgi.c,v 1.48 2015/10/06 18:30:43 schwarze Exp $ */
+/* $OpenBSD: cgi.c,v 1.49 2015/10/13 22:57:49 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@usta.de>
@@ -817,7 +817,6 @@ format(const struct req *req, const char *file)
{
struct manoutput conf;
struct mparse *mp;
- struct mchars *mchars;
struct roff_man *man;
void *vp;
int fd;
@@ -828,9 +827,8 @@ format(const struct req *req, const char *file)
return;
}
- mchars = mchars_alloc();
- mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_BADARG, NULL,
- mchars, req->q.manpath);
+ mchars_alloc();
+ mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_BADARG, NULL, req->q.manpath);
mparse_readfd(mp, fd, file);
close(fd);
@@ -850,11 +848,11 @@ format(const struct req *req, const char *file)
req->q.manpath, file);
pg_error_internal();
mparse_free(mp);
- mchars_free(mchars);
+ mchars_free();
return;
}
- vp = html_alloc(mchars, &conf);
+ vp = html_alloc(&conf);
if (man->macroset == MACROSET_MDOC)
html_mdoc(vp, man);
@@ -863,7 +861,7 @@ format(const struct req *req, const char *file)
html_free(vp);
mparse_free(mp);
- mchars_free(mchars);
+ mchars_free();
free(conf.man);
}