diff options
author | 2015-02-05 00:14:13 +0000 | |
---|---|---|
committer | 2015-02-05 00:14:13 +0000 | |
commit | 4f91009f8aa8fa191505ff44484c023b578795b2 (patch) | |
tree | a8e0ab19e43df333dfe231ace1509c193ae68a95 | |
parent | aff7055e2d69b65767cc1314a7898f31abe2c74a (diff) | |
download | mandoc-4f91009f8aa8fa191505ff44484c023b578795b2.tar.gz mandoc-4f91009f8aa8fa191505ff44484c023b578795b2.tar.zst mandoc-4f91009f8aa8fa191505ff44484c023b578795b2.zip |
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-- | mdoc.c | 3 | ||||
-rw-r--r-- | mdoc.h | 3 | ||||
-rw-r--r-- | mdoc_html.c | 11 | ||||
-rw-r--r-- | mdoc_macro.c | 10 | ||||
-rw-r--r-- | mdoc_term.c | 11 | ||||
-rw-r--r-- | tree.c | 7 |
6 files changed, 14 insertions, 31 deletions
@@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.235 2015/02/02 04:26:44 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.236 2015/02/05 00:14:13 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -363,7 +363,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; @@ -1,4 +1,4 @@ -/* $Id: mdoc.h,v 1.134 2015/01/31 00:12:41 schwarze Exp $ */ +/* $Id: mdoc.h,v 1.135 2015/02/05 00:14:13 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/mdoc_html.c b/mdoc_html.c index bc89a4af..5b7fc742 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.221 2015/02/01 23:10:35 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.222 2015/02/05 00:14:13 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -436,12 +436,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/mdoc_macro.c b/mdoc_macro.c index c6b0f352..86edb030 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.174 2015/02/04 22:30:10 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.175 2015/02/05 00:14:13 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -262,9 +262,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 @@ -578,10 +575,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; } @@ -594,7 +589,6 @@ blk_exp_close(MACRO_PROT_ARGS) } if (atok == n->tok) { - n->lastline = line; assert(body); /* diff --git a/mdoc_term.c b/mdoc_term.c index 4834dfaf..cfd577a8 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.306 2015/02/01 23:10:35 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.307 2015/02/05 00:14:13 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -319,12 +319,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; } /* @@ -1,4 +1,4 @@ -/* $Id: tree.c,v 1.61 2015/02/03 18:37:59 schwarze Exp $ */ +/* $Id: tree.c,v 1.62 2015/02/05 00:14:13 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -162,10 +162,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) |