From 1b89fa1814cd9ecfc564fc68e93ed94f2218cb8b Mon Sep 17 00:00:00 2001 From: Ibrar Ahmed Date: Thu, 9 Jun 2022 16:13:43 +0500 Subject: [PATCH] =?UTF-8?q?PG-289:=20Remove=20=E2=80=98for=E2=80=99=20loop?= =?UTF-8?q?=20initial=20declarations.=20(#256)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pg_stat_monitor.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index 38eea35..9f3c5e3 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -728,7 +728,7 @@ pgss_ExecutorCheckPerms(List *rt, bool abort) num_relations = 0; - foreach(lr, rt) + foreach(lr, rt) { RangeTblEntry *rte = lfirst(lr); if (rte->rtekind != RTE_RELATION) @@ -1664,11 +1664,15 @@ pg_stat_monitor_reset(PG_FUNCTION_ARGS) *(uint64 *)pgss_qbuf = 0; #ifdef BENCHMARK - for (int i = STATS_START; i < STATS_END; ++i) { - pg_hook_stats[i].min_time = 0; - pg_hook_stats[i].max_time = 0; - pg_hook_stats[i].total_time = 0; - pg_hook_stats[i].ncalls = 0; + { + int i; + for (i = STATS_START; i < STATS_END; ++i) + { + pg_hook_stats[i].min_time = 0; + pg_hook_stats[i].max_time = 0; + pg_hook_stats[i].total_time = 0; + pg_hook_stats[i].ncalls = 0; + } } #endif LWLockRelease(pgss->lock); @@ -3399,8 +3403,9 @@ pg_stat_monitor_settings(PG_FUNCTION_ARGS) if (conf->type == PGC_ENUM) { + size_t i; strcat(options, conf->guc_options[0]); - for (size_t i = 1; i < conf->n_options; ++i) + for (i = 1; i < conf->n_options; ++i) { strcat(options, ", "); strcat(options, conf->guc_options[i]);