From 76dc9ea5a21720683f71785b30d98572cdeffc41 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 3 Jan 2026 23:33:36 +0200
Subject: [PATCH 46/46] style.c: Replace parameter checking fc_asserts with
 nonnull attributes

See RM #1830

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 common/style.c | 6 ------
 common/style.h | 9 ++++++---
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/common/style.c b/common/style.c
index 5d8ccfc907..5d8aa00703 100644
--- a/common/style.c
+++ b/common/style.c
@@ -67,8 +67,6 @@ int style_count(void)
 **************************************************************************/
 int style_number(const struct nation_style *pstyle)
 {
-  fc_assert_ret_val(pstyle != nullptr, -1);
-
   return pstyle->id;
 }
 
@@ -77,8 +75,6 @@ int style_number(const struct nation_style *pstyle)
 **************************************************************************/
 int style_index(const struct nation_style *pstyle)
 {
-  fc_assert_ret_val(pstyle != nullptr, -1);
-
   return pstyle - styles;
 }
 
@@ -160,8 +156,6 @@ void music_styles_free(void)
 **************************************************************************/
 int music_style_number(const struct music_style *pms)
 {
-  fc_assert_ret_val(pms != nullptr, -1);
-
   return pms->id;
 }
 
diff --git a/common/style.h b/common/style.h
index 3d022d324f..d2e4a93de2 100644
--- a/common/style.h
+++ b/common/style.h
@@ -36,8 +36,10 @@ struct music_style
 void styles_alloc(int count);
 void styles_free(void);
 int style_count(void);
-int style_number(const struct nation_style *pstyle);
-int style_index(const struct nation_style *pstyle);
+int style_number(const struct nation_style *pstyle)
+  fc__attribute((nonnull(1)));
+int style_index(const struct nation_style *pstyle)
+  fc__attribute((nonnull(1)));
 struct nation_style *style_by_number(int id);
 const char *style_name_translation(const struct nation_style *pstyle);
 const char *style_rule_name(const struct nation_style *pstyle);
@@ -64,7 +66,8 @@ struct nation_style *style_by_rule_name(const char *name);
 void music_styles_alloc(int count);
 void music_styles_free(void);
 
-int music_style_number(const struct music_style *pms);
+int music_style_number(const struct music_style *pms)
+  fc__attribute((nonnull(1)));
 struct music_style *music_style_by_number(int id);
 
 struct music_style *player_music_style(struct player *plr);
-- 
2.51.0

