From b97c5073be3e0b1a3ae3d43c36df1c9edf33d556 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 8 Jul 2022 01:30:40 +0300 Subject: [PATCH 51/51] Move initial variable declarations out from 'for' in C-code See osdn #45056 Signed-off-by: Marko Lindqvist --- server/unithand.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/unithand.c b/server/unithand.c index 054db9b789..3ee22eec21 100644 --- a/server/unithand.c +++ b/server/unithand.c @@ -285,8 +285,9 @@ non_allied_not_listed_at(const struct player *pplayer, if (!pplayers_allied(pplayer, unit_owner(punit))) { bool listed = FALSE; int id = punit->id; + int i; - for (int i = 0; i < n; i++) { + for (i = 0; i < n; i++) { if (id == list[i]) { listed = TRUE; break; @@ -320,6 +321,7 @@ static bool do_capture_units(struct player *pplayer, int id, hcity; int n = 0, capt[unit_list_size(pdesttile->units)]; bool lost_with_city = FALSE; + int i; /* Sanity check: The actor still exists. */ fc_assert_ret_val(pplayer, FALSE); @@ -381,7 +383,8 @@ static bool do_capture_units(struct player *pplayer, /* Rarely, we'll need it... */ sz_strlcpy(hcity_name, city_name_get(game_city_by_number(hcity))); } - for (int i = 0; i < n; i++) { + + for (i = 0; i < n; i++) { struct unit *to_capture = game_unit_by_number(capt[i]); struct player *uplayer; const char *victim_link; -- 2.35.1