From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 7902f25c; for ; Wed, 4 Feb 2015 19:14:44 -0500 (EST) Date: Wed, 4 Feb 2015 19:14:44 -0500 (EST) Message-Id: <9662110912939408472.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Simplify by deleting the "lastline" member of struct mdoc_node. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Simplify by deleting the "lastline" member of struct mdoc_node. Minus one struct member, minus 17 lines of code, no functional change. Modified Files: -------------- mdocml: mdoc.c mdoc.h mdoc_html.c mdoc_macro.c mdoc_term.c tree.c Revision Data ------------- Index: mdoc_macro.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_macro.c,v retrieving revision 1.174 retrieving revision 1.175 diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.174 -r1.175 --- mdoc_macro.c +++ mdoc_macro.c @@ -262,9 +262,6 @@ rew_last(struct mdoc *mdoc, const struct 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); /* Index: mdoc.h =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc.h,v retrieving revision 1.134 retrieving revision 1.135 diff -Lmdoc.h -Lmdoc.h -u -p -r1.134 -r1.135 --- mdoc.h +++ mdoc.h @@ -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 */ Index: mdoc_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v retrieving revision 1.306 retrieving revision 1.307 diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.306 -r1.307 --- mdoc_term.c +++ 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; } /* Index: tree.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/tree.c,v retrieving revision 1.61 retrieving revision 1.62 diff -Ltree.c -Ltree.c -u -p -r1.61 -r1.62 --- tree.c +++ tree.c @@ -162,10 +162,7 @@ print_mdoc(const struct mdoc_node *n, in 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) Index: mdoc.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc.c,v retrieving revision 1.235 retrieving revision 1.236 diff -Lmdoc.c -Lmdoc.c -u -p -r1.235 -r1.236 --- mdoc.c +++ mdoc.c @@ -363,7 +363,6 @@ node_alloc(struct mdoc *mdoc, int line, p->sec = mdoc->lastsec; p->line = line; p->pos = pos; - p->lastline = line; p->tok = tok; p->type = type; Index: mdoc_html.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v retrieving revision 1.221 retrieving revision 1.222 diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.221 -r1.222 --- mdoc_html.c +++ 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) -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv