Re: [PATCH 24/39] virStorageBackendZFSRefreshPool: Reduce scope of 'tokens'

2021-04-09 Thread Ján Tomko

On a Thursday in 2021, Peter Krempa wrote:

Declare it in the loop that actually uses it.

Signed-off-by: Peter Krempa 
---
src/storage/storage_backend_zfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: PGP signature


[PATCH 24/39] virStorageBackendZFSRefreshPool: Reduce scope of 'tokens'

2021-04-01 Thread Peter Krempa
Declare it in the loop that actually uses it.

Signed-off-by: Peter Krempa 
---
 src/storage/storage_backend_zfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/storage/storage_backend_zfs.c 
b/src/storage/storage_backend_zfs.c
index cab1fd1637..6fed25cf4d 100644
--- a/src/storage/storage_backend_zfs.c
+++ b/src/storage/storage_backend_zfs.c
@@ -216,7 +216,6 @@ virStorageBackendZFSRefreshPool(virStoragePoolObjPtr pool 
G_GNUC_UNUSED)
 size_t i;
 g_autoptr(virCommand) cmd = NULL;
 g_auto(GStrv) lines = NULL;
-g_auto(GStrv) tokens = NULL;
 g_autofree char *name = g_strdup(def->source.name);
 char *tmp;

@@ -246,13 +245,13 @@ virStorageBackendZFSRefreshPool(virStoragePoolObjPtr pool 
G_GNUC_UNUSED)
 goto cleanup;

 for (i = 0; lines[i]; i++) {
+g_auto(GStrv) tokens = NULL;
 size_t count;
 char *prop_name;

 if (STREQ(lines[i], ""))
 continue;

-g_strfreev(tokens);
 if (!(tokens = virStringSplitCount(lines[i], "\t", 0, )))
 goto cleanup;

-- 
2.29.2