aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-11-28 04:47:03 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-11-28 04:47:03 +0000
commit8f8821b48135e557417c2b0bb20231e265fecdc9 (patch)
treeeeb90c9a4783c681ec22f0035370da7af5e6d93e /mdoc.c
parent4ec14565a73ba8a34e7ed203d15b897b813d5117 (diff)
downloadmandoc-8f8821b48135e557417c2b0bb20231e265fecdc9.tar.gz
mandoc-8f8821b48135e557417c2b0bb20231e265fecdc9.tar.zst
mandoc-8f8821b48135e557417c2b0bb20231e265fecdc9.zip
Simplify by making the mdoc parser callbacks void, and some cleanup;
no functional change, minus 50 lines of code.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/mdoc.c b/mdoc.c
index 929d0208..9d9d356c 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.231 2014/11/28 03:14:18 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.232 2014/11/28 04:47:03 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -194,7 +194,8 @@ int
mdoc_endparse(struct mdoc *mdoc)
{
- return(mdoc_macroend(mdoc));
+ mdoc_macroend(mdoc);
+ return(1);
}
int
@@ -250,7 +251,7 @@ mdoc_parseln(struct mdoc *mdoc, int ln, char *buf, int offs)
mdoc_ptext(mdoc, ln, buf, offs));
}
-int
+void
mdoc_macro(MACRO_PROT_ARGS)
{
assert(tok < MDOC_MAX);
@@ -260,7 +261,7 @@ mdoc_macro(MACRO_PROT_ARGS)
mandoc_vmsg(MANDOCERR_DT_LATE,
mdoc->parse, line, ppos,
"Dt %s", buf + *pos);
- return(1);
+ return;
}
} else if ( ! (mdoc_macros[tok].flags & MDOC_PROLOGUE)) {
if (mdoc->meta.title == NULL) {
@@ -273,8 +274,7 @@ mdoc_macro(MACRO_PROT_ARGS)
mdoc->meta.vol = mandoc_strdup("LOCAL");
mdoc->flags |= MDOC_PBODY;
}
-
- return((*mdoc_macros[tok].fp)(mdoc, tok, line, ppos, pos, buf));
+ (*mdoc_macros[tok].fp)(mdoc, tok, line, ppos, pos, buf);
}
@@ -606,7 +606,8 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs)
LIST_column == n->norm->Bl.type) {
/* `Bl' is open without any children. */
mdoc->flags |= MDOC_FREECOL;
- return(mdoc_macro(mdoc, MDOC_It, line, offs, &offs, buf));
+ mdoc_macro(mdoc, MDOC_It, line, offs, &offs, buf);
+ return(1);
}
if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
@@ -615,7 +616,8 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs)
LIST_column == n->parent->norm->Bl.type) {
/* `Bl' has block-level `It' children. */
mdoc->flags |= MDOC_FREECOL;
- return(mdoc_macro(mdoc, MDOC_It, line, offs, &offs, buf));
+ mdoc_macro(mdoc, MDOC_It, line, offs, &offs, buf);
+ return(1);
}
/*
@@ -693,7 +695,6 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs)
if (mandoc_eos(buf+offs, (size_t)(end-buf-offs)))
mdoc->last->flags |= MDOC_EOS;
-
return(1);
}
@@ -765,8 +766,10 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
* into macro processing.
*/
- if (NULL == mdoc->last || MDOC_It == tok || MDOC_El == tok)
- return(mdoc_macro(mdoc, tok, ln, sv, &offs, buf));
+ if (NULL == mdoc->last || MDOC_It == tok || MDOC_El == tok) {
+ mdoc_macro(mdoc, tok, ln, sv, &offs, buf);
+ return(1);
+ }
n = mdoc->last;
assert(mdoc->last);
@@ -779,7 +782,8 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
if (MDOC_Bl == n->tok && MDOC_BODY == n->type &&
LIST_column == n->norm->Bl.type) {
mdoc->flags |= MDOC_FREECOL;
- return(mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf));
+ mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf);
+ return(1);
}
/*
@@ -793,13 +797,13 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
MDOC_Bl == n->parent->tok &&
LIST_column == n->parent->norm->Bl.type) {
mdoc->flags |= MDOC_FREECOL;
- return(mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf));
+ mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf);
+ return(1);
}
/* Normal processing of a macro. */
- if ( ! mdoc_macro(mdoc, tok, ln, sv, &offs, buf))
- return(0);
+ mdoc_macro(mdoc, tok, ln, sv, &offs, buf);
/* In quick mode (for mandocdb), abort after the NAME section. */