git: ac86e65e0e25 - main - sndctl(8): Remove unnecessary val variable from sysctl functions

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Wed, 21 May 2025 19:31:35 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=ac86e65e0e25a3e3fd6f91b17d2db874cea83c3b

commit ac86e65e0e25a3e3fd6f91b17d2db874cea83c3b
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-05-21 19:31:17 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-05-21 19:31:17 +0000

    sndctl(8): Remove unnecessary val variable from sysctl functions
    
    No functional change intended.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 day
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D50397
---
 usr.sbin/sndctl/sndctl.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/usr.sbin/sndctl/sndctl.c b/usr.sbin/sndctl/sndctl.c
index f362ce840cf7..412ea33e5adf 100644
--- a/usr.sbin/sndctl/sndctl.c
+++ b/usr.sbin/sndctl/sndctl.c
@@ -662,12 +662,11 @@ static int
 sysctl_int(const char *buf, const char *arg, int *var)
 {
 	size_t size;
-	const char *val = arg;
 	int n, prev;
 
-	n = strtol(val, NULL, 10);
+	n = strtol(arg, NULL, 10);
 	if (errno == EINVAL || errno == ERANGE) {
-		warn("strtol(%s)", val);
+		warn("strtol(%s)", arg);
 		return (-1);
 	}
 
@@ -699,7 +698,6 @@ static int
 sysctl_str(const char *buf, const char *arg, char *var, size_t varsz)
 {
 	size_t size;
-	const char *val = arg;
 	char prev[BUFSIZ];
 	char *tmp;
 
@@ -710,10 +708,10 @@ sysctl_str(const char *buf, const char *arg, char *var, size_t varsz)
 		return (-1);
 	}
 
-	size = strlen(val);
+	size = strlen(arg);
 	/* Apply new value. */
-	if (sysctlbyname(buf, NULL, 0, val, size) < 0) {
-		warn("sysctlbyname(%s, %s)", buf, val);
+	if (sysctlbyname(buf, NULL, 0, arg, size) < 0) {
+		warn("sysctlbyname(%s, %s)", buf, arg);
 		return (-1);
 	}
 	/* Get size of new string. */