summaryrefslogtreecommitdiffstats
path: root/tbl_layout.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-01-30 02:09:04 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-01-30 02:09:04 +0000
commitbba48934f08def48237c6f8c8f3f11d6e6d61944 (patch)
tree1801c761d155158b14223c4c46660b1082b9a217 /tbl_layout.c
parent35e9f47f34b339929e0d02faa183381045c2b46c (diff)
downloadmandoc-bba48934f08def48237c6f8c8f3f11d6e6d61944.tar.gz
Auditing the tbl(7) code for more NULL pointer accesses, i came out
empty-handed; so this is just KNF and some code simplifications, no functional change.
Diffstat (limited to 'tbl_layout.c')
-rw-r--r--tbl_layout.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tbl_layout.c b/tbl_layout.c
index 7d194bea..fbd0ebf8 100644
--- a/tbl_layout.c
+++ b/tbl_layout.c
@@ -326,9 +326,9 @@ cell_alloc(struct tbl_node *tbl, struct tbl_row *rp, enum tbl_cellt pos)
struct tbl_cell *p, *pp;
struct tbl_head *h, *hp;
- p = mandoc_calloc(1, sizeof(struct tbl_cell));
+ p = mandoc_calloc(1, sizeof(*p));
- if (NULL != (pp = rp->last)) {
+ if ((pp = rp->last) != NULL) {
pp->next = p;
h = pp->head->next;
} else {
@@ -341,15 +341,15 @@ cell_alloc(struct tbl_node *tbl, struct tbl_row *rp, enum tbl_cellt pos)
/* Re-use header. */
- if (h) {
+ if (h != NULL) {
p->head = h;
return(p);
}
- hp = mandoc_calloc(1, sizeof(struct tbl_head));
+ hp = mandoc_calloc(1, sizeof(*hp));
hp->ident = tbl->opts.cols++;
- if (tbl->last_head) {
+ if (tbl->last_head != NULL) {
hp->prev = tbl->last_head;
tbl->last_head->next = hp;
} else