]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
remote: stop declaring variables in the middle of a function
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 3 Jul 2019 17:52:32 +0000 (18:52 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 5 Jul 2019 17:27:16 +0000 (18:27 +0100)
The doRemoteOpen method was a little unusual in declaring a bunch of
local variables in the middle of the function. Move them to the top as
it is normal libvirt style.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/remote/remote_driver.c

index 97d9d5fa88a5be90e0038c7c8a0be255bf9f66b9..86f061825aa7124441417cbf38b56ea203a2126b 100644 (file)
@@ -789,6 +789,22 @@ doRemoteOpen(virConnectPtr conn,
     char *daemonPath = NULL;
 #endif
     char *tls_priority = NULL;
+    char *name = NULL;
+    char *command = NULL;
+    char *sockname = NULL;
+    char *netcat = NULL;
+    char *port = NULL;
+    char *authtype = NULL;
+    char *username = NULL;
+    char *pkipath = NULL;
+    char *keyfile = NULL;
+    char *sshauth = NULL;
+    char *knownHostsVerify = NULL;
+    char *knownHosts = NULL;
+    bool sanity = true;
+    bool verify = true;
+    bool tty ATTRIBUTE_UNUSED = true;
+    int retcode = VIR_DRV_OPEN_ERROR;
 
     /* We handle *ALL* URIs here. The caller has rejected any
      * URIs we don't care about */
@@ -848,18 +864,6 @@ doRemoteOpen(virConnectPtr conn,
         return VIR_DRV_OPEN_ERROR;
     }
 
-    /* Local variables which we will initialize. These can
-     * get freed in the failed: path.
-     */
-    char *name = NULL, *command = NULL, *sockname = NULL, *netcat = NULL;
-    char *port = NULL, *authtype = NULL, *username = NULL;
-    bool sanity = true, verify = true, tty ATTRIBUTE_UNUSED = true;
-    char *pkipath = NULL, *keyfile = NULL, *sshauth = NULL;
-
-    char *knownHostsVerify = NULL,  *knownHosts = NULL;
-
-    /* Return code from this function, and the private data. */
-    int retcode = VIR_DRV_OPEN_ERROR;
 
     /* Remote server defaults to "localhost" if not specified. */
     if (conn->uri && conn->uri->port != 0) {