aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-01-05 09:46:34 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-01-05 09:46:34 +0000
commit39411659cecc9e05af6cfa55bd6f04cf3e858e79 (patch)
treea4df87dce97f1214b3c201b73433ade8c679d61d
parent6b3ce9c2f4fab0e6c861db946aec61ff56ce922a (diff)
downloadmandoc-39411659cecc9e05af6cfa55bd6f04cf3e858e79.tar.gz
mandoc-39411659cecc9e05af6cfa55bd6f04cf3e858e79.tar.zst
mandoc-39411659cecc9e05af6cfa55bd6f04cf3e858e79.zip
minor cleanup, no functional change:
* delete one irrelevant FIXME; no more fixed lengths in HTML, please * simplify some conditions * avoid testing pointers as truth values, use "!= NULL" * sort some declarations * delete some pointless blank lines
-rw-r--r--man_html.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/man_html.c b/man_html.c
index 09b13915..94146052 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.163 2019/01/05 09:14:44 schwarze Exp $ */
+/* $Id: man_html.c,v 1.164 2019/01/05 09:46:34 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -33,8 +33,6 @@
#include "html.h"
#include "main.h"
-/* FIXME: have PD set the default vspace width. */
-
#define MAN_ARGS const struct roff_meta *man, \
const struct roff_node *n, \
struct html *h
@@ -123,14 +121,12 @@ static const struct man_html_act man_html_acts[MAN_MAX - MAN_TH] = {
static void
print_bvspace(struct html *h, const struct roff_node *n)
{
+ if (n->body != NULL && n->body->child != NULL &&
+ n->body->child->type == ROFFT_TBL)
+ return;
- if (n->body && n->body->child)
- if (n->body->child->type == ROFFT_TBL)
- return;
-
- if (n->parent->type == ROFFT_ROOT || n->parent->tok != MAN_RS)
- if (NULL == n->prev)
- return;
+ if (n->prev == NULL && n->parent->tok != MAN_RS)
+ return;
print_paragraph(h);
}
@@ -179,7 +175,6 @@ print_man_head(const struct roff_meta *man, struct html *h)
static void
print_man_nodelist(MAN_ARGS)
{
-
while (n != NULL) {
print_man_node(man, n, h);
n = n->next;
@@ -238,7 +233,7 @@ print_man_node(MAN_ARGS)
* the "meta" table state. This will be reopened on the
* next table element.
*/
- if (h->tblt)
+ if (h->tblt != NULL)
print_tblclose(h);
t = h->tag;
@@ -255,7 +250,7 @@ print_man_node(MAN_ARGS)
break;
}
- if (child && n->child)
+ if (child && n->child != NULL)
print_man_nodelist(man, n->child, h);
/* This will automatically close out any font scope. */
@@ -287,7 +282,7 @@ man_root_pre(const struct roff_meta *man, struct html *h)
print_stagq(h, tt);
print_otag(h, TAG_TD, "c", "head-vol");
- if (NULL != man->vol)
+ if (man->vol != NULL)
print_text(h, man->vol);
print_stagq(h, tt);
@@ -310,7 +305,7 @@ man_root_post(const struct roff_meta *man, struct html *h)
print_stagq(h, tt);
print_otag(h, TAG_TD, "c", "foot-os");
- if (man->os)
+ if (man->os != NULL)
print_text(h, man->os);
print_tagq(h, t);
}
@@ -333,11 +328,11 @@ static int
man_alt_pre(MAN_ARGS)
{
const struct roff_node *nn;
+ struct tag *t;
int i;
enum htmltag fp;
- struct tag *t;
- for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
+ for (i = 0, nn = n->child; nn != NULL; nn = nn->next, i++) {
switch (n->tok) {
case MAN_BI:
fp = i % 2 ? TAG_I : TAG_B;
@@ -379,7 +374,7 @@ static int
man_SM_pre(MAN_ARGS)
{
print_otag(h, TAG_SMALL, "");
- if (MAN_SB == n->tok)
+ if (n->tok == MAN_SB)
print_otag(h, TAG_B, "");
return 1;
}
@@ -401,7 +396,6 @@ man_SS_pre(MAN_ARGS)
static int
man_PP_pre(MAN_ARGS)
{
-
if (n->type == ROFFT_HEAD)
return 0;
else if (n->type == ROFFT_BLOCK)
@@ -443,7 +437,6 @@ man_IP_pre(MAN_ARGS)
default:
abort();
}
-
return 0;
}
@@ -469,14 +462,14 @@ man_OP_pre(MAN_ARGS)
h->flags |= HTML_NOSPACE;
tt = print_otag(h, TAG_SPAN, "c", "Op");
- if (NULL != (n = n->child)) {
+ if ((n = n->child) != NULL) {
print_otag(h, TAG_B, "");
print_text(h, n->string);
}
print_stagq(h, tt);
- if (NULL != n && NULL != n->next) {
+ if (n != NULL && n->next != NULL) {
print_otag(h, TAG_I, "");
print_text(h, n->next->string);
}
@@ -511,7 +504,6 @@ man_in_pre(MAN_ARGS)
static int
man_ign_pre(MAN_ARGS)
{
-
return 0;
}
@@ -550,6 +542,7 @@ static int
man_UR_pre(MAN_ARGS)
{
char *cp;
+
n = n->child;
assert(n->type == ROFFT_HEAD);
if (n->child != NULL) {
@@ -567,7 +560,6 @@ man_UR_pre(MAN_ARGS)
n = n->next;
print_man_nodelist(man, n->child, h);
-
return 0;
}