From 8f35e33a2eb0a64205b75ac3b01c88e528fcfdd0 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 21 Jan 2024 09:48:36 -0500 Subject: [PATCH] follow-up nonnull in u_init.c u_init.c had had assessments for nonnull arguments on its local functions carried out already. A couple of new static functions added earlier today immediately dereference their args, so declare those as nonnull. This also gives a more self-describing name to one arg. --- src/u_init.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/u_init.c b/src/u_init.c index bce12df6a..19acf7588 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -14,9 +14,11 @@ struct trobj { }; static struct obj *ini_inv_mkobj_filter(int, boolean); -static short ini_inv_obj_substitution(struct trobj *, struct obj *); -static void ini_inv_adjust_obj(struct trobj *, struct obj *); -static void ini_inv_use_obj(struct obj *); +static short ini_inv_obj_substitution(struct trobj *, + struct obj *) NONNULLPTRS; +static void ini_inv_adjust_obj(struct trobj *, + struct obj *) NONNULLPTRS; +static void ini_inv_use_obj(struct obj *) NONNULLARG1; static void ini_inv(struct trobj *) NONNULLARG1; static void knows_object(int); static void knows_class(char); @@ -1027,7 +1029,7 @@ restricted_spell_discipline(int otyp) /* create random object of certain class, filtering out too powerful items */ static struct obj * -ini_inv_mkobj_filter(int oclass, boolean got_sp1) +ini_inv_mkobj_filter(int oclass, boolean got_level1_spellbook) { struct obj *obj; int otyp, trycnt = 0; @@ -1068,7 +1070,7 @@ ini_inv_mkobj_filter(int oclass, boolean got_sp1) low level players or unbalancing; also spells in restricted skill categories */ || (obj->oclass == SPBOOK_CLASS - && (objects[otyp].oc_level > (got_sp1 ? 3 : 1) + && (objects[otyp].oc_level > (got_level1_spellbook ? 3 : 1) || restricted_spell_discipline(otyp))) || otyp == SPE_NOVEL) { dealloc_obj(obj);