=================================================================== RCS file: /cvs/mandoc/roff.c,v retrieving revision 1.274 retrieving revision 1.276 diff -u -p -r1.274 -r1.276 --- mandoc/roff.c 2015/08/29 21:37:20 1.274 +++ mandoc/roff.c 2015/09/26 00:54:04 1.276 @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.274 2015/08/29 21:37:20 schwarze Exp $ */ +/* $Id: roff.c,v 1.276 2015/09/26 00:54:04 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -1022,7 +1022,6 @@ roff_node_append(struct roff_man *man, struct roff_nod break; default: abort(); - /* NOTREACHED */ } n->parent->nchild++; n->parent->last = n; @@ -1484,9 +1483,7 @@ roff_res(struct roff *r, struct buf *buf, int ln, int } /* - * Process text streams: - * Convert all breakable hyphens into ASCII_HYPH. - * Decrement and spring input line trap. + * Process text streams. */ static enum rofferr roff_parsetext(struct buf *buf, int pos, int *offs) @@ -1497,6 +1494,22 @@ roff_parsetext(struct buf *buf, int pos, int *offs) int isz; enum mandoc_esc esc; + /* Spring the input line trap. */ + + if (roffit_lines == 1) { + isz = mandoc_asprintf(&p, "%s\n.%s", buf->buf, roffit_macro); + free(buf->buf); + buf->buf = p; + buf->sz = isz + 1; + *offs = 0; + free(roffit_macro); + roffit_lines = 0; + return(ROFF_REPARSE); + } else if (roffit_lines > 1) + --roffit_lines; + + /* Convert all breakable hyphens into ASCII_HYPH. */ + start = p = buf->buf + pos; while (*p != '\0') { @@ -1525,19 +1538,6 @@ roff_parsetext(struct buf *buf, int pos, int *offs) *p = ASCII_HYPH; p++; } - - /* Spring the input line trap. */ - if (roffit_lines == 1) { - isz = mandoc_asprintf(&p, "%s\n.%s", buf->buf, roffit_macro); - free(buf->buf); - buf->buf = p; - buf->sz = isz + 1; - *offs = 0; - free(roffit_macro); - roffit_lines = 0; - return(ROFF_REPARSE); - } else if (roffit_lines > 1) - --roffit_lines; return(ROFF_CONT); } @@ -2059,12 +2059,12 @@ roff_getnum(const char *v, int *pos, int *res, int fla scaled = *res * 240 / 2.54; break; case 'v': - /* FALLTROUGH */ + /* FALLTHROUGH */ case 'P': scaled = *res * 40; break; case 'm': - /* FALLTROUGH */ + /* FALLTHROUGH */ case 'n': scaled = *res * 24; break;