Source-Changes-HG archive

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

[src/trunk]: src/games/canfield Split struct betinfo into its own header file...



details:   https://anonhg.NetBSD.org/src/rev/bebdd349d2bd
branches:  trunk
changeset: 750456:bebdd349d2bd
user:      dholland <dholland%NetBSD.org@localhost>
date:      Fri Jan 01 06:37:15 2010 +0000

description:
Split struct betinfo into its own header file so it can be shared
between canfield and cfscores, instead of copy-pasted.

diffstat:

 games/canfield/canfield/betinfo.h  |  44 ++++++++++++++++++++++++++++++++++++++
 games/canfield/canfield/canfield.c |  15 ++----------
 games/canfield/cfscores/cfscores.c |  16 ++-----------
 3 files changed, 50 insertions(+), 25 deletions(-)

diffs (130 lines):

diff -r 46fc94ce593a -r bebdd349d2bd games/canfield/canfield/betinfo.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/games/canfield/canfield/betinfo.h Fri Jan 01 06:37:15 2010 +0000
@@ -0,0 +1,44 @@
+/*     $NetBSD: betinfo.h,v 1.1 2010/01/01 06:37:15 dholland Exp $     */
+
+/*
+ * Copyright (c) 1983, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This structure is written to disk and must not be changed idly.
+ */
+struct betinfo {
+       long    hand;           /* cost of dealing hand */
+       long    inspection;     /* cost of inspecting hand */
+       long    game;           /* cost of buying game */
+       long    runs;           /* cost of running through hands */
+       long    information;    /* cost of information */
+       long    thinktime;      /* cost of thinking time */
+       long    wins;           /* total winnings */
+       long    worth;          /* net worth after costs */
+};
diff -r 46fc94ce593a -r bebdd349d2bd games/canfield/canfield/canfield.c
--- a/games/canfield/canfield/canfield.c        Fri Jan 01 06:31:18 2010 +0000
+++ b/games/canfield/canfield/canfield.c        Fri Jan 01 06:37:15 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: canfield.c,v 1.26 2009/08/12 05:35:44 dholland Exp $   */
+/*     $NetBSD: canfield.c,v 1.27 2010/01/01 06:37:15 dholland Exp $   */
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: canfield.c,v 1.26 2009/08/12 05:35:44 dholland Exp $");
+__RCSID("$NetBSD: canfield.c,v 1.27 2010/01/01 06:37:15 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -66,6 +66,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include "betinfo.h"
 #include "pathnames.h"
 
 #define        decksize        52
@@ -183,16 +184,6 @@
 /*
  * Variables associated with betting 
  */
-struct betinfo {
-       long    hand;           /* cost of dealing hand */
-       long    inspection;     /* cost of inspecting hand */
-       long    game;           /* cost of buying game */
-       long    runs;           /* cost of running through hands */
-       long    information;    /* cost of information */
-       long    thinktime;      /* cost of thinking time */
-       long    wins;           /* total winnings */
-       long    worth;          /* net worth after costs */
-};
 static struct betinfo this, game, total;
 static bool startedgame = FALSE, infullgame = FALSE;
 static time_t acctstart;
diff -r 46fc94ce593a -r bebdd349d2bd games/canfield/cfscores/cfscores.c
--- a/games/canfield/cfscores/cfscores.c        Fri Jan 01 06:31:18 2010 +0000
+++ b/games/canfield/cfscores/cfscores.c        Fri Jan 01 06:37:15 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cfscores.c,v 1.19 2010/01/01 06:31:18 dholland Exp $   */
+/*     $NetBSD: cfscores.c,v 1.20 2010/01/01 06:37:16 dholland Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: cfscores.c,v 1.19 2010/01/01 06:31:18 dholland Exp $");
+__RCSID("$NetBSD: cfscores.c,v 1.20 2010/01/01 06:37:16 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -51,19 +51,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include "betinfo.h"
 #include "pathnames.h"
 
-struct betinfo {
-       long    hand;           /* cost of dealing hand */
-       long    inspection;     /* cost of inspecting hand */
-       long    game;           /* cost of buying game */
-       long    runs;           /* cost of running through hands */
-       long    information;    /* cost of information */
-       long    thinktime;      /* cost of thinking time */
-       long    wins;           /* total winnings */
-       long    worth;          /* net worth after costs */
-};
-
 static int dbfd;
 
 static void printuser(const struct passwd *, int);



Home | Main Index | Thread Index | Old Index