Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/gomoku gomoku: use custom magic value for end of file ...



details:   https://anonhg.NetBSD.org/src/rev/1c703e85f9bc
branches:  trunk
changeset: 366486:1c703e85f9bc
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat May 28 23:05:45 2022 +0000

description:
gomoku: use custom magic value for end of file input

This allows the type for a spot index to be changed to an unsigned type.

No functional change.

diffstat:

 games/gomoku/gomoku.h |  3 ++-
 games/gomoku/main.c   |  8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r 5bedcb38e380 -r 1c703e85f9bc games/gomoku/gomoku.h
--- a/games/gomoku/gomoku.h     Sat May 28 22:33:42 2022 +0000
+++ b/games/gomoku/gomoku.h     Sat May 28 23:05:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gomoku.h,v 1.45 2022/05/28 17:51:27 rillig Exp $       */
+/*     $NetBSD: gomoku.h,v 1.46 2022/05/28 23:05:45 rillig Exp $       */
 
 /*
  * Copyright (c) 1994
@@ -66,6 +66,7 @@
 #define WIN    3
 #define TIE    4
 #define SAVE   5
+#define END_OF_INPUT 6
 #define PT(x, y)       ((x) + (BSZ + 1) * (y))
 
 /*
diff -r 5bedcb38e380 -r 1c703e85f9bc games/gomoku/main.c
--- a/games/gomoku/main.c       Sat May 28 22:33:42 2022 +0000
+++ b/games/gomoku/main.c       Sat May 28 23:05:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.65 2022/05/28 21:31:41 rillig Exp $ */
+/*     $NetBSD: main.c,v 1.66 2022/05/28 23:05:45 rillig Exp $ */
 
 /*
  * Copyright (c) 1994
@@ -36,7 +36,7 @@
 __COPYRIGHT("@(#) Copyright (c) 1994\
  The Regents of the University of California.  All rights reserved.");
 /*     @(#)main.c      8.4 (Berkeley) 5/4/95   */
-__RCSID("$NetBSD: main.c,v 1.65 2022/05/28 21:31:41 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.66 2022/05/28 23:05:45 rillig Exp $");
 
 #include <sys/stat.h>
 #include <curses.h>
@@ -290,7 +290,7 @@
        switch (input[color]) {
        case INPUTF:
                curmove = readinput(inputfp);
-               if (curmove != EOF)
+               if (curmove != END_OF_INPUT)
                        break;
                set_input_sources(input, color);
                plyr[BLACK] = input[BLACK] == USER ? user : prog;
@@ -409,7 +409,7 @@
        while ((c = getc(fp)) != EOF && c != '\n' && pos < sizeof(buf) - 1)
                buf[pos++] = c;
        buf[pos] = '\0';
-       return c == EOF ? EOF : ctos(buf);
+       return c == EOF ? END_OF_INPUT : ctos(buf);
 }
 
 #ifdef DEBUG



Home | Main Index | Thread Index | Old Index