From 8ea5dc6d40c942157256ddd510bd3fa16cb44303 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 30 Jan 2015 02:09:04 +0000 Subject: 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. --- tbl_layout.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tbl_layout.c') 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 * Copyright (c) 2012, 2014, 2015 Ingo Schwarze @@ -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 -- cgit v1.2.3-56-ge451