diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-02-05 00:13:35 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-02-05 00:13:35 +0000 |
commit | 4d73dee4aabd2b00728ba212fd59df611497560a (patch) | |
tree | 9aed70b90e3c2c9057235e4139e4577bd7760e01 | |
parent | 4738ead590e6bd88a2f6493751947496d86c42c3 (diff) |
Simplify by deleting the "lastline" member of struct mdoc_node.
Minus one struct member, minus 17 lines of code, no functional change.
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.h | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 11 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_macro.c | 10 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 11 | ||||
-rw-r--r-- | usr.bin/mandoc/tree.c | 7 |
6 files changed, 14 insertions, 31 deletions
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 78d1877e0ee..fb7ecb6dca5 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc.c,v 1.124 2015/02/02 04:26:03 schwarze Exp $ */ +/* $OpenBSD: mdoc.c,v 1.125 2015/02/05 00:13:34 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -361,7 +361,6 @@ node_alloc(struct mdoc *mdoc, int line, int pos, p->sec = mdoc->lastsec; p->line = line; p->pos = pos; - p->lastline = line; p->tok = tok; p->type = type; diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h index a4a7f9df810..723f1873344 100644 --- a/usr.bin/mandoc/mdoc.h +++ b/usr.bin/mandoc/mdoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc.h,v 1.59 2015/01/31 00:11:51 schwarze Exp $ */ +/* $OpenBSD: mdoc.h,v 1.60 2015/02/05 00:13:34 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -352,7 +352,6 @@ struct mdoc_node { int nchild; /* number children */ int line; /* parse line */ int pos; /* parse column */ - int lastline; /* the node ends on this line */ enum mdoct tok; /* tok or MDOC__MAX if none */ int flags; #define MDOC_VALID (1 << 0) /* has been validated */ diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 5cf4487c581..2835470e487 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_html.c,v 1.96 2015/02/01 23:10:15 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.97 2015/02/05 00:13:34 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -434,12 +434,9 @@ print_mdoc_node(MDOC_ARGS) break; } - if (HTML_KEEP & h->flags) { - if (n->prev ? (n->prev->lastline != n->line) : - (n->parent && n->parent->line != n->line)) { - h->flags &= ~HTML_KEEP; - h->flags |= HTML_PREKEEP; - } + if (h->flags & HTML_KEEP && n->flags & MDOC_LINE) { + h->flags &= ~HTML_KEEP; + h->flags |= HTML_PREKEEP; } if (child && n->child) diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 679d9c92349..c4c1a1e562b 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_macro.c,v 1.130 2015/02/04 22:29:27 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.131 2015/02/05 00:13:34 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -260,9 +260,6 @@ rew_last(struct mdoc *mdoc, const struct mdoc_node *to) assert(to); mdoc->next = MDOC_NEXT_SIBLING; while (mdoc->last != to) { - if ( ! (mdoc->last->flags & MDOC_VALID)) - mdoc->last->lastline = to->lastline - - (mdoc->flags & MDOC_NEWLINE ? 1 : 0); /* * Save the parent here, because we may delete the * mdoc->last node in the post-validation phase and reset @@ -576,10 +573,8 @@ blk_exp_close(MACRO_PROT_ARGS) /* Remember the start of our own body. */ if (n->type == MDOC_BODY && atok == n->tok) { - if (n->end == ENDBODY_NOT) { + if (n->end == ENDBODY_NOT) body = n; - n->lastline = line; - } continue; } @@ -592,7 +587,6 @@ blk_exp_close(MACRO_PROT_ARGS) } if (atok == n->tok) { - n->lastline = line; assert(body); /* diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 001140432d6..d4e32ff4c1c 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.205 2015/02/01 23:10:15 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.206 2015/02/05 00:13:34 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -317,12 +317,9 @@ print_mdoc_node(DECL_ARGS) * invoked in a prior line, revert it to PREKEEP. */ - if (TERMP_KEEP & p->flags) { - if (n->prev ? (n->prev->lastline != n->line) : - (n->parent && n->parent->line != n->line)) { - p->flags &= ~TERMP_KEEP; - p->flags |= TERMP_PREKEEP; - } + if (p->flags & TERMP_KEEP && n->flags & MDOC_LINE) { + p->flags &= ~TERMP_KEEP; + p->flags |= TERMP_PREKEEP; } /* diff --git a/usr.bin/mandoc/tree.c b/usr.bin/mandoc/tree.c index 180074769b4..0d937808297 100644 --- a/usr.bin/mandoc/tree.c +++ b/usr.bin/mandoc/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.28 2015/02/03 18:37:39 schwarze Exp $ */ +/* $OpenBSD: tree.c,v 1.29 2015/02/05 00:13:34 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -160,10 +160,7 @@ print_mdoc(const struct mdoc_node *n, int indent) putchar(' '); if (MDOC_LINE & n->flags) putchar('*'); - printf("%d:%d", n->line, n->pos + 1); - if (n->lastline != n->line) - printf("-%d", n->lastline); - putchar('\n'); + printf("%d:%d\n", n->line, n->pos + 1); } if (n->eqn) |