lev_main cleanup

Use an alternate fix for the complaint from clang's static analyzer
(about potentially derefencing a null pointer, which can't happen
here because alloc() panics and quits rather than return Null), plus
some reformatting and removal of a chunk of unused code (strncmpi).

Also a formatting bit for lev_comp.y, making sys/share/lev_yacc.c
be out of date.  However, the generated code will be the same--except
for line numbers--so this shouldn't inhibit anybody's planned testing
waiting for the generated copy to be updated.
This commit is contained in:
PatR
2015-11-20 18:58:48 -08:00
parent d3d332e606
commit 63dc6b3a31
2 changed files with 60 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
%{
/* NetHack 3.6 lev_comp.y $NHDT-Date: 1432512785 2015/05/25 00:13:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.16 $ */
/* NetHack 3.6 lev_comp.y $NHDT-Date: 1448074095 2015/11/21 02:48:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -1562,8 +1562,10 @@ object_detail : OBJECT_ID ':' object_desc
object_desc : object_or_var object_infos
{
if (( $2 & 0x4000) && in_container_obj) lc_error("Object cannot have a coord when contained.");
else if (!( $2 & 0x4000) && !in_container_obj) lc_error("Object needs a coord when not contained.");
if (( $2 & 0x4000) && in_container_obj)
lc_error("Object cannot have a coord when contained.");
else if (!( $2 & 0x4000) && !in_container_obj)
lc_error("Object needs a coord when not contained.");
}
;