From 8df329c14e3a1ec095cd65850104bce25f4a2253 Mon Sep 17 00:00:00 2001 From: yar Date: Mon, 27 Nov 2006 15:11:30 +0000 Subject: [PATCH] + Drop useless initializers. + style(9). --- usr.bin/systat/convtbl.c | 19 +++++++------------ usr.bin/systat/ifcmds.c | 11 ++++++----- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/usr.bin/systat/convtbl.c b/usr.bin/systat/convtbl.c index b5c035fb38a9..2bfb9223c3fc 100644 --- a/usr.bin/systat/convtbl.c +++ b/usr.bin/systat/convtbl.c @@ -52,13 +52,11 @@ static struct convtbl * get_tbl_ptr(const u_long size, const u_int scale) { - struct convtbl *tbl_ptr = NULL; - u_long tmp = 0; - u_int idx = scale; + u_long tmp; + u_int idx; /* If our index is out of range, default to auto-scaling. */ - if (idx > SC_AUTO) - idx = SC_AUTO; + idx = scale < SC_AUTO ? scale : SC_AUTO; if (idx == SC_AUTO) /* @@ -71,17 +69,15 @@ get_tbl_ptr(const u_long size, const u_int scale) tmp >= MEGA && idx < SC_GIGABYTE; tmp >>= 10, idx++); - tbl_ptr = &convtbl[idx]; - return tbl_ptr; + return (&convtbl[idx]); } double convert(const u_long size, const u_int scale) { - struct convtbl *tp = NULL; + struct convtbl *tp; tp = get_tbl_ptr(size, scale); - return ((double)size * tp->mul / tp->scale); } @@ -89,9 +85,8 @@ convert(const u_long size, const u_int scale) const char * get_string(const u_long size, const u_int scale) { - struct convtbl *tp = NULL; + struct convtbl *tp; tp = get_tbl_ptr(size, scale); - - return tp->str; + return (tp->str); } diff --git a/usr.bin/systat/ifcmds.c b/usr.bin/systat/ifcmds.c index d65fe6f1d255..2b97d5e55e59 100644 --- a/usr.bin/systat/ifcmds.c +++ b/usr.bin/systat/ifcmds.c @@ -34,13 +34,14 @@ #include "extern.h" #include "convtbl.h" -int curscale = SC_AUTO; +int curscale = SC_AUTO; -static int selectscale(const char *); +static int selectscale(const char *); int ifcmd(const char *cmd, const char *args) { + if (prefix(cmd, "scale")) { if (*args != '\0' && selectscale(args) != -1) ; @@ -51,13 +52,13 @@ ifcmd(const char *cmd, const char *args) "gbit, gbyte, auto"); } } - return 1; + return (1); } static int selectscale(const char *args) { - int retval = 0; + int retval; #define streq(a,b) (strcmp(a,b) == 0) if (streq(args, "default") || streq(args, "auto")) @@ -77,5 +78,5 @@ selectscale(const char *args) else retval = -1; - return retval; + return (retval); }