+ Drop useless initializers.

+ style(9).
This commit is contained in:
Yaroslav Tykhiy 2006-11-27 15:11:30 +00:00
parent ce1bff762d
commit f301488570
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164669
2 changed files with 13 additions and 17 deletions

View File

@ -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);
}

View File

@ -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);
}