Source-Changes-HG archive

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

[src/trunk]: src/games/gomoku gomoku: reduce scope of local variable



details:   https://anonhg.NetBSD.org/src/rev/413a4f62ddc0
branches:  trunk
changeset: 366458:413a4f62ddc0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat May 28 04:52:23 2022 +0000

description:
gomoku: reduce scope of local variable

No functional change.

diffstat:

 games/gomoku/makemove.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r d503fddccc94 -r 413a4f62ddc0 games/gomoku/makemove.c
--- a/games/gomoku/makemove.c   Sat May 28 01:07:47 2022 +0000
+++ b/games/gomoku/makemove.c   Sat May 28 04:52:23 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makemove.c,v 1.25 2022/05/27 23:29:15 rillig Exp $     */
+/*     $NetBSD: makemove.c,v 1.26 2022/05/28 04:52:23 rillig Exp $     */
 
 /*
  * Copyright (c) 1994
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 /*     @(#)makemove.c  8.2 (Berkeley) 5/3/95   */
-__RCSID("$NetBSD: makemove.c,v 1.25 2022/05/27 23:29:15 rillig Exp $");
+__RCSID("$NetBSD: makemove.c,v 1.26 2022/05/28 04:52:23 rillig Exp $");
 
 #include "gomoku.h"
 
@@ -217,7 +217,6 @@
 update_overlap(struct spotstr *osp)
 {
 
-       struct spotstr *esp = NULL;
        for (int r = 4; --r >= 0; ) {           /* for each direction */
            int d = dd[r];
            struct spotstr *sp1 = osp;
@@ -251,12 +250,14 @@
                     */
                    int n = 0;
                    struct spotstr *sp = sp1;
+                   struct spotstr *esp = NULL;
                    for (int b = i - f; b < 5; b++, sp += d) {
                        if (sp->s_occ == EMPTY) {
                            esp = sp;   /* save the intersection point */
                            n++;
                        }
                    }
+
                    int b = (int)(sp2->s_frame[r] - frames);
                    if (n == 0) {
                        if (sp->s_occ == EMPTY) {



Home | Main Index | Thread Index | Old Index