aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libmandoc.h
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-01-06 21:34:31 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-01-06 21:34:31 +0000
commit5856944693ea231656e42d7ac30d26149f53a66a (patch)
treeb577d8542f8d1e2845e54d139ec27c67097c7c8f /libmandoc.h
parent8af38b3d67df7e658bfc44cdd727c45ceb20191a (diff)
downloadmandoc-5856944693ea231656e42d7ac30d26149f53a66a.tar.gz
mandoc-5856944693ea231656e42d7ac30d26149f53a66a.tar.zst
mandoc-5856944693ea231656e42d7ac30d26149f53a66a.zip
Another 25% speedup for mandocdb(8) -Q mode, found with gprof(1).
For /usr/share/man, we only need 56% of the time of makewhatis(8) now. In groff, user-defined macros clashing with mdoc(7) or man(7) standard macros are cleared when parsing the .Dd or .TH macro, respectively. Of course, we continue doing that in standard mode to assure full groff bug compatibility. However, in -Q mode, full groff bug compatibility makes no sense when it's unreasonably expensive, so skip this step in -Q mode. Real-world manuals hardly ever redefine standard macros, that's terrible style, and if they do, it's pointless to do so before .Dd or .TH because it has no effect. Even if someone does, it's extremely unlikely to break mandocdb(8) -Q parsing because we abort the parse sequence after the NAME section, anyway. So if you manually redefine .Sh, .Nm, .Nd, or .SH in a way that doesn't work at all and rely on .Dd or .TH to fix it up for you, your broken manual will no longer get a perfect apropos(1) entry until you re-run mandocdb(8) without -Q. It think that consequence is acceptable in order to get a 25% speedup for everyone else.
Diffstat (limited to 'libmandoc.h')
-rw-r--r--libmandoc.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libmandoc.h b/libmandoc.h
index 7a1b4219..27ddf3de 100644
--- a/libmandoc.h
+++ b/libmandoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmandoc.h,v 1.38 2014/01/05 20:26:36 schwarze Exp $ */
+/* $Id: libmandoc.h,v 1.39 2014/01/06 21:34:31 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -66,7 +66,7 @@ int man_addspan(struct man *, const struct tbl_span *);
int man_addeqn(struct man *, const struct eqn *);
void roff_free(struct roff *);
-struct roff *roff_alloc(enum mparset, struct mparse *);
+struct roff *roff_alloc(enum mparset, struct mparse *, int);
void roff_reset(struct roff *);
enum rofferr roff_parseln(struct roff *, int,
char **, size_t *, int, int *);