]> granicus.if.org Git - nethack/commitdiff
build fix (trunk only)
authornethack.rankin <nethack.rankin>
Sun, 23 Nov 2003 09:47:34 +0000 (09:47 +0000)
committernethack.rankin <nethack.rankin>
Sun, 23 Nov 2003 09:47:34 +0000 (09:47 +0000)
     DEC C warned about a problem and that caused make to quit.

|        idx = (++idx % 2);
|........^
|%CC-W-UNDEFVARMOD, In this statement, the expression "idx=(++idx%2)"
|modifies the variable "idx" more than once without an intervening
|sequence point.  This behavior is undefined.

src/botl.c

index b20180de43ab2bd7eb1f090640a83136fc80bfd7..e2f625d051564882552e49bdb10bd3c3c384e6ca 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)botl.c     3.4     1996/07/15      */
+/*     SCCS Id: @(#)botl.c     3.4     2003/11/22      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -447,8 +447,8 @@ bot()
        anything curr, prev;
        boolean valset[MAXBLSTATS];
 
-       idx = (++idx % 2);
-       idx_p = ((idx+1) % 2);
+       idx_p = idx;
+       idx   = 1 - idx;        /* 0 -> 1, 1 -> 0 */
 
        /* clear the "value set" indicators */
        (void) memset((genericptr_t)valset, 0, MAXBLSTATS * sizeof(boolean));