=================================================================== RCS file: /cvs/mandoc/tbl.c,v retrieving revision 1.39 retrieving revision 1.43 diff -u -p -r1.39 -r1.43 --- mandoc/tbl.c 2015/01/30 17:32:16 1.39 +++ mandoc/tbl.c 2018/12/12 21:54:35 1.43 @@ -1,4 +1,4 @@ -/* $Id: tbl.c,v 1.39 2015/01/30 17:32:16 schwarze Exp $ */ +/* $Id: tbl.c,v 1.43 2018/12/12 21:54:35 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011, 2015 Ingo Schwarze @@ -25,13 +25,14 @@ #include #include -#include "mandoc.h" #include "mandoc_aux.h" +#include "mandoc.h" +#include "tbl.h" #include "libmandoc.h" #include "libroff.h" -enum rofferr +void tbl_read(struct tbl_node *tbl, int ln, const char *p, int pos) { const char *cp; @@ -66,7 +67,7 @@ tbl_read(struct tbl_node *tbl, int ln, const char *p, if (*cp == ';') { tbl_option(tbl, ln, p, &pos); if (p[pos] == '\0') - return(ROFF_IGN); + return; } } @@ -75,15 +76,14 @@ tbl_read(struct tbl_node *tbl, int ln, const char *p, switch (tbl->part) { case TBL_PART_LAYOUT: tbl_layout(tbl, ln, p, pos); - return(ROFF_IGN); + break; case TBL_PART_CDATA: - return(tbl_cdata(tbl, ln, p, pos) ? ROFF_TBL : ROFF_IGN); + tbl_cdata(tbl, ln, p, pos); + break; default: + tbl_data(tbl, ln, p, pos); break; } - - tbl_data(tbl, ln, p, pos); - return(ROFF_TBL); } struct tbl_node * @@ -98,7 +98,7 @@ tbl_alloc(int pos, int line, struct mparse *parse) tbl->part = TBL_PART_OPTS; tbl->opts.tab = '\t'; tbl->opts.decimal = '.'; - return(tbl); + return tbl; } void @@ -114,6 +114,7 @@ tbl_free(struct tbl_node *tbl) while (rp->first != NULL) { cp = rp->first; rp->first = cp->next; + free(cp->wstr); free(cp); } free(rp); @@ -155,18 +156,14 @@ tbl_span(struct tbl_node *tbl) : tbl->first_span; if (span) tbl->current_span = span; - return(span); + return span; } int -tbl_end(struct tbl_node **tblp) +tbl_end(struct tbl_node *tbl) { - struct tbl_node *tbl; struct tbl_span *sp; - tbl = *tblp; - *tblp = NULL; - if (tbl->part == TBL_PART_CDATA) mandoc_msg(MANDOCERR_TBLDATA_BLK, tbl->parse, tbl->line, tbl->pos, "TE"); @@ -177,7 +174,7 @@ tbl_end(struct tbl_node **tblp) if (sp == NULL) { mandoc_msg(MANDOCERR_TBLDATA_NONE, tbl->parse, tbl->line, tbl->pos, NULL); - return(0); + return 0; } - return(1); + return 1; }