summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-02-01 16:47:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-02-01 16:47:39 +0000
commit01c799579c9d64d32016fa6127a74e2d864fd9a9 (patch)
tree6d6a948967c31619c4461f23c59150f85ae5171e
parent3b15b25a7deff6f634e8233f6f8d96485308c592 (diff)
downloadmandoc-01c799579c9d64d32016fa6127a74e2d864fd9a9.tar.gz
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.
-rw-r--r--mdoc_macro.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 212a5df2..88499561 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* 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
@@ -1137,7 +1137,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);
}
@@ -1274,8 +1274,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