From 1061fd5a54ef850aa1873eb128f4b1eb938d41d2 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Thu, 30 Nov 2023 16:02:44 +1400
Subject: [PATCH 166/181] move variable declaration out of loop

Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
 src/daemon/modules/runtime/isula/isula_rt_ops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/daemon/modules/runtime/isula/isula_rt_ops.c b/src/daemon/modules/runtime/isula/isula_rt_ops.c
index 753816f5..6a5e0125 100644
--- a/src/daemon/modules/runtime/isula/isula_rt_ops.c
+++ b/src/daemon/modules/runtime/isula/isula_rt_ops.c
@@ -564,6 +564,7 @@ out:
 
 static void transform_stats_info_from_runtime(shim_client_runtime_stats *stats, struct runtime_container_resources_stats_info *info)
 {
+    size_t i;
     if (stats == NULL || stats->data == NULL) {
         return;
     }
@@ -586,7 +587,7 @@ static void transform_stats_info_from_runtime(shim_client_runtime_stats *stats,
     if (blkio == NULL) {
         return;
     }
-    for (size_t i = 0; i < blkio->io_service_bytes_recursive_len; i++) {
+    for (i = 0; i < blkio->io_service_bytes_recursive_len; i++) {
         if (strcasecmp(blkio->io_service_bytes_recursive[i]->op, "read") == 0) {
             info->blkio_read += blkio->io_service_bytes_recursive[i]->value;
         }
-- 
2.42.0

