summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/tbl_term.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-01-30 02:08:37 +0000
committerschwarze <schwarze@openbsd.org>2015-01-30 02:08:37 +0000
commit21da0636bd40d3c948843f501b8bc6797c372fa7 (patch)
tree54f9536e84de1cbc7301a683721770994bbd70ab /usr.bin/mandoc/tbl_term.c
parentavoid more fatal/exit in the packet.c paths that ssh-keyscan (diff)
downloadwireguard-openbsd-21da0636bd40d3c948843f501b8bc6797c372fa7.tar.xz
wireguard-openbsd-21da0636bd40d3c948843f501b8bc6797c372fa7.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 '')
-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);