summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-10-16 12:20:34 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-10-16 12:20:34 +0000
commit855d59ab582ff06a37b6864586bd5d5aa61018a2 (patch)
treeec50e0edd6a8458edd410b827c40dbf7d4a7b786
parent14297a71223fc5ff079a17f339ddbf603eaca3bf (diff)
downloadmandoc-855d59ab582ff06a37b6864586bd5d5aa61018a2.tar.gz
Remove a bunch of useless assignments,
and assert that print_bvspace cannot be called on NULL pointers. No change in behaviour, none of these were bugs, but the code becomes easier to understand. Based on a clang report posted by joerg@; ok kristaps@.
-rw-r--r--man_validate.c11
-rw-r--r--mdoc_html.c2
-rw-r--r--mdoc_macro.c5
-rw-r--r--mdoc_term.c2
-rw-r--r--mdoc_validate.c9
-rw-r--r--term_ps.c5
6 files changed, 15 insertions, 19 deletions
diff --git a/man_validate.c b/man_validate.c
index 39380fa3..587436c4 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -213,12 +213,12 @@ check_text(CHKARGS)
{
char *cp, *p;
- cp = p = n->string;
- for (cp = p; NULL != (p = strchr(p, '\t')); p++) {
- if (MAN_LITERAL & m->flags)
- continue;
+ if (MAN_LITERAL & m->flags)
+ return;
+
+ cp = n->string;
+ for (p = cp; NULL != (p = strchr(p, '\t')); p++)
man_pmsg(m, n->line, (int)(p - cp), MANDOCERR_BADTAB);
- }
}
#define INEQ_DEFINE(x, ineq, name) \
@@ -474,7 +474,6 @@ post_UC(CHKARGS)
const char *p, *s;
n = n->child;
- n = m->last->child;
if (NULL == n || MAN_TEXT != n->type)
p = bsd_versions[0];
diff --git a/mdoc_html.c b/mdoc_html.c
index 0701f22d..d1031328 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -503,7 +503,7 @@ mdoc_root_post(MDOC_ARGS)
print_otag(h, TAG_COL, 1, tag);
print_otag(h, TAG_COL, 1, tag);
- t = print_otag(h, TAG_TBODY, 0, NULL);
+ print_otag(h, TAG_TBODY, 0, NULL);
tt = print_otag(h, TAG_TR, 0, NULL);
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 2164f021..024af0c9 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1443,18 +1443,15 @@ blk_part_exp(MACRO_PROT_ARGS)
/* Clean-up to leave in a consistent state. */
- if (NULL == head) {
+ if (NULL == head)
if ( ! mdoc_head_alloc(m, line, ppos, tok))
return(0);
- head = m->last;
- }
if (NULL == body) {
if ( ! rew_sub(MDOC_HEAD, m, tok, line, ppos))
return(0);
if ( ! mdoc_body_alloc(m, line, ppos, tok))
return(0);
- body = m->last;
}
/* Standard appending of delimiters. */
diff --git a/mdoc_term.c b/mdoc_term.c
index 1c71f01e..709fc108 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -584,6 +584,8 @@ print_bvspace(struct termp *p,
{
const struct mdoc_node *nn;
+ assert(n);
+
term_newln(p);
if (MDOC_Bd == bl->tok && bl->norm->Bd.comp)
diff --git a/mdoc_validate.c b/mdoc_validate.c
index d9d3b4d9..09f91873 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -545,12 +545,11 @@ check_text(struct mdoc *m, int ln, int pos, char *p)
{
char *cp;
- cp = p;
- for (cp = p; NULL != (p = strchr(p, '\t')); p++) {
- if (MDOC_LITERAL & m->flags)
- continue;
+ if (MDOC_LITERAL & m->flags)
+ return;
+
+ for (cp = p; NULL != (p = strchr(p, '\t')); p++)
mdoc_pmsg(m, ln, pos + (int)(p - cp), MANDOCERR_BADTAB);
- }
}
static int
diff --git a/term_ps.c b/term_ps.c
index dd1c0b59..1c89e5c0 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -488,8 +488,7 @@ pspdf_alloc(char *outopts)
pagey = 356;
} else if (2 != sscanf(pp, "%ux%u", &pagex, &pagey))
fprintf(stderr, "%s: Unknown paper\n", pp);
- } else if (NULL == pp)
- pp = "letter";
+ }
/*
* This MUST be defined before any PNT2AFM or AFM2PNT
@@ -576,7 +575,7 @@ ps_printf(struct termp *p, const char *fmt, ...)
ps_growbuf(p, PS_BUFSLOP);
pos = (int)p->ps->psmargcur;
- len = vsnprintf(&p->ps->psmarg[pos], PS_BUFSLOP, fmt, ap);
+ vsnprintf(&p->ps->psmarg[pos], PS_BUFSLOP, fmt, ap);
va_end(ap);