From 5fb5aa3f40a6db8d19d3bc4f33cad413ad48a40d Mon Sep 17 00:00:00 2001 From: naddy Date: Thu, 20 Jan 2022 14:07:34 +0000 Subject: [PATCH] mg: fix -Wunused-but-set-variable warnings strtonum() is only called to verify that a string is numerical, the return value is unused. inlist is no longer used after the code was refactored. ok millert@ guenther@ --- usr.bin/mg/interpreter.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/usr.bin/mg/interpreter.c b/usr.bin/mg/interpreter.c index 320b4089849..92969394f48 100644 --- a/usr.bin/mg/interpreter.c +++ b/usr.bin/mg/interpreter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interpreter.c,v 1.32 2021/05/12 11:13:23 lum Exp $ */ +/* $OpenBSD: interpreter.c,v 1.33 2022/01/20 14:07:34 naddy Exp $ */ /* * This file is in the public domain. * @@ -492,9 +492,8 @@ multiarg(char *cmdp, char *argbuf, int numparams) if (!doregex(regs, argp)) { const char *errstr; - int iters; - iters = strtonum(argp, 0, INT_MAX, &errstr); + strtonum(argp, 0, INT_MAX, &errstr); if (errstr != NULL) return (dobeep_msgs("Var not found:", argp)); @@ -628,7 +627,7 @@ expandvals(char *cmdp, char *valp, char *bp) char *argp, *endp, *p, *v, *s = " "; char *regs; int spc, cnt; - int inlist, sizof, fin, inquote; + int sizof, fin, inquote; /* now find the first argument */ p = skipwhite(valp); @@ -637,7 +636,7 @@ expandvals(char *cmdp, char *valp, char *bp) return (dobeep_msg("strlcpy error")); argp = argbuf; spc = 1; /* initially fake a space so we find first argument */ - inlist = fin = inquote = cnt = spc = 0; + fin = inquote = cnt = spc = 0; for (p = argbuf; *p != '\0'; p++) { if (*(p + 1) == '\0') @@ -693,9 +692,8 @@ expandvals(char *cmdp, char *valp, char *bp) continue; } else { const char *errstr; - int iters; - iters = strtonum(argp, 0, INT_MAX, &errstr); + strtonum(argp, 0, INT_MAX, &errstr); if (errstr != NULL) return (dobeep_msgs("Var not found:", argp)); -- 2.20.1