summaryrefslogtreecommitdiff
path: root/usr.bin/mg/random.c
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2006-06-01 10:10:01 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2006-06-01 10:10:01 +0000
commitdbaf2c82d8a5bd6348a58df340f71d1f74fa43e3 (patch)
treef56a9f568445b23617c9731c320f8eba9603ebbe /usr.bin/mg/random.c
parent0650da8b2808113c6ed46b30b7cd63e087a5f191 (diff)
kill another superfluous strlen
Diffstat (limited to 'usr.bin/mg/random.c')
-rw-r--r--usr.bin/mg/random.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/mg/random.c b/usr.bin/mg/random.c
index 94bef74bf31..776fecabc6f 100644
--- a/usr.bin/mg/random.c
+++ b/usr.bin/mg/random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: random.c,v 1.19 2006/06/01 09:54:08 kjell Exp $ */
+/* $OpenBSD: random.c,v 1.20 2006/06/01 10:10:00 kjell Exp $ */
/* This file is in the public domain. */
@@ -75,6 +75,7 @@ int
getcolpos(void)
{
int col, i, c;
+ char tmp[5];
/* determine column */
col = 0;
@@ -90,12 +91,10 @@ getcolpos(void)
col++;
} else if (ISCTRL(c) != FALSE)
col += 2;
- else if (isprint(c))
+ else if (isprint(c)) {
col++;
- else {
- char tmp[5];
- snprintf(tmp, sizeof(tmp), "\\%o", c);
- col += strlen(tmp);
+ } else {
+ col += snprintf(tmp, sizeof(tmp), "\\%o", c);
}
}