summaryrefslogtreecommitdiffstats
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
commitdb2b5ef38c2f1862472b7a9ccf6af9dac7551eb5 (patch)
tree3f3a6bdeb2d0dab4e7c08287757b51d9d55e465f
parent137b7894f98df8048a9fb82e36cc9c8c65efcc65 (diff)
downloadmandoc-db2b5ef38c2f1862472b7a9ccf6af9dac7551eb5.tar.gz
eliminate one useless struct and one level of indirection;
no functional change
-rw-r--r--html.c18
-rw-r--r--html.h6
-rw-r--r--man_html.c4
-rw-r--r--mdoc_html.c4
4 files changed, 14 insertions, 18 deletions
diff --git a/html.c b/html.c
index 0ce50710..0e67a905 100644
--- a/html.c
+++ b/html.c
@@ -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 364da4ac..10434e44 100644
--- a/html.h
+++ b/html.h
@@ -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 a5147e06..28a403ae 100644
--- a/man_html.c
+++ b/man_html.c
@@ -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 158c1e7f..ecb72f7e 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -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))