From a80ba80891173aa7afae1c00dc23720f39b0af28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 2 Apr 2019 10:57:19 +0100 Subject: [PATCH] examples: avoid goto jump over initialization of variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Jumping over the declaration and initialization of a variable is bad as it means the jump target sees a potentially non-initialized variable. Reviewed-by: Ján Tomko Signed-off-by: Daniel P. Berrangé --- examples/admin/client_limits.c | 2 +- examples/admin/threadpool_params.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/admin/client_limits.c b/examples/admin/client_limits.c index 69b931682c..fb29ee6cbf 100644 --- a/examples/admin/client_limits.c +++ b/examples/admin/client_limits.c @@ -9,6 +9,7 @@ int main(int argc, char **argv) virAdmServerPtr srv = NULL; /* which server to work with */ virTypedParameterPtr params = NULL; int nparams = 0; + int maxparams = 0; ssize_t i; if (argc != 2) { @@ -39,7 +40,6 @@ int main(int argc, char **argv) nparams = 0; /* set nclients_max to 100 and nclients_unauth_max to 20 */ - int maxparams = 0; if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, VIR_SERVER_CLIENTS_MAX, 100) < 0 || virTypedParamsAddUInt(¶ms, &nparams, &maxparams, diff --git a/examples/admin/threadpool_params.c b/examples/admin/threadpool_params.c index be833c2ea3..8e6354576f 100644 --- a/examples/admin/threadpool_params.c +++ b/examples/admin/threadpool_params.c @@ -9,6 +9,7 @@ int main(int argc, char **argv) virAdmServerPtr srv = NULL; /* which server to work with */ virTypedParameterPtr params = NULL; int nparams = 0; + int maxparams = 0; ssize_t i; if (argc != 2) { @@ -39,7 +40,6 @@ int main(int argc, char **argv) nparams = 0; /* let's set minWorkers to 10, maxWorkers to 15 and prioWorkers to 10 */ - int maxparams = 0; if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, VIR_THREADPOOL_WORKERS_MIN, 10) < 0 || virTypedParamsAddUInt(¶ms, &nparams, &maxparams, -- 2.47.2