summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_macro.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-02-01 16:46:57 +0000
committerschwarze <schwarze@openbsd.org>2015-02-01 16:46:57 +0000
commit6bd2e4da1a7c859c5241f0a55cab902964dee524 (patch)
tree178c18912519bcae8694fd7e32b7973f0a3b6681 /usr.bin/mandoc/mdoc_macro.c
parentGather the scattered (and sometimes duplicated) qbus address and size defines (diff)
downloadwireguard-openbsd-6bd2e4da1a7c859c5241f0a55cab902964dee524.tar.xz
wireguard-openbsd-6bd2e4da1a7c859c5241f0a55cab902964dee524.zip
The function rew_sub() tries to rewind any all all kinds of blocks
and elements under any and all circumstances, even handling some bad block nesting now and then. Little surprisingly, this ends up in excessive complexity and has caused many bugs in the past. Start to slowly disentangle this mess by replacing calls to rew_sub() immediately following mdoc_head_alloc() by the much simpler rew_last(). Gets rid of the first two rew_sub() calls out of twenty. No functional change.
Diffstat (limited to 'usr.bin/mandoc/mdoc_macro.c')
-rw-r--r--usr.bin/mandoc/mdoc_macro.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index ec6507f01a5..1b93aa60727 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: mdoc_macro.c,v 1.117 2014/12/22 23:26:20 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.118 2015/02/01 16:46:57 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -1135,7 +1135,7 @@ blk_full(MACRO_PROT_ARGS)
if (tok == MDOC_Nd) {
head = mdoc_head_alloc(mdoc, line, ppos, tok);
- rew_sub(MDOC_HEAD, mdoc, tok, line, ppos);
+ rew_last(mdoc, head);
body = mdoc_body_alloc(mdoc, line, ppos, tok);
}
@@ -1272,8 +1272,7 @@ blk_part_imp(MACRO_PROT_ARGS)
*/
blk = mdoc_block_alloc(mdoc, line, ppos, tok, NULL);
- mdoc_head_alloc(mdoc, line, ppos, tok);
- rew_sub(MDOC_HEAD, mdoc, tok, line, ppos);
+ rew_last(mdoc, mdoc_head_alloc(mdoc, line, ppos, tok));
/*
* Open the body scope "on-demand", that is, after we've