Module Name:    src
Committed By:   christos
Date:           Tue Mar 31 18:48:16 UTC 2009

Modified Files:
        src/games/trek: help.c kill.c schedule.c setup.c trek.h

Log Message:
Avoid hardcoded "too large" constant that caused FPE on the vax.
XXX: Should pullup to 5.0


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/games/trek/help.c
cvs rdiff -u -r1.7 -r1.8 src/games/trek/kill.c
cvs rdiff -u -r1.6 -r1.7 src/games/trek/schedule.c
cvs rdiff -u -r1.9 -r1.10 src/games/trek/setup.c
cvs rdiff -u -r1.11 -r1.12 src/games/trek/trek.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/trek/help.c
diff -u src/games/trek/help.c:1.8 src/games/trek/help.c:1.9
--- src/games/trek/help.c:1.8	Sat Dec 15 14:44:44 2007
+++ src/games/trek/help.c	Tue Mar 31 14:48:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: help.c,v 1.8 2007/12/15 19:44:44 perry Exp $	*/
+/*	$NetBSD: help.c,v 1.9 2009/03/31 18:48:16 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,13 +34,14 @@
 #if 0
 static char sccsid[] = "@(#)help.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: help.c,v 1.8 2007/12/15 19:44:44 perry Exp $");
+__RCSID("$NetBSD: help.c,v 1.9 2009/03/31 18:48:16 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include <stdio.h>
 #include <math.h>
 #include <unistd.h>
+#include <limits.h>
 #include "trek.h"
 
 /*
@@ -96,7 +97,7 @@
 	Game.helps += 1;
 
 	/* find the closest base */
-	dist = 1e50;
+	dist = TOOLARGE;
 	if (Quad[Ship.quadx][Ship.quady].bases <= 0)
 	{
 		/* there isn't one in this quadrant */

Index: src/games/trek/kill.c
diff -u src/games/trek/kill.c:1.7 src/games/trek/kill.c:1.8
--- src/games/trek/kill.c:1.7	Thu Aug  7 05:37:52 2003
+++ src/games/trek/kill.c	Tue Mar 31 14:48:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kill.c,v 1.7 2003/08/07 09:37:52 agc Exp $	*/
+/*	$NetBSD: kill.c,v 1.8 2009/03/31 18:48:16 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,11 +34,12 @@
 #if 0
 static char sccsid[] = "@(#)kill.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: kill.c,v 1.7 2003/08/07 09:37:52 agc Exp $");
+__RCSID("$NetBSD: kill.c,v 1.8 2009/03/31 18:48:16 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include <stdio.h>
+#include <limits.h>
 #include "trek.h"
 
 /*
@@ -138,7 +139,7 @@
 			printf("   quadrant %d,%d has been destroyed\n", qx, qy);
 		}
 		else
-			schedule(E_KATSB | E_GHOST, 1e50, qx, qy, 0);
+			schedule(E_KATSB | E_GHOST, TOOLARGE, qx, qy, 0);
 	}
 }
 

Index: src/games/trek/schedule.c
diff -u src/games/trek/schedule.c:1.6 src/games/trek/schedule.c:1.7
--- src/games/trek/schedule.c:1.6	Sat Mar 18 19:56:12 2006
+++ src/games/trek/schedule.c	Tue Mar 31 14:48:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: schedule.c,v 1.6 2006/03/19 00:56:12 christos Exp $	*/
+/*	$NetBSD: schedule.c,v 1.7 2009/03/31 18:48:16 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,13 +34,14 @@
 #if 0
 static char sccsid[] = "@(#)schedule.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: schedule.c,v 1.6 2006/03/19 00:56:12 christos Exp $");
+__RCSID("$NetBSD: schedule.c,v 1.7 2009/03/31 18:48:16 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include <stdio.h>
 #include <math.h>
 #include <err.h>
+#include <limits.h>
 #include "trek.h"
 
 /*
@@ -135,7 +136,7 @@
 			e->evcode, e->date, e->x, e->y, e->systemname);
 #	endif
 	Now.eventptr[e->evcode & E_EVENT] = 0;
-	e->date = 1e50;
+	e->date = TOOLARGE;
 	e->evcode = 0;
 	return;
 }

Index: src/games/trek/setup.c
diff -u src/games/trek/setup.c:1.9 src/games/trek/setup.c:1.10
--- src/games/trek/setup.c:1.9	Fri Nov 14 16:10:44 2008
+++ src/games/trek/setup.c	Tue Mar 31 14:48:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: setup.c,v 1.9 2008/11/14 21:10:44 christos Exp $	*/
+/*	$NetBSD: setup.c,v 1.10 2009/03/31 18:48:16 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)setup.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: setup.c,v 1.9 2008/11/14 21:10:44 christos Exp $");
+__RCSID("$NetBSD: setup.c,v 1.10 2009/03/31 18:48:16 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -44,6 +44,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <err.h>
+#include <limits.h>
 #include "trek.h"
 #include "getpar.h"
 
@@ -211,7 +212,7 @@
 	for (i = 0; i < MAXEVENTS; i++)
 	{
 		e = &Event[i];
-		e->date = 1e50;
+		e->date = TOOLARGE;
 		e->evcode = 0;
 	}
 	xsched(E_SNOVA, 1, 0, 0, 0);

Index: src/games/trek/trek.h
diff -u src/games/trek/trek.h:1.11 src/games/trek/trek.h:1.12
--- src/games/trek/trek.h:1.11	Tue Feb 15 07:54:50 2005
+++ src/games/trek/trek.h	Tue Mar 31 14:48:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: trek.h,v 1.11 2005/02/15 12:54:50 jsm Exp $	*/
+/*	$NetBSD: trek.h,v 1.12 2009/03/31 18:48:16 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -370,6 +370,8 @@
 # define	xTRACE		1
 extern int	Trace;
 
+# define 	TOOLARGE	(DBL_MAX / 2)	/* < DOUBLE_MAX for everyone */
+
 /* abandon.c */
 void abandon(int);
 

Reply via email to