diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-04-18 17:28:36 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-04-18 17:28:36 +0000 |
commit | afd3f3a3f381e6bd5e6803a730f57302dd9234d2 (patch) | |
tree | 8cc8dbdb77f13ddbce6fe2a22b8d3284143adbc5 /man.c | |
parent | 4534f390e036ac23ee5e8f0373ffb9f4d785a17d (diff) | |
download | mandoc-afd3f3a3f381e6bd5e6803a730f57302dd9234d2.tar.gz |
Unify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}().
Minus 80 lines of code, no functional change.
Written on the train from Koeln to Wolfsburg returning from p2k15.
Diffstat (limited to 'man.c')
-rw-r--r-- | man.c | 62 |
1 files changed, 0 insertions, 62 deletions
@@ -49,10 +49,8 @@ const char *const __man_macronames[MAN_MAX] = { const char * const *man_macronames = __man_macronames; -static void man_alloc1(struct roff_man *); static void man_breakscope(struct roff_man *, int); static void man_descope(struct roff_man *, int, int); -static void man_free1(struct roff_man *); static struct roff_node *man_node_alloc(struct roff_man *, int, int, enum roff_type, int); static void man_node_append(struct roff_man *, @@ -79,38 +77,6 @@ man_meta(const struct roff_man *man) } void -man_reset(struct roff_man *man) -{ - - man_free1(man); - man_alloc1(man); -} - -void -man_free(struct roff_man *man) -{ - - man_free1(man); - free(man); -} - -struct roff_man * -man_alloc(struct roff *roff, struct mparse *parse, - const char *defos, int quick) -{ - struct roff_man *p; - - p = mandoc_calloc(1, sizeof(*p)); - p->parse = parse; - p->defos = defos; - p->quick = quick; - p->roff = roff; - - man_alloc1(p); - return(p); -} - -void man_endparse(struct roff_man *man) { @@ -130,34 +96,6 @@ man_parseln(struct roff_man *man, int ln, char *buf, int offs) } static void -man_free1(struct roff_man *man) -{ - - if (man->first) - man_node_delete(man, man->first); - free(man->meta.title); - free(man->meta.os); - free(man->meta.date); - free(man->meta.vol); - free(man->meta.msec); -} - -static void -man_alloc1(struct roff_man *man) -{ - - memset(&man->meta, 0, sizeof(man->meta)); - man->macroset = MACROSET_MAN; - man->flags = 0; - man->last = mandoc_calloc(1, sizeof(*man->last)); - man->first = man->last; - man->last->type = ROFFT_ROOT; - man->last->tok = MAN_MAX; - man->next = ROFF_NEXT_CHILD; -} - - -static void man_node_append(struct roff_man *man, struct roff_node *p) { |