From 2f22ec6293dece046e53dd4b67312b84661a3176 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 19:51:08 +0100 Subject: [PATCH] set.c: warning: variable 'result' is used uninitialized set.c:124:9: warning: variable 'result' is used uninitialized whenever 'if' condition is false clang18 -Wall warning cleanup [-Wsometimes-uninitialized] --- utils/set.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/utils/set.c b/utils/set.c index f82d8fd2..8c0637bd 100644 --- a/utils/set.c +++ b/utils/set.c @@ -101,7 +101,7 @@ SetNoisyBool(parm,valueS,file) char *valueS; FILE *file; { - int n, which, result; + int n, which, result = -2; /* Bool string Table */ static struct @@ -145,15 +145,19 @@ SetNoisyBool(parm,valueS,file) } else { - TxError("Unrecognized boolean value: \"%s\"\n", valueS); - TxError("Valid values are: "); - for (n = 0; boolStrings[n].bS_name; n++) - TxError(" %s", boolStrings[n].bS_name); - TxError("\n"); result = -2; } } + if (result == -2) + { + TxError("Unrecognized boolean value: \"%s\"\n", valueS); + TxError("Valid values are: "); + for (n = 0; boolStrings[n].bS_name; n++) + TxError(" %s", boolStrings[n].bS_name); + TxError("\n"); + } + /* Print parm value */ if(file) fprintf(file,"%8.8s ", *parm ? "YES" : "NO");