From e875ab2ae5330f3a0ed3e650ab2ea07460c2266a Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 30 Dec 2010 09:34:06 +0000 Subject: Move clean-up of parsed tbl nodes into the tbl_clear() function, called once per invocation. --- tbl_data.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'tbl_data.c') diff --git a/tbl_data.c b/tbl_data.c index b50ce7f6..d5089d22 100644 --- a/tbl_data.c +++ b/tbl_data.c @@ -66,7 +66,7 @@ data(struct tbl *tbl, struct tbl_span *dp, dat->flags |= TBL_DATA_NDHORIZ; } -struct tbl_span * +int tbl_data(struct tbl *tbl, int ln, const char *p) { struct tbl_span *dp; @@ -76,21 +76,27 @@ tbl_data(struct tbl *tbl, int ln, const char *p) if ('\0' == p[pos]) { TBL_MSG(tbl, MANDOCERR_TBL, ln, pos); - return(NULL); + return(1); } dp = mandoc_calloc(1, sizeof(struct tbl_span)); + if (tbl->last_span) { + tbl->last_span->next = dp; + tbl->last_span = dp; + } else + tbl->last_span = tbl->first_span = dp; + if ( ! strcmp(p, "_")) { dp->flags |= TBL_SPAN_HORIZ; - return(dp); + return(1); } else if ( ! strcmp(p, "=")) { dp->flags |= TBL_SPAN_DHORIZ; - return(dp); + return(1); } while ('\0' != p[pos]) data(tbl, dp, ln, p, &pos); - return(dp); + return(1); } -- cgit