]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virSCSIHostFindByPCI: Decrease scope of some variables
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Mar 2023 07:52:32 +0000 (08:52 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Mar 2023 11:02:43 +0000 (12:02 +0100)
Inside of virSCSIHostFindByPCI() there're some variables that are
used from a while() loop exclusively. Bring their declaration
into the loop.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virscsihost.c

index 54ba9ddb9b56f7b850cd23e3ea1de6aee2cd0ce2..c816b21f64d47bb450a01517aadc10fbc50a09d9 100644 (file)
@@ -95,9 +95,7 @@ virSCSIHostFindByPCI(const char *sysfs_prefix,
     const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_HOST_PATH;
     struct dirent *entry = NULL;
     g_autoptr(DIR) dir = NULL;
-    char *p = NULL;
     char *ret = NULL;
-    unsigned int read_unique_id;
 
     if (virDirOpen(&dir, prefix) < 0)
         return NULL;
@@ -107,6 +105,8 @@ virSCSIHostFindByPCI(const char *sysfs_prefix,
         g_autofree char *host_path = NULL;
         g_autofree char *unique_path = NULL;
         g_autofree char *buf = NULL;
+        char *p = NULL;
+        unsigned int read_unique_id;
 
         if (!virFileIsLink(entry->d_name))
             continue;