]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
examples: avoid goto jump over initialization of variable
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 2 Apr 2019 09:57:19 +0000 (10:57 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 5 Apr 2019 14:33:25 +0000 (15:33 +0100)
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 <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
examples/admin/client_limits.c
examples/admin/threadpool_params.c

index 69b931682c6897e1d8b7f83a25c22fce00df4dcd..fb29ee6cbf9c6cea47c1dbf6ab62d7fef1036248 100644 (file)
@@ -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(&params, &nparams, &maxparams,
                               VIR_SERVER_CLIENTS_MAX, 100) < 0 ||
         virTypedParamsAddUInt(&params, &nparams, &maxparams,
index be833c2ea3068f42f594887250fcea7a1760c8e7..8e6354576f958256eb647bccd8fae13e67680184 100644 (file)
@@ -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(&params, &nparams, &maxparams,
                               VIR_THREADPOOL_WORKERS_MIN, 10) < 0 ||
         virTypedParamsAddUInt(&params, &nparams, &maxparams,