aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/read.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-09-06 23:24:32 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-09-06 23:24:32 +0000
commit2745b3f22e169e51509c6a77a688756f59a2b2b9 (patch)
tree23a8d2cac4465ef19f4105efe1a1fbe84a9ffd9d /read.c
parent1e75b893a49c0cbdd978438e15c5a8fa8aebb510 (diff)
downloadmandoc-2745b3f22e169e51509c6a77a688756f59a2b2b9.tar.gz
mandoc-2745b3f22e169e51509c6a77a688756f59a2b2b9.tar.zst
mandoc-2745b3f22e169e51509c6a77a688756f59a2b2b9.zip
Simplify by handling empty request lines at the one logical place
in the roff parser instead of in three other places in other parsers. No functional change.
Diffstat (limited to 'read.c')
-rw-r--r--read.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/read.c b/read.c
index 26cd6288..7b952aa7 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.83 2014/09/06 22:39:36 schwarze Exp $ */
+/* $Id: read.c,v 1.84 2014/09/06 23:24:32 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -69,9 +69,9 @@ struct mparse {
int line; /* line number in the file */
};
+static void choose_parser(struct mparse *);
static void resize_buf(struct buf *, size_t);
static void mparse_buf_r(struct mparse *, struct buf, int);
-static void pset(const char *, int, struct mparse *);
static int read_whole_file(struct mparse *, const char *, int,
struct buf *, int *);
static void mparse_end(struct mparse *);
@@ -247,19 +247,10 @@ resize_buf(struct buf *buf, size_t initial)
}
static void
-pset(const char *buf, int pos, struct mparse *curp)
+choose_parser(struct mparse *curp)
{
char *cp, *ep;
int format;
- int i;
-
- if ('.' == buf[0] || '\'' == buf[0]) {
- for (i = 1; buf[i]; i++)
- if (' ' != buf[i] && '\t' != buf[i])
- break;
- if ('\0' == buf[i])
- return;
- }
/*
* If neither command line arguments -mdoc or -man select
@@ -550,12 +541,10 @@ rerun:
*/
if ( ! (curp->man || curp->mdoc))
- pset(ln.buf + of, pos - of, curp);
+ choose_parser(curp);
/*
- * Lastly, push down into the parsers themselves. One
- * of these will have already been set in the pset()
- * routine.
+ * Lastly, push down into the parsers themselves.
* If libroff returns ROFF_TBL, then add it to the
* currently open parse. Since we only get here if
* there does exist data (see tbl_data.c), we're