From 7f8e06527747f14fd50d9cc3b1121983771ff06b Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 27 Jan 2022 19:41:33 +0200 Subject: [PATCH 40/40] gcc-12: Fix "used uninitialized" warning in basic_city_style_for_style() See osdn #43713 Signed-off-by: Marko Lindqvist --- common/style.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/common/style.c b/common/style.c index e22ccf499a..61ca259447 100644 --- a/common/style.c +++ b/common/style.c @@ -210,11 +210,10 @@ int style_of_city(const struct city *pcity) **************************************************************************/ int basic_city_style_for_style(struct nation_style *pstyle) { - enum fc_tristate style_style; int i; for (i = game.control.styles_count - 1; i >= 0; i--) { - style_style = TRI_MAYBE; + enum fc_tristate style_style = TRI_MAYBE; requirement_vector_iterate(&city_styles[i].reqs, preq) { if (preq->source.kind == VUT_STYLE @@ -230,14 +229,10 @@ int basic_city_style_for_style(struct nation_style *pstyle) } requirement_vector_iterate_end; if (style_style == TRI_YES) { - break; + return i; } } - if (style_style == TRI_YES) { - return i; - } - return -1; } -- 2.34.1