aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-01-29 14:02:41 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-01-29 14:02:41 +0000
commit6c8b3ba49c51760959b4a79eeab51af6d3c58565 (patch)
treedeb3073e4c3f988bd8db654066e65c4b75acc011
parent5a526843b7a81102e56a684b368893853ed01ee7 (diff)
downloadmandoc-6c8b3ba49c51760959b4a79eeab51af6d3c58565.tar.gz
mandoc-6c8b3ba49c51760959b4a79eeab51af6d3c58565.tar.zst
mandoc-6c8b3ba49c51760959b4a79eeab51af6d3c58565.zip
eliminate one useless struct and one level of indirection;
no functional change
-rw-r--r--html.c20
-rw-r--r--html.h8
-rw-r--r--man_html.c6
-rw-r--r--mdoc_html.c6
4 files changed, 18 insertions, 22 deletions
diff --git a/html.c b/html.c
index c3ab3b47..8f1e3df4 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.203 2017/01/28 22:36:38 schwarze Exp $ */
+/* $Id: html.c,v 1.204 2017/01/29 14:02:41 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -132,7 +132,7 @@ html_alloc(const struct manoutput *outopts)
h = mandoc_calloc(1, sizeof(struct html));
- h->tags.head = NULL;
+ h->tag = NULL;
h->style = outopts->style;
h->base_man = outopts->man;
h->base_includes = outopts->includes;
@@ -150,8 +150,8 @@ html_free(void *p)
h = (struct html *)p;
- while ((tag = h->tags.head) != NULL) {
- h->tags.head = tag->next;
+ while ((tag = h->tag) != NULL) {
+ h->tag = tag->next;
free(tag);
}
@@ -455,13 +455,13 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
tflags = htmltags[tag].flags;
- /* Push this tags onto the stack of open scopes. */
+ /* Push this tag onto the stack of open scopes. */
if ((tflags & HTML_NOSTACK) == 0) {
t = mandoc_malloc(sizeof(struct tag));
t->tag = tag;
- t->next = h->tags.head;
- h->tags.head = t;
+ t->next = h->tag;
+ h->tag = t;
} else
t = NULL;
@@ -699,7 +699,7 @@ print_ctag(struct html *h, struct tag *tag)
if (tflags & HTML_NLAFTER)
print_endline(h);
- h->tags.head = tag->next;
+ h->tag = tag->next;
free(tag);
}
@@ -760,7 +760,7 @@ print_tagq(struct html *h, const struct tag *until)
{
struct tag *tag;
- while ((tag = h->tags.head) != NULL) {
+ while ((tag = h->tag) != NULL) {
print_ctag(h, tag);
if (until && tag == until)
return;
@@ -772,7 +772,7 @@ print_stagq(struct html *h, const struct tag *suntil)
{
struct tag *tag;
- while ((tag = h->tags.head) != NULL) {
+ while ((tag = h->tag) != NULL) {
if (suntil && tag == suntil)
return;
print_ctag(h, tag);
diff --git a/html.h b/html.h
index a393ff62..7b2de501 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.79 2017/01/26 18:28:18 schwarze Exp $ */
+/* $Id: html.h,v 1.80 2017/01/29 14:02:42 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -78,10 +78,6 @@ struct tag {
enum htmltag tag;
};
-struct tagq {
- struct tag *head;
-};
-
struct html {
int flags;
#define HTML_NOSPACE (1 << 0) /* suppress next space */
@@ -100,7 +96,7 @@ struct html {
size_t col; /* current output byte position */
size_t bufcol; /* current buf byte position */
char buf[80]; /* output buffer */
- struct tagq tags; /* stack of open tags */
+ struct tag *tag; /* last open tag */
struct rofftbl tbl; /* current table */
struct tag *tblt; /* current open table scope */
char *base_man; /* base for manpage href */
diff --git a/man_html.c b/man_html.c
index 804859f8..0a3f5790 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.130 2017/01/26 18:28:18 schwarze Exp $ */
+/* $Id: man_html.c,v 1.131 2017/01/29 14:02:42 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -197,7 +197,7 @@ print_man_node(MAN_ARGS)
struct tag *t;
child = 1;
- t = h->tags.head;
+ t = h->tag;
if (t == mh->nofill)
t = t->next;
@@ -240,7 +240,7 @@ print_man_node(MAN_ARGS)
*/
if (h->tblt) {
print_tblclose(h);
- t = h->tags.head;
+ t = h->tag;
}
if (mans[n->tok].pre)
child = (*mans[n->tok].pre)(man, n, mh, h);
diff --git a/mdoc_html.c b/mdoc_html.c
index eb35507e..b32aaaf3 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.263 2017/01/28 22:36:38 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.264 2017/01/29 14:02:42 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -349,7 +349,7 @@ print_mdoc_node(MDOC_ARGS)
return;
child = 1;
- t = h->tags.head;
+ t = h->tag;
n->flags &= ~NODE_ENDED;
switch (n->type) {
@@ -389,7 +389,7 @@ print_mdoc_node(MDOC_ARGS)
*/
if (h->tblt != NULL) {
print_tblclose(h);
- t = h->tags.head;
+ t = h->tag;
}
assert(h->tblt == NULL);
if (mdocs[n->tok].pre && (n->end == ENDBODY_NOT || n->child))