[PATCH 2/4] virSCSIHostFindByPCI: Decrease scope of some variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/util/virscsihost.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virscsihost.c b/src/util/virscsihost.c
index 54ba9ddb9b..c816b21f64 100644
--- a/src/util/virscsihost.c
+++ b/src/util/virscsihost.c
@@ -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;
-- 
2.39.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux