From nobody Fri Jan 20 02:53:04 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NykZT1Hy6z2v8W0; Fri, 20 Jan 2023 02:53:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NykZT0WhNz3ksm; Fri, 20 Jan 2023 02:53:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674183185; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kH/QdqziyEKu5XQeLqTjZ19wp43T6RbViFYDrMqLjHU=; b=aMMlp6WAXk6/Z25OCBTAlru1eHSdSPq0hRUef+Hho3f/Tdt5NSPER8zhOsFEJdzkyMpus2 yvhZ7KsXAQ0A2NZBunn2FrzUvyYDQiv7JtUGn3Lbg1YjIT1jWH6RgKL1lPGB//yyoamEyy Cdp4d3LQlyy/0R9ncRkpHhgYiH5j/cwOvWe001tMw7XDWNkZ7ct3hXINZSQciMACpQSU4j 0ZjxUmDGl3DD7tjGPuSUhaP3vaLZAPhAzoLQ6jvHLu+gtHIlZgdqHONY9kJNfXcYyBrmGl fGD70LYkSPoKhjrItUSWhLZ0JxfitedXl8rECZyVE4mSj1ivMTsbT5bfUgZGRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674183185; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kH/QdqziyEKu5XQeLqTjZ19wp43T6RbViFYDrMqLjHU=; b=o3xZqxCfDukSDmP0ewqWR/akjTJyNTPbtaUXLDkno5OsteEDYCX3E456Mb89YvLvMQtQjb z+u7tUPA1TH+90GeNDXYVU/9Us5d/6VsZDtsDUuUWAGYWWiVuGNvqDJ53CPkr9zyDz18no Te/DiPXqzhwuqM58bqH+4++C+4yFdxH1zzF9j5mZnWVws+thX0mwqLE81ibP96mlLL/iUm IFRD/Eday/c26vV35aCU7rE2+verl61wNZv+Naa3mI7mvbpCPntuBlfJsO/biBLwhpxjGV JQ7FYRHg2QfugERQIHxJd+U797OtSfPIYN9Id//Id/fjZRjGRNJQvvN1HAAygQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674183185; a=rsa-sha256; cv=none; b=QLVYiAyBK7khNJMBrknqv0mkiROmM+6ql7v4KqsEHKM/6wg0XlnOBr4zVJWIBgsj8dAby4 OI5Rm9KfZan1shImotqyGPP1K0rQMIvxkVt8XRCs2nWLj4gyFQTPaiepq53jI66RQfNZkq 0LZ6ioOtdVMnNlDZiBiZU525dT9lGMP1OEm7hfQ8zbKYX/MWHgDAIW/TQ8WjMOSOsvWJmT i3FFPp5Fq8D9ohnlgMmUz9It1a2KpYom7lkUW+9NrQvUm4uMlyR6IbujYK7HHdQm97FVHb zH03EZPOQ+7x0RseZztQgH8+lZnScXd8STXbP8xPlecVlNI7KJmv+ElIkj8qTg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NykZS6ZT8zDmK; Fri, 20 Jan 2023 02:53:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30K2r4Vc097286; Fri, 20 Jan 2023 02:53:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30K2r4Tb097285; Fri, 20 Jan 2023 02:53:04 GMT (envelope-from git) Date: Fri, 20 Jan 2023 02:53:04 GMT Message-Id: <202301200253.30K2r4Tb097285@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d4d797184967 - main - vmstat: remove shadow variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4d79718496753493f059cb8f2b2e87e0b7019b0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d4d79718496753493f059cb8f2b2e87e0b7019b0 commit d4d79718496753493f059cb8f2b2e87e0b7019b0 Author: Elliott Mitchell AuthorDate: 2022-09-21 02:18:23 +0000 Commit: Konstantin Belousov 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;