summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/tbl_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-01-30 02:08:38 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-01-30 02:08:38 +0000
commitd04b6093e3c4e5d042715feb56796f9767e1c70e (patch)
treef96846e8c990e8d2d8433fe72a81544497e16b02 /usr.bin/mandoc/tbl_term.c
parent9a738b89a5f6d79df3a1193c1e448f3da3b6bd25 (diff)
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 'usr.bin/mandoc/tbl_term.c')
-rw-r--r--usr.bin/mandoc/tbl_term.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/mandoc/tbl_term.c b/usr.bin/mandoc/tbl_term.c
index 5dd8384c6e4..07ace637ec6 100644
--- a/usr.bin/mandoc/tbl_term.c
+++ b/usr.bin/mandoc/tbl_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tbl_term.c,v 1.22 2015/01/28 04:18:31 schwarze Exp $ */
+/* $OpenBSD: tbl_term.c,v 1.23 2015/01/30 02:08:37 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -260,11 +260,10 @@ tbl_data(struct termp *tp, const struct tbl_opts *opts,
const struct roffcol *col)
{
- if (NULL == dp) {
+ if (dp == NULL) {
tbl_char(tp, ASCII_NBRSP, col->width);
return;
}
- assert(dp->layout);
switch (dp->pos) {
case TBL_DATA_NONE:
@@ -394,8 +393,7 @@ tbl_number(struct termp *tp, const struct tbl_opts *opts,
psz = term_strlen(tp, buf);
- if (NULL != (cp = strrchr(dp->string, opts->decimal))) {
- buf[1] = '\0';
+ if ((cp = strrchr(dp->string, opts->decimal)) != NULL) {
for (ssz = 0, i = 0; cp != &dp->string[i]; i++) {
buf[0] = dp->string[i];
ssz += term_strlen(tp, buf);