summaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-12-20 00:20:11 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-12-20 00:20:11 +0000
commitd5da66336e312513b51e1424af9b9d2de63bc594 (patch)
tree0c7c78d75131d3e5797708408d767e1d5b399cba /html.c
parent04a689795a0d5b44eacb81cb022fc4806f18112d (diff)
downloadmandoc-d5da66336e312513b51e1424af9b9d2de63bc594.tar.gz
resolve some code duplication; no functional change
Diffstat (limited to 'html.c')
-rw-r--r--html.c44
1 files changed, 18 insertions, 26 deletions
diff --git a/html.c b/html.c
index 7368c841..0560d14e 100644
--- a/html.c
+++ b/html.c
@@ -121,7 +121,7 @@ static const char *const roffscales[SCALE_MAX] = {
};
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 tag,
}
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 tag *until)
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 tag *suntil)
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);
}
}