diff options
author | Elliott Mitchell <ehem+freebsd@m5p.com> | 2022-09-21 02:18:23 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2023-01-20 02:51:12 +0000 |
commit | d4d79718496753493f059cb8f2b2e87e0b7019b0 (patch) | |
tree | 7b3e41747aa70e63e63876a7ecab97a9f1bea560 | |
parent | ad8feb1ed9996593df8b4b7259057c6e263aa130 (diff) | |
download | src-d4d79718496753493f059cb8f2b2e87e0b7019b0.tar.gz src-d4d79718496753493f059cb8f2b2e87e0b7019b0.zip |
vmstat: remove shadow variables
These appear to simply be the style of arguments are left untouched and
only local variables are modified. While some may prefer that style
this simply serves to complicate things as they're perfectly writeable.
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36628
-rw-r--r-- | usr.bin/vmstat/vmstat.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index 674ae2ab6728..07988da9d99d 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -1284,29 +1284,26 @@ static void print_intrcnts(unsigned long *intrcnts, unsigned long *old_intrcnts, char *intrnames, unsigned int nintr, size_t istrnamlen, long long period_ms) { - unsigned long *intrcnt, *old_intrcnt; - char *intrname; uint64_t inttotal, old_inttotal, total_count, total_rate; unsigned long count, rate; unsigned int i; inttotal = 0; old_inttotal = 0; - intrname = intrnames; xo_open_list("interrupt"); - for (i = 0, intrcnt=intrcnts, old_intrcnt=old_intrcnts; i < nintr; i++) { - if (intrname[0] != '\0' && (*intrcnt != 0 || aflag)) { - count = *intrcnt - *old_intrcnt; + for (i = 0; i < nintr; i++) { + if (intrnames[0] != '\0' && (*intrcnts != 0 || aflag)) { + count = *intrcnts - *old_intrcnts; rate = ((uint64_t)count * 1000 + period_ms / 2) / period_ms; xo_open_instance("interrupt"); xo_emit("{d:name/%-*s}{ket:name/%s} " "{:total/%20lu} {:rate/%10lu}\n", - (int)istrnamlen, intrname, intrname, count, rate); + (int)istrnamlen, intrnames, intrnames, count, rate); xo_close_instance("interrupt"); } - intrname += strlen(intrname) + 1; - inttotal += *intrcnt++; - old_inttotal += *old_intrcnt++; + intrnames += strlen(intrnames) + 1; + inttotal += *intrcnts++; + old_inttotal += *old_intrcnts++; } total_count = inttotal - old_inttotal; total_rate = (total_count * 1000 + period_ms / 2) / period_ms; |