analysis lint for s*.c

shk.c was dealt with previously.
This commit is contained in:
PatR
2025-01-22 13:29:44 -08:00
parent 5cd20d5389
commit f86bb9b7b6
3 changed files with 7 additions and 8 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 save.c $NHDT-Date: 1706079844 2024/01/24 07:04:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.214 $ */ /* NetHack 3.7 save.c $NHDT-Date: 1737610109 2025/01/22 21:28:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.232 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */ /*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -17,7 +17,7 @@ int dotcnt, dotrow; /* also used in restore */
#endif #endif
staticfn void savelevchn(NHFILE *); staticfn void savelevchn(NHFILE *);
staticfn void savelevl(NHFILE *,boolean); staticfn void savelevl(NHFILE *, boolean);
staticfn void savedamage(NHFILE *); staticfn void savedamage(NHFILE *);
staticfn void save_bubbles(NHFILE *, xint8); staticfn void save_bubbles(NHFILE *, xint8);
staticfn void save_stairs(NHFILE *); staticfn void save_stairs(NHFILE *);
@@ -702,7 +702,7 @@ savedamage(NHFILE *nhfp)
if (nhfp->structlevel) if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) &xl, sizeof xl); bwrite(nhfp->fd, (genericptr_t) &xl, sizeof xl);
} }
while (xl--) { while (damageptr) {
if (perform_bwrite(nhfp)) { if (perform_bwrite(nhfp)) {
if (nhfp->structlevel) if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) damageptr, sizeof *damageptr); bwrite(nhfp->fd, (genericptr_t) damageptr, sizeof *damageptr);
+2 -2
View File
@@ -411,8 +411,8 @@ shkveg(void)
char oclass = FOOD_CLASS; char oclass = FOOD_CLASS;
int ok[NUM_OBJECTS]; int ok[NUM_OBJECTS];
(void) memset((genericptr_t) ok, 0, sizeof ok); /* lint suppression */
j = maxprob = 0; j = maxprob = 0;
ok[0] = 0; /* lint suppression */
for (i = svb.bases[(int) oclass]; i < NUM_OBJECTS; ++i) { for (i = svb.bases[(int) oclass]; i < NUM_OBJECTS; ++i) {
if (objects[i].oc_class != oclass) if (objects[i].oc_class != oclass)
break; break;
@@ -511,7 +511,7 @@ nameshk(struct monst *shk, const char *const *nlp)
for (names_avail = 0; nlp[names_avail]; names_avail++) for (names_avail = 0; nlp[names_avail]; names_avail++)
continue; continue;
assert(names_avail > 0);
name_wanted = name_wanted % names_avail; name_wanted = name_wanted % names_avail;
for (trycnt = 0; trycnt < 50; trycnt++) { for (trycnt = 0; trycnt < 50; trycnt++) {
+2 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 sp_lev.c $NHDT-Date: 1709921020 2024/03/08 18:03:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.359 $ */ /* NetHack 3.7 sp_lev.c $NHDT-Date: 1737610109 2025/01/22 21:28:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.373 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2515,9 +2515,8 @@ search_door(
yy = croom->ly; yy = croom->ly;
break; break;
default: default:
dx = dy = xx = yy = 0;
panic("search_door: Bad wall!"); panic("search_door: Bad wall!");
break; /*NOTREACHED*/
} }
while (xx <= croom->hx + 1 && yy <= croom->hy + 1) { while (xx <= croom->hx + 1 && yy <= croom->hy + 1) {
if (IS_DOOR(levl[xx][yy].typ) || levl[xx][yy].typ == SDOOR) { if (IS_DOOR(levl[xx][yy].typ) || levl[xx][yy].typ == SDOOR) {