static analysis fix attempt

These three changes compile but I don't know whether thay succeed in
suppressing the new static analyzer complaints.
This commit is contained in:
PatR
2026-05-15 08:11:56 -07:00
parent 99f559fe18
commit 9ec26da4ff
3 changed files with 11 additions and 5 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 5.0 extern.h $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1523 $ */
/* NetHack 5.0 extern.h $NHDT-Date: 1778886716 2026/05/15 15:11:56 $ $NHDT-Branch: NetHack-5.0 $:$NHDT-Revision: 1.1558 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -693,7 +693,8 @@ extern void free_mgivenname(struct monst *) NONNULLARG1;
extern void new_oname(struct obj *, int) NONNULLARG1;
extern void free_oname(struct obj *) NONNULLARG1;
extern const char *safe_oname(struct obj *) NONNULLARG1;
extern struct monst *christen_monst(struct monst *, const char *) NONNULLARG1;
extern struct monst *christen_monst(struct monst *, const char *) NONNULL
NONNULLARG1;
extern struct obj *oname(struct obj *, const char *, unsigned) NONNULLPTRS;
extern boolean objtyp_is_callable(int);
extern int name_ok(struct obj *);
+2 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 5.0 options.c $NHDT-Date: 1737556914 2025/01/22 06:41:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.753 $ */
/* NetHack 5.0 options.c $NHDT-Date: 1778886716 2026/05/15 15:11:56 $ $NHDT-Branch: NetHack-5.0 $:$NHDT-Revision: 1.782 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -558,6 +558,7 @@ parseoptions(
got_match = FALSE;
if (allopt[i].pfx) {
assert(allopt[i].name != NULL);
if (str_start_is(opts, allopt[i].name, TRUE)) {
matchidx = i;
got_match = pfx_match = TRUE;
+6 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 5.0 unixunix.c $NHDT-Date: 1711213894 2024/03/23 17:11:34 $ $NHDT-Branch: NetHack-5.0 $:$NHDT-Revision: 1.43 $ */
/* NetHack 5.0 unixunix.c $NHDT-Date: 1778886716 2026/05/15 15:11:56 $ $NHDT-Branch: NetHack-5.0 $:$NHDT-Revision: 1.48 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -370,6 +370,9 @@ int
child(int wt)
{
int f;
#ifdef CHDIR
const char *home = getenv("HOME");
#endif
suspend_nhwindows((char *) 0); /* also calls end_screen() */
#ifdef _M_UNIX
@@ -382,7 +385,8 @@ child(int wt)
(void) setgid(getgid());
(void) setuid(getuid());
#ifdef CHDIR
(void) chdir(getenv("HOME"));
if (home)
(void) chdir(home);
#endif
return 1;
}