diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-01-16 01:28:55 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-01-16 01:28:55 +0000 |
commit | 496e01e18f4d501ab034f7e71a4cb06167ff88c7 (patch) | |
tree | 3b457e6ee395b8d25e40dc6501edb7b037c62ff1 /games | |
parent | 51f4383f61889d34ee59c9078b745fc1afd1e51d (diff) |
Use the volatile specifier to fix warnings about variables being
clobbered by longjmp / vfork instead of the gcc "(void)&foo;" hack.
Diffstat (limited to 'games')
-rw-r--r-- | games/phantasia/fight.c | 12 | ||||
-rw-r--r-- | games/phantasia/io.c | 11 |
2 files changed, 8 insertions, 15 deletions
diff --git a/games/phantasia/fight.c b/games/phantasia/fight.c index f4dfd46def6..bac020cf490 100644 --- a/games/phantasia/fight.c +++ b/games/phantasia/fight.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fight.c,v 1.6 2002/01/04 16:16:32 art Exp $ */ +/* $OpenBSD: fight.c,v 1.7 2002/01/16 01:28:54 millert Exp $ */ /* $NetBSD: fight.c,v 1.2 1995/03/24 03:58:39 cgd Exp $ */ /* @@ -41,18 +41,14 @@ void encounter(particular) int particular; { - bool firsthit = Player.p_blessing; /* set if player gets the - * first hit */ - int flockcnt = 1; /* how many time flocked */ + int flockcnt = 1; /* how many time flocked */ + volatile bool firsthit = Player.p_blessing; /* set if player gets + * the first hit */ /* let others know what we are doing */ Player.p_status = S_MONSTER; writerecord(&Player, Fileloc); -#if __GNUC__ - (void)&firsthit; /* XXX shut up gcc */ -#endif - #ifdef SYS5 flushinp(); #endif diff --git a/games/phantasia/io.c b/games/phantasia/io.c index 47ca6909d1f..5d0cbce9da1 100644 --- a/games/phantasia/io.c +++ b/games/phantasia/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.4 1998/11/29 19:56:57 pjanzen Exp $ */ +/* $OpenBSD: io.c,v 1.5 2002/01/16 01:28:54 millert Exp $ */ /* $NetBSD: io.c,v 1.2 1995/03/24 03:58:50 cgd Exp $ */ /* @@ -325,16 +325,13 @@ getanswer(choices, def) char *choices; bool def; { - int ch; /* input */ - int loop; /* counter */ - int oldx, oldy; /* original coordinates on screen */ + int ch; /* input */ + volatile int loop; /* counter */ + volatile int oldx, oldy; /* original coordinates on screen */ getyx(stdscr, oldy, oldx); alarm(0); /* make sure alarm is off */ -#if __GNUC__ - (void)&loop; /* XXX quiet gcc */ -#endif for (loop = 3; loop; --loop) for (loop = 3; loop; --loop) /* try for 3 times */ |