mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
Improve style:
- Don't define vars inside loops. - Avoid useless casts. - Use C idioms. - Do alike things in a consistent way.
This commit is contained in:
parent
aee701a96e
commit
c1b118da86
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=165495
@ -159,14 +159,13 @@ labelswap()
|
||||
void
|
||||
showswap()
|
||||
{
|
||||
int count;
|
||||
int i;
|
||||
|
||||
if (kvnsw != okvnsw || ulen != oulen)
|
||||
labelswap();
|
||||
|
||||
for (i = 0; i <= kvnsw; ++i) {
|
||||
int count;
|
||||
|
||||
if (i == kvnsw) {
|
||||
if (kvnsw == 1)
|
||||
break;
|
||||
@ -184,26 +183,13 @@ showswap()
|
||||
|
||||
wmove(wnd, i + 1, 5);
|
||||
|
||||
wprintw(
|
||||
wnd,
|
||||
"%*d",
|
||||
hlen,
|
||||
CONVERT(kvmsw[i].ksw_total)
|
||||
);
|
||||
wprintw(wnd, "%*d", hlen, CONVERT(kvmsw[i].ksw_total));
|
||||
wprintw(wnd, "%*d", ulen, CONVERT(kvmsw[i].ksw_used));
|
||||
|
||||
wprintw(
|
||||
wnd,
|
||||
"%*d ",
|
||||
ulen,
|
||||
CONVERT(kvmsw[i].ksw_used)
|
||||
);
|
||||
count = (double)kvmsw[i].ksw_used * 49.999 / kvmsw[i].ksw_total;
|
||||
|
||||
count = (int)((double)kvmsw[i].ksw_used * 49.999 /
|
||||
(double)kvmsw[i].ksw_total);
|
||||
|
||||
while (count >= 0) {
|
||||
waddch(wnd, ' ');
|
||||
while (count--)
|
||||
waddch(wnd, 'X');
|
||||
--count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user