summaryrefslogtreecommitdiff
path: root/0043-move-variable-declaration-out-of-loop.patch
blob: 26748eb02a383fbc8382dc1a11f26cd514156985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 261a924b656eea9eff2ca6cbdd611eb1f9555af7 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Thu, 30 Nov 2023 16:02:44 +1400
Subject: [PATCH 43/64] 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 1e2ecdb2..3950ff4a 100644
--- a/src/daemon/modules/runtime/isula/isula_rt_ops.c
+++ b/src/daemon/modules/runtime/isula/isula_rt_ops.c
@@ -612,6 +612,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;
     }
@@ -637,7 +638,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