aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/read.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-11-28 06:27:05 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-11-28 06:27:05 +0000
commit1b9dca418446d812ce8b3ff05f4f025f26435c06 (patch)
treed9816c40a020031e51cf33a63437c85839cee800 /read.c
parent5ad0aed9e9f0fee4047fe0f4b00f3f0f0204f233 (diff)
downloadmandoc-1b9dca418446d812ce8b3ff05f4f025f26435c06.tar.gz
mandoc-1b9dca418446d812ce8b3ff05f4f025f26435c06.tar.zst
mandoc-1b9dca418446d812ce8b3ff05f4f025f26435c06.zip
Simplify by making the eqn and tbl steering functions void;
no functional change, minus 15 lines of code.
Diffstat (limited to 'read.c')
-rw-r--r--read.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/read.c b/read.c
index b71306b2..30cd84d3 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.99 2014/11/27 23:40:19 schwarze Exp $ */
+/* $Id: read.c,v 1.100 2014/11/28 06:27:05 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -317,7 +317,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
struct buf ln;
size_t pos; /* byte number in the ln buffer */
enum rofferr rr;
- int of, rc;
+ int of;
int lnn; /* line number in the real file */
unsigned char c;
@@ -570,34 +570,21 @@ rerun:
* Do the same for ROFF_EQN.
*/
- rc = -1;
-
- if (ROFF_TBL == rr)
- while (NULL != (span = roff_span(curp->roff))) {
- rc = curp->man ?
- man_addspan(curp->man, span) :
- mdoc_addspan(curp->mdoc, span);
- if (0 == rc)
- break;
- }
- else if (ROFF_EQN == rr)
- rc = curp->mdoc ?
- mdoc_addeqn(curp->mdoc,
- roff_eqn(curp->roff)) :
- man_addeqn(curp->man,
- roff_eqn(curp->roff));
- else if (curp->man || curp->mdoc)
- rc = curp->man ?
- man_parseln(curp->man,
- curp->line, ln.buf, of) :
- mdoc_parseln(curp->mdoc,
- curp->line, ln.buf, of);
-
- if (0 == rc) {
- assert(MANDOCLEVEL_FATAL <= curp->file_status);
- break;
- } else if (2 == rc)
- break;
+ if (rr == ROFF_TBL) {
+ while ((span = roff_span(curp->roff)) != NULL)
+ if (curp->man == NULL)
+ mdoc_addspan(curp->mdoc, span);
+ else
+ man_addspan(curp->man, span);
+ } else if (rr == ROFF_EQN) {
+ if (curp->man == NULL)
+ mdoc_addeqn(curp->mdoc, roff_eqn(curp->roff));
+ else
+ man_addeqn(curp->man, roff_eqn(curp->roff));
+ } else if ((curp->man == NULL ?
+ mdoc_parseln(curp->mdoc, curp->line, ln.buf, of) :
+ man_parseln(curp->man, curp->line, ln.buf, of)) == 2)
+ break;
/* Temporary buffers typically are not full. */