summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-30 21:18:24 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-30 21:18:24 +0000
commitb9959419144200aae35b8cb648937b9bd18a5716 (patch)
treec3f77cc28c6cb4c2534c00ca792e5715937d367a
parentbdbc20253f6d0e531a1f1bf519d9d01a5c1059a3 (diff)
downloadmandoc-b9959419144200aae35b8cb648937b9bd18a5716.tar.gz
garbage collect three unused global flags; no functional change
-rw-r--r--libman.h2
-rw-r--r--libmdoc.h1
-rw-r--r--man.c51
-rw-r--r--man_macro.c7
-rw-r--r--mdoc.c40
5 files changed, 13 insertions, 88 deletions
diff --git a/libman.h b/libman.h
index 5ed1d421..d68d4e57 100644
--- a/libman.h
+++ b/libman.h
@@ -26,10 +26,8 @@ struct man {
struct mparse *parse; /* parse pointer */
int quick; /* abort parse early */
int flags; /* parse flags */
-#define MAN_HALT (1 << 0) /* badness happened: die */
#define MAN_ELINE (1 << 1) /* Next-line element scope. */
#define MAN_BLINE (1 << 2) /* Next-line block scope. */
-#define MAN_ILINE (1 << 3) /* Ignored in next-line scope. */
#define MAN_LITERAL (1 << 4) /* Literal input. */
#define MAN_NEWLINE (1 << 6) /* first macro/text in a line */
enum man_next next; /* where to put the next node */
diff --git a/libmdoc.h b/libmdoc.h
index 3cc58f80..621eedcc 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -28,7 +28,6 @@ struct mdoc {
const char *defos; /* default argument for .Os */
int quick; /* abort parse early */
int flags; /* parse flags */
-#define MDOC_HALT (1 << 0) /* error in parse: halt */
#define MDOC_LITERAL (1 << 1) /* in a literal scope */
#define MDOC_PBODY (1 << 2) /* in the document body */
#define MDOC_NEWLINE (1 << 3) /* first macro/text in a line */
diff --git a/man.c b/man.c
index 03a9c23a..5be6ad4a 100644
--- a/man.c
+++ b/man.c
@@ -68,7 +68,6 @@ const struct man_node *
man_node(const struct man *man)
{
- assert( ! (MAN_HALT & man->flags));
return(man->first);
}
@@ -76,7 +75,6 @@ const struct man_meta *
man_meta(const struct man *man)
{
- assert( ! (MAN_HALT & man->flags));
return(&man->meta);
}
@@ -116,11 +114,7 @@ int
man_endparse(struct man *man)
{
- assert( ! (MAN_HALT & man->flags));
- if (man_macroend(man))
- return(1);
- man->flags |= MAN_HALT;
- return(0);
+ return(man_macroend(man));
}
int
@@ -129,8 +123,6 @@ man_parseln(struct man *man, int ln, char *buf, int offs)
man->flags |= MAN_NEWLINE;
- assert( ! (MAN_HALT & man->flags));
-
return (roff_getcontrol(man->roff, buf, &offs) ?
man_pmacro(man, ln, buf, offs) :
man_ptext(man, ln, buf, offs));
@@ -352,8 +344,6 @@ man_addeqn(struct man *man, const struct eqn *ep)
{
struct man_node *n;
- assert( ! (MAN_HALT & man->flags));
-
n = man_node_alloc(man, ep->ln, ep->pos, MAN_EQN, MAN_MAX);
n->eqn = ep;
@@ -369,8 +359,6 @@ man_addspan(struct man *man, const struct tbl_span *sp)
{
struct man_node *n;
- assert( ! (MAN_HALT & man->flags));
-
n = man_node_alloc(man, sp->line, 0, MAN_TBL, MAN_MAX);
n->span = sp;
@@ -590,7 +578,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
assert(man_macros[tok].fp);
if ( ! (*man_macros[tok].fp)(man, tok, ln, ppos, &offs, buf))
- goto err;
+ return(0);
/* In quick mode (for mandocdb), abort after the NAME section. */
@@ -602,46 +590,21 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
}
/*
- * We weren't in a block-line scope when entering the
- * above-parsed macro, so return.
- */
-
- if ( ! bline) {
- man->flags &= ~MAN_ILINE;
- return(1);
- }
-
- /*
- * If we're in a block scope, then allow this macro to slip by
- * without closing scope around it.
- */
-
- if (MAN_ILINE & man->flags) {
- man->flags &= ~MAN_ILINE;
- return(1);
- }
-
- /*
- * If we've opened a new next-line element scope, then return
- * now, as the next line will close out the block scope.
+ * If we are in a next-line scope for a block head,
+ * close it out now and switch to the body,
+ * unless the next-line scope is allowed to continue.
*/
- if (MAN_ELINE & man->flags)
+ if ( ! bline || man->flags & MAN_ELINE ||
+ man_macros[tok].flags & MAN_NSCOPED)
return(1);
- /* Close out the block scope opened in the prior line. */
-
assert(MAN_BLINE & man->flags);
man->flags &= ~MAN_BLINE;
if ( ! man_unscope(man, man->last->parent))
return(0);
return(man_body_alloc(man, ln, ppos, man->last->tok));
-
-err: /* Error out. */
-
- man->flags |= MAN_HALT;
- return(0);
}
/*
diff --git a/man_macro.c b/man_macro.c
index 7d9e3022..fa971403 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -415,13 +415,6 @@ in_line_eoln(MACRO_PROT_ARGS)
return(1);
}
- /* Set ignorable context, if applicable. */
-
- if (MAN_NSCOPED & man_macros[tok].flags) {
- assert( ! (MAN_SCOPED & man_macros[tok].flags));
- man->flags |= MAN_ILINE;
- }
-
assert(MAN_ROOT != man->last->type);
man->next = MAN_NEXT_SIBLING;
diff --git a/mdoc.c b/mdoc.c
index d5ae55cf..c07c712b 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -104,7 +104,6 @@ const struct mdoc_node *
mdoc_node(const struct mdoc *mdoc)
{
- assert( ! (MDOC_HALT & mdoc->flags));
return(mdoc->first);
}
@@ -112,7 +111,6 @@ const struct mdoc_meta *
mdoc_meta(const struct mdoc *mdoc)
{
- assert( ! (MDOC_HALT & mdoc->flags));
return(&mdoc->meta);
}
@@ -205,19 +203,11 @@ mdoc_alloc(struct roff *roff, struct mparse *parse,
return(p);
}
-/*
- * Climb back up the parse tree, validating open scopes. Mostly calls
- * through to macro_end() in macro.c.
- */
int
mdoc_endparse(struct mdoc *mdoc)
{
- assert( ! (MDOC_HALT & mdoc->flags));
- if (mdoc_macroend(mdoc))
- return(1);
- mdoc->flags |= MDOC_HALT;
- return(0);
+ return(mdoc_macroend(mdoc));
}
int
@@ -225,8 +215,6 @@ mdoc_addeqn(struct mdoc *mdoc, const struct eqn *ep)
{
struct mdoc_node *n;
- assert( ! (MDOC_HALT & mdoc->flags));
-
n = node_alloc(mdoc, ep->ln, ep->pos, MDOC_MAX, MDOC_EQN);
n->eqn = ep;
@@ -242,8 +230,6 @@ mdoc_addspan(struct mdoc *mdoc, const struct tbl_span *sp)
{
struct mdoc_node *n;
- assert( ! (MDOC_HALT & mdoc->flags));
-
n = node_alloc(mdoc, sp->line, 0, MDOC_MAX, MDOC_TBL);
n->span = sp;
@@ -262,8 +248,6 @@ int
mdoc_parseln(struct mdoc *mdoc, int ln, char *buf, int offs)
{
- assert( ! (MDOC_HALT & mdoc->flags));
-
mdoc->flags |= MDOC_NEWLINE;
/*
@@ -883,11 +867,8 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
* into macro processing.
*/
- if (NULL == mdoc->last || MDOC_It == tok || MDOC_El == tok) {
- if ( ! mdoc_macro(mdoc, tok, ln, sv, &offs, buf))
- goto err;
- return(1);
- }
+ if (NULL == mdoc->last || MDOC_It == tok || MDOC_El == tok)
+ return(mdoc_macro(mdoc, tok, ln, sv, &offs, buf));
n = mdoc->last;
assert(mdoc->last);
@@ -900,9 +881,7 @@ 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;
- if ( ! mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf))
- goto err;
- return(1);
+ return(mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf));
}
/*
@@ -916,15 +895,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;
- if ( ! mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf))
- goto err;
- return(1);
+ return(mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf));
}
/* Normal processing of a macro. */
if ( ! mdoc_macro(mdoc, tok, ln, sv, &offs, buf))
- goto err;
+ return(0);
/* In quick mode (for mandocdb), abort after the NAME section. */
@@ -933,11 +910,6 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
return(2);
return(1);
-
-err: /* Error out. */
-
- mdoc->flags |= MDOC_HALT;
- return(0);
}
enum mdelim