aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit8ea5dc6d40c942157256ddd510bd3fa16cb44303 (patch)
tree79e6a90e244253f4314dc4dc3773abea58b3d267 /tbl_layout.c
parent8330e5fd370ea4633052bdaece49563be0db086b (diff)
downloadmandoc-8ea5dc6d40c942157256ddd510bd3fa16cb44303.tar.gz
mandoc-8ea5dc6d40c942157256ddd510bd3fa16cb44303.tar.zst
mandoc-8ea5dc6d40c942157256ddd510bd3fa16cb44303.zip
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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tbl_layout.c b/tbl_layout.c
index a2b5ef67..e22816f6 100644
--- a/tbl_layout.c
+++ b/tbl_layout.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_layout.c,v 1.35 2015/01/30 00:29:30 schwarze Exp $ */
+/* $Id: tbl_layout.c,v 1.36 2015/01/30 02:09:04 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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