From f8f41c8ba9eeaff471e08843964457f0d01e4973 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 16 Oct 2023 03:37:31 +0300 Subject: [PATCH 22/27] Fix dai_manage_cities() garbage "sellers[i]" warning Clang analyzer was giving false positive. See osdn #48677 Signed-off-by: Marko Lindqvist --- ai/default/daicity.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ai/default/daicity.c b/ai/default/daicity.c index 78c4a5f104..6e699bd396 100644 --- a/ai/default/daicity.c +++ b/ai/default/daicity.c @@ -871,10 +871,11 @@ void dai_manage_cities(struct ai_type *ait, struct player *pplayer) int i; /* Randomized order */ - i = 0; + count = 0; city_list_iterate(pplayer->cities, pcity) { - sellers[i++] = pcity; + sellers[count++] = pcity; } city_list_iterate_end; + for (i = 0; i < count; i++) { int replace = fc_rand(count); struct city *tmp; -- 2.42.0