summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2006-11-27 15:11:30 +0000
committeryar <yar@FreeBSD.org>2006-11-27 15:11:30 +0000
commit8df329c14e3a1ec095cd65850104bce25f4a2253 (patch)
treed06c237cc4b79e8bb240117148d43618f02db524 /usr.bin/systat
parent9216efaa4a10ce991d12f10167d08e00abf11434 (diff)
downloadFreeBSD-src-8df329c14e3a1ec095cd65850104bce25f4a2253.zip
FreeBSD-src-8df329c14e3a1ec095cd65850104bce25f4a2253.tar.gz
+ Drop useless initializers.
+ style(9).
Diffstat (limited to 'usr.bin/systat')
-rw-r--r--usr.bin/systat/convtbl.c19
-rw-r--r--usr.bin/systat/ifcmds.c11
2 files changed, 13 insertions, 17 deletions
diff --git a/usr.bin/systat/convtbl.c b/usr.bin/systat/convtbl.c
index b5c035f..2bfb922 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 d65fe6f..2b97d5e 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);
}
OpenPOWER on IntegriCloud