diff options
author | 2006-06-01 10:10:00 +0000 | |
---|---|---|
committer | 2006-06-01 10:10:00 +0000 | |
commit | bb37d5b740f2e8e745490724d252e082ee137e28 (patch) | |
tree | 2b706515c634e1a9522b0b4bb03a521e7efe6e30 | |
parent | Style. no practical change. (diff) | |
download | wireguard-openbsd-bb37d5b740f2e8e745490724d252e082ee137e28.tar.xz wireguard-openbsd-bb37d5b740f2e8e745490724d252e082ee137e28.zip |
kill another superfluous strlen
-rw-r--r-- | usr.bin/mg/random.c | 11 | ||||
-rw-r--r-- | usr.bin/mg/util.c | 11 |
2 files changed, 10 insertions, 12 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); } } diff --git a/usr.bin/mg/util.c b/usr.bin/mg/util.c index 18c6be2a221..fdea98a0d05 100644 --- a/usr.bin/mg/util.c +++ b/usr.bin/mg/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.19 2006/06/01 09:54:08 kjell Exp $ */ +/* $OpenBSD: util.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); } } |