From d0e43523d7e49924ceb48bce12f05fa8726cb567 Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 20 Dec 2023 19:31:39 -0500 Subject: [PATCH] useupall really won't handle a NULL pointer Revert useupall() prototype back to NONNULLARG1, as it was. The callers in nhlua.c check gi.invent to be nonnull before calling useupall(). --- include/extern.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/extern.h b/include/extern.h index a409c6fff..370a7d5f0 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1238,8 +1238,9 @@ extern struct obj *addinv_before(struct obj *, struct obj *) NONNULLARG1; extern struct obj *addinv_nomerge(struct obj *) NONNULLARG1; extern struct obj *hold_another_object(struct obj *, const char *, const char *, const char *) NONNULLARG1; -/* sometimes useupall(gi.invent) which can be null */ -extern void useupall(struct obj *) NO_NONNULLS; +/* nhlua.c calls useupall(gi.invent), but checks gi.invent against NULL + * before doing so. useupall() won't handle NULL*/ +extern void useupall(struct obj *) NONNULLARG1; extern void useup(struct obj *) NONNULLARG1; extern void consume_obj_charge(struct obj *, boolean) NONNULLARG1; extern void freeinv_core(struct obj *) NONNULLARG1;