source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: resolve some code duplication; no functional change
Date: Fri, 19 Dec 2014 19:20:41 -0500 (EST)	[thread overview]
Message-ID: <14260060653827144603.enqueue@fantadrom.bsd.lv> (raw)

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

                 reply	other threads:[~2014-12-20  0:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14260060653827144603.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).