From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 6553cae7; for ; Fri, 19 Dec 2014 19:20:41 -0500 (EST) Date: Fri, 19 Dec 2014 19:20:41 -0500 (EST) Message-Id: <14260060653827144603.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: resolve some code duplication; no functional change X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 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("", 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("", 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