summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-03-17 11:56:17 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-03-17 11:56:17 +0000
commitc9b2f541bb03d6ea693bb24850f1a6f88dfa2d36 (patch)
tree9e5e1d92bb164c1ab410e752608264fd65b34741
parentb8834ed2b38344025a694c113bdc5c9247d8dc7e (diff)
downloadmandoc-c9b2f541bb03d6ea693bb24850f1a6f88dfa2d36.tar.gz
Clean-up in libman: make all calls to man_*msg not check return value.
Also convert man_vmsg to return void.
-rw-r--r--libman.h2
-rw-r--r--man.c4
-rw-r--r--man_macro.c23
-rw-r--r--man_validate.c5
4 files changed, 16 insertions, 18 deletions
diff --git a/libman.h b/libman.h
index 4b72ce0e..595d8187 100644
--- a/libman.h
+++ b/libman.h
@@ -81,7 +81,7 @@ int man_args(struct man *, int, int *, char *, char **);
#define ARGS_EOLN (0)
#define ARGS_WORD (1)
#define ARGS_QWORD (1)
-int man_vmsg(struct man *, enum mandocerr,
+void man_vmsg(struct man *, enum mandocerr,
int, int, const char *, ...);
int man_valid_post(struct man *);
int man_valid_pre(struct man *, struct man_node *);
diff --git a/man.c b/man.c
index 74108604..c3ff9430 100644
--- a/man.c
+++ b/man.c
@@ -622,7 +622,7 @@ err: /* Error out. */
}
-int
+void
man_vmsg(struct man *man, enum mandocerr t,
int ln, int pos, const char *fmt, ...)
{
@@ -632,7 +632,7 @@ man_vmsg(struct man *man, enum mandocerr t,
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
va_end(ap);
- return((*man->msg)(t, man->data, ln, pos, buf));
+ (*man->msg)(t, man->data, ln, pos, buf);
}
diff --git a/man_macro.c b/man_macro.c
index 076ca078..0c731e7f 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -43,7 +43,7 @@ static enum rew rew_dohalt(enum mant, enum man_type,
const struct man_node *);
static enum rew rew_block(enum mant, enum man_type,
const struct man_node *);
-static int rew_warn(struct man *,
+static void rew_warn(struct man *,
struct man_node *, enum mandocerr);
const struct man_macro __man_macros[MAN_MAX] = {
@@ -88,17 +88,19 @@ const struct man_macro * const man_macros = __man_macros;
/*
* Warn when "n" is an explicit non-roff macro.
*/
-static int
+static void
rew_warn(struct man *m, struct man_node *n, enum mandocerr er)
{
if (er == MANDOCERR_MAX || MAN_BLOCK != n->type)
- return(1);
+ return;
if (MAN_VALID & n->flags)
- return(1);
+ return;
if ( ! (MAN_EXPLICIT & man_macros[n->tok].flags))
- return(1);
- return(man_nmsg(m, n, er));
+ return;
+
+ assert(er < MANDOCERR_FATAL);
+ man_nmsg(m, n, er);
}
@@ -123,16 +125,14 @@ man_unscope(struct man *m, const struct man_node *to,
* out to be lost.
*/
n = m->last->parent;
- if ( ! rew_warn(m, m->last, er))
- return(0);
+ rew_warn(m, m->last, er);
if ( ! man_valid_post(m))
return(0);
m->last = n;
assert(m->last);
}
- if ( ! rew_warn(m, m->last, er))
- return(0);
+ rew_warn(m, m->last, er);
if ( ! man_valid_post(m))
return(0);
@@ -279,8 +279,7 @@ blk_close(MACRO_PROT_ARGS)
break;
if (NULL == nn)
- if ( ! man_pmsg(m, line, ppos, MANDOCERR_NOSCOPE))
- return(0);
+ man_pmsg(m, line, ppos, MANDOCERR_NOSCOPE);
if ( ! rew_scope(MAN_BODY, m, ntok))
return(0);
diff --git a/man_validate.c b/man_validate.c
index 07fe1051..eba9cf6d 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -223,9 +223,8 @@ check_text(CHKARGS)
if ('\t' == *p) {
if (MAN_LITERAL & m->flags)
continue;
- if (man_pmsg(m, n->line, pos, MANDOCERR_BADTAB))
- continue;
- return(0);
+ man_pmsg(m, n->line, pos, MANDOCERR_BADTAB);
+ continue;
}
/* Check the special character. */