git: 0325cd325deb - stable/14 - sndctl(8): Remove unnecessary val variable from sysctl functions

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Thu, 22 May 2025 18:24:36 UTC
The branch stable/14 has been updated by christos:

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

commit 0325cd325debb26b922c26425a3cc6bc4bcc3896
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-05-21 19:31:17 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-05-22 18:24:28 +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
    
    (cherry picked from commit ac86e65e0e25a3e3fd6f91b17d2db874cea83c3b)
---
 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. */