summaryrefslogtreecommitdiffstats
path: root/tbl_data.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-12-30 09:34:06 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-12-30 09:34:06 +0000
commite875ab2ae5330f3a0ed3e650ab2ea07460c2266a (patch)
tree594522ffb2684eb12a4f887266ea5a8eb5b9d576 /tbl_data.c
parentf3fd4f5f1744aff75c7c584aa1f72da4dfbfb016 (diff)
downloadmandoc-e875ab2ae5330f3a0ed3e650ab2ea07460c2266a.tar.gz
Move clean-up of parsed tbl nodes into the tbl_clear() function, called
once per invocation.
Diffstat (limited to 'tbl_data.c')
-rw-r--r--tbl_data.c16
1 files changed, 11 insertions, 5 deletions
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);
}