fix analyzer complaints about Knox level

Fix some of the extreme verbosity for null vs non-null triggered
by mklev.c.  dungeon_branch() never returns Null.

'#include <assert.h>' should probably be moved out of multiple .c
files and into cstd.h or some such but this doesn't do that.
This commit is contained in:
PatR
2023-12-16 13:26:17 -08:00
parent caa8aa7f60
commit ae80e7db47
2 changed files with 5 additions and 1 deletions

View File

@@ -801,7 +801,7 @@ extern const char *surface(coordxy, coordxy);
extern const char *ceiling(coordxy, coordxy);
extern boolean In_quest(d_level *) NONNULLARG1;
extern boolean In_mines(d_level *) NONNULLARG1;
extern branch *dungeon_branch(const char *) NONNULLARG1;
extern branch *dungeon_branch(const char *) NONNULL NONNULLARG1;
extern boolean at_dgn_entrance(const char *) NONNULLARG1;
extern boolean In_hell(d_level *) NONNULLARG1;
extern boolean In_V_tower(d_level *) NONNULLARG1;

View File

@@ -4,6 +4,7 @@
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#include <assert.h>
/* for UNIX, Rand #def'd to (long)lrand48() or (long)random() */
/* croom->lx etc are schar (width <= int), so % arith ensures that */
@@ -2296,6 +2297,9 @@ mk_knox_portal(coordxy x, coordxy y)
schar u_depth;
br = dungeon_branch("Fort Ludios");
/* dungeon_branch() panics (so never returns) if result would be Null */
assert(br != NULL);
if (on_level(&knox_level, &br->end1)) {
source = &br->end2;
} else {