[prev in list] [next in list] [prev in thread] [next in thread]
List: mandoc-source
Subject: mdocml: eliminate one useless struct and one level of indirection; no
From: schwarze () mdocml ! bsd ! lv
Date: 2017-01-29 14:03:12
Message-ID: 17320428252617498344.enqueue () fantadrom ! bsd ! lv
[Download RAW message or body]
Log Message:
-----------
eliminate one useless struct and one level of indirection;
no functional change
Modified Files:
--------------
mdocml:
html.c
html.h
man_html.c
mdoc_html.c
Revision Data
-------------
Index: html.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/html.h,v
retrieving revision 1.79
retrieving revision 1.80
diff -Lhtml.h -Lhtml.h -u -p -r1.79 -r1.80
--- html.h
+++ 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 */
Index: html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/html.c,v
retrieving revision 1.203
retrieving revision 1.204
diff -Lhtml.c -Lhtml.c -u -p -r1.203 -r1.204
--- html.c
+++ html.c
@@ -132,7 +132,7 @@ html_alloc(const struct manoutput *outop
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
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 *t
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
{
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
{
struct tag *tag;
- while ((tag = h->tags.head) != NULL) {
+ while ((tag = h->tag) != NULL) {
if (suntil && tag == suntil)
return;
print_ctag(h, tag);
Index: man_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_html.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -Lman_html.c -Lman_html.c -u -p -r1.130 -r1.131
--- man_html.c
+++ 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);
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v
retrieving revision 1.263
retrieving revision 1.264
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.263 -r1.264
--- mdoc_html.c
+++ 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))
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic