diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-05 00:14:13 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-02-05 00:14:13 +0000 |
commit | 4514bbe8133f9b6a03f35d9c4321d64e48e6cf33 (patch) | |
tree | 0e6b28410e8f7299f337233500090d8976d57375 | |
parent | 9428c0388cfeb9544f5ffec7200f5fbee7da4727 (diff) | |
download | mandoc-4514bbe8133f9b6a03f35d9c4321d64e48e6cf33.tar.gz |
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 | 1 | ||||
-rw-r--r-- | mdoc.h | 1 | ||||
-rw-r--r-- | mdoc_html.c | 9 | ||||
-rw-r--r-- | mdoc_macro.c | 8 | ||||
-rw-r--r-- | mdoc_term.c | 9 | ||||
-rw-r--r-- | tree.c | 5 |
6 files changed, 8 insertions, 25 deletions
@@ -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; @@ -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 8a52855e..82aa5d95 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -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 5a8fd3f2..00bd7fa7 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -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 73849e31..d101bbb3 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -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; } /* @@ -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) |