source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: resolve some code duplication; no functional change
@ 2014-12-20  0:20 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-12-20  0:20 UTC (permalink / raw)
  To: source

Log Message:
-----------
resolve some code duplication; no functional change

Modified Files:
--------------
    mdocml:
        html.c

Revision Data
-------------
Index: html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/html.c,v
retrieving revision 1.183
retrieving revision 1.184
diff -Lhtml.c -Lhtml.c -u -p -r1.183 -r1.184
--- html.c
+++ html.c
@@ -121,7 +121,7 @@ static	const char	*const roffscales[SCAL
 };
 
 static	void	 bufncat(struct html *, const char *, size_t);
-static	void	 print_ctag(struct html *, enum htmltag);
+static	void	 print_ctag(struct html *, struct tag *);
 static	int	 print_escape(char);
 static	int	 print_encode(struct html *, const char *, int);
 static	void	 print_metaf(struct html *, enum mandoc_esc);
@@ -511,14 +511,26 @@ print_otag(struct html *h, enum htmltag 
 }
 
 static void
-print_ctag(struct html *h, enum htmltag tag)
+print_ctag(struct html *h, struct tag *tag)
 {
 
-	printf("</%s>", htmltags[tag].name);
-	if (HTML_CLRLINE & htmltags[tag].flags) {
+	/*
+	 * Remember to close out and nullify the current
+	 * meta-font and table, if applicable.
+	 */
+	if (tag == h->metaf)
+		h->metaf = NULL;
+	if (tag == h->tblt)
+		h->tblt = NULL;
+
+	printf("</%s>", htmltags[tag->tag].name);
+	if (HTML_CLRLINE & htmltags[tag->tag].flags) {
 		h->flags |= HTML_NOSPACE;
 		putchar('\n');
 	}
+
+	h->tags.head = tag->next;
+	free(tag);
 }
 
 void
@@ -580,17 +592,7 @@ print_tagq(struct html *h, const struct 
 	struct tag	*tag;
 
 	while ((tag = h->tags.head) != NULL) {
-		/*
-		 * Remember to close out and nullify the current
-		 * meta-font and table, if applicable.
-		 */
-		if (tag == h->metaf)
-			h->metaf = NULL;
-		if (tag == h->tblt)
-			h->tblt = NULL;
-		print_ctag(h, tag->tag);
-		h->tags.head = tag->next;
-		free(tag);
+		print_ctag(h, tag);
 		if (until && tag == until)
 			return;
 	}
@@ -604,17 +606,7 @@ print_stagq(struct html *h, const struct
 	while ((tag = h->tags.head) != NULL) {
 		if (suntil && tag == suntil)
 			return;
-		/*
-		 * Remember to close out and nullify the current
-		 * meta-font and table, if applicable.
-		 */
-		if (tag == h->metaf)
-			h->metaf = NULL;
-		if (tag == h->tblt)
-			h->tblt = NULL;
-		print_ctag(h, tag->tag);
-		h->tags.head = tag->next;
-		free(tag);
+		print_ctag(h, tag);
 	}
 }
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

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

only message in thread, other threads:[~2014-12-20  0:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-20  0:20 mdocml: resolve some code duplication; no functional change 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).