source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: minor cleanup, no functional change: * delete one irrelevant
@ 2019-01-05  9:47 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-01-05  9:47 UTC (permalink / raw)
  To: source

Log Message:
-----------
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

Modified Files:
--------------
    mandoc:
        man_html.c

Revision Data
-------------
Index: man_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_html.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -Lman_html.c -Lman_html.c -u -p -r1.163 -r1.164
--- man_html.c
+++ man_html.c
@@ -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_htm
 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 *m
 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
 	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 *ma
 	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;
 }
 
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-05  9:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-05  9:47 mandoc: minor cleanup, no functional change: * delete one irrelevant schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).