aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tbl_data.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-01-10 15:31:00 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-01-10 15:31:00 +0000
commit8532b513ad046c8c7407add6f29b742c717bb60e (patch)
tree2588a006e07be8d5cf42947d412dfab7d92ac586 /tbl_data.c
parentbf4bddcd274b710f5c5b77eb76f1d129507f43de (diff)
downloadmandoc-8532b513ad046c8c7407add6f29b742c717bb60e.tar.gz
mandoc-8532b513ad046c8c7407add6f29b742c717bb60e.tar.zst
mandoc-8532b513ad046c8c7407add6f29b742c717bb60e.zip
Clarify what members may be NULL or not in calculating widths. Make
sure signedness is correct. Verify that layouts MUST exit for data cells.
Diffstat (limited to 'tbl_data.c')
-rw-r--r--tbl_data.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tbl_data.c b/tbl_data.c
index e30f1959..e68cd4a7 100644
--- a/tbl_data.c
+++ b/tbl_data.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_data.c,v 1.17 2011/01/10 14:56:06 kristaps Exp $ */
+/* $Id: tbl_data.c,v 1.18 2011/01/10 15:31:00 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -188,8 +188,6 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p)
* If there's no last parsed span, use the first row. Lastly,
* if the last span was a horizontal line, use the same layout
* (it doesn't "consume" the layout).
- *
- * In the end, this can be NULL!
*/
if (tbl->last_span) {
@@ -198,11 +196,14 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p)
rp = tbl->last_span->layout->next;
else
rp = tbl->last_span->layout;
+
if (NULL == rp)
rp = tbl->last_span->layout;
} else
rp = tbl->first_row;
+ assert(rp);
+
dp = mandoc_calloc(1, sizeof(struct tbl_span));
dp->tbl = &tbl->opts;
dp->layout = rp;