git: d4d797184967 - main - vmstat: remove shadow variables
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Jan 2023 02:53:04 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d4d79718496753493f059cb8f2b2e87e0b7019b0 commit d4d79718496753493f059cb8f2b2e87e0b7019b0 Author: Elliott Mitchell <ehem+freebsd@m5p.com> AuthorDate: 2022-09-21 02:18:23 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-01-20 02:51:12 +0000 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 --- usr.bin/vmstat/vmstat.c | 17 +++++++---------- 1 file 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;