summaryrefslogtreecommitdiffstats
path: root/primes
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
committerjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
commit04f4d7044367099914cf1906ae27ac20c24e44cf (patch)
treec17cb5c2f270bbb70eeba18cbe2bcfa43cfd8e10 /primes
parentf9706028dd6e2afabb6bd63d02d7bc90f78e4aab (diff)
downloadbsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.gz
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.zst
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.zip
Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the NetBSD games, except in hunt (where substantial changes from OpenBSD need to be looked at). Some such changes were previously covered in PRs bin/6041, bin/6146, bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994, bin/8039, bin/8057 and bin/8093.
Diffstat (limited to 'primes')
-rw-r--r--primes/pattern.c8
-rw-r--r--primes/pr_tbl.c8
-rw-r--r--primes/primes.c14
3 files changed, 15 insertions, 15 deletions
diff --git a/primes/pattern.c b/primes/pattern.c
index 3f55d240..d960a39e 100644
--- a/primes/pattern.c
+++ b/primes/pattern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pattern.c,v 1.4 1997/10/12 01:04:43 lukem Exp $ */
+/* $NetBSD: pattern.c,v 1.5 1999/09/08 21:17:55 jsm Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)pattern.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pattern.c,v 1.4 1997/10/12 01:04:43 lukem Exp $");
+__RCSID("$NetBSD: pattern.c,v 1.5 1999/09/08 21:17:55 jsm Exp $");
#endif
#endif /* not lint */
@@ -57,7 +57,7 @@ __RCSID("$NetBSD: pattern.c,v 1.4 1997/10/12 01:04:43 lukem Exp $");
* with 1. All non-zero elements are factors of 3, 5, 7, 11 and 13.
*/
-char pattern[] = {
+const char pattern[] = {
1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,
1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,0,
1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,1,
@@ -444,4 +444,4 @@ char pattern[] = {
0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,
0,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,0,1
};
-int pattern_size = (sizeof(pattern)/sizeof(pattern[0]));
+const int pattern_size = (sizeof(pattern)/sizeof(pattern[0]));
diff --git a/primes/pr_tbl.c b/primes/pr_tbl.c
index 4f30541c..25d2132a 100644
--- a/primes/pr_tbl.c
+++ b/primes/pr_tbl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pr_tbl.c,v 1.4 1997/10/12 01:04:50 lukem Exp $ */
+/* $NetBSD: pr_tbl.c,v 1.5 1999/09/08 21:17:55 jsm Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)pr_tbl.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pr_tbl.c,v 1.4 1997/10/12 01:04:50 lukem Exp $");
+__RCSID("$NetBSD: pr_tbl.c,v 1.5 1999/09/08 21:17:55 jsm Exp $");
#endif
#endif /* not lint */
@@ -58,7 +58,7 @@ __RCSID("$NetBSD: pr_tbl.c,v 1.4 1997/10/12 01:04:50 lukem Exp $");
#include "primes.h"
-ubig prime[] = {
+const ubig prime[] = {
2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,
107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,
211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,
@@ -550,4 +550,4 @@ ubig prime[] = {
};
/* pr_limit - largest prime in the prime table */
-unsigned long *pr_limit = &prime[(sizeof(prime)/sizeof(prime[0]))-1];
+const unsigned long *pr_limit = &prime[(sizeof(prime)/sizeof(prime[0]))-1];
diff --git a/primes/primes.c b/primes/primes.c
index ea6f0117..67fa6a4f 100644
--- a/primes/primes.c
+++ b/primes/primes.c
@@ -1,4 +1,4 @@
-/* $NetBSD: primes.c,v 1.8 1998/09/13 15:27:29 hubertf Exp $ */
+/* $NetBSD: primes.c,v 1.9 1999/09/08 21:17:55 jsm Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95";
#else
-__RCSID("$NetBSD: primes.c,v 1.8 1998/09/13 15:27:29 hubertf Exp $");
+__RCSID("$NetBSD: primes.c,v 1.9 1999/09/08 21:17:55 jsm Exp $");
#endif
#endif /* not lint */
@@ -96,16 +96,16 @@ char table[TABSIZE]; /* Eratosthenes sieve of odd numbers */
* We are able to sieve 2^32-1 because this byte table yields all primes
* up to 65537 and 65537^2 > 2^32-1.
*/
-extern ubig prime[];
-extern ubig *pr_limit; /* largest prime in the prime array */
+extern const ubig prime[];
+extern const ubig *pr_limit; /* largest prime in the prime array */
/*
* To avoid excessive sieves for small factors, we use the table below to
* setup our sieve blocks. Each element represents a odd number starting
* with 1. All non-zero elements are factors of 3, 5, 7, 11 and 13.
*/
-extern char pattern[];
-extern int pattern_size; /* length of pattern array */
+extern const char pattern[];
+extern const int pattern_size; /* length of pattern array */
int main __P((int, char *[]));
void primes __P((ubig, ubig));
@@ -227,7 +227,7 @@ primes(start, stop)
char *q; /* sieve spot */
ubig factor; /* index and factor */
char *tab_lim; /* the limit to sieve on the table */
- ubig *p; /* prime table pointer */
+ const ubig *p; /* prime table pointer */
ubig fact_lim; /* highest prime for current block */
/*