Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2005:
[Freeciv-Dev] (PR#13743) sanity_check_connections
Home

[Freeciv-Dev] (PR#13743) sanity_check_connections

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13743) sanity_check_connections
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 Aug 2005 20:58:17 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13743 >

This patch adds some sanity checks for connections to sanitycheck.c.  It 
should do more complex checks but this is all I needed for now.

-jason

Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.72
diff -p -u -r1.72 sanitycheck.c
--- server/sanitycheck.c        18 Aug 2005 06:53:31 -0000      1.72
+++ server/sanitycheck.c        23 Aug 2005 03:55:18 -0000
@@ -488,6 +488,20 @@ static void check_teams(void)
 }
 
 /**************************************************************************
+  Sanity checking on connections.
+**************************************************************************/
+static void check_connections(void)
+{
+  /* est_connections is a subset of all_connections */
+  SANITY_CHECK(conn_list_size(game.all_connections)
+              >= conn_list_size(game.est_connections));
+
+  /* game_connections is a subset of est_connections */
+  SANITY_CHECK(conn_list_size(game.est_connections)
+              >= conn_list_size(game.game_connections));
+}
+
+/**************************************************************************
 ...
 **************************************************************************/
 void sanity_check(void)
@@ -504,6 +518,7 @@ void sanity_check(void)
   check_misc();
   check_players();
   check_teams();
+  check_connections();
 }
 
 #endif /* SANITY_CHECKING */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13743) sanity_check_connections, Jason Short <=