summaryrefslogtreecommitdiff
path: root/libihash/primes.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-03-05 22:21:53 +0000
committerThomas Bushnell <thomas@gnu.org>1999-03-05 22:21:53 +0000
commit77b6f43a9626ed1939a626ec91936ac78d1415cb (patch)
tree5c8fcdc94c350fea0d8b0f17acbf40e46cb33c6b /libihash/primes.c
parent511ce6420fe41abb5fea6b294fba9a21548ecca4 (diff)
Fri Mar 5 17:13:04 1999 Thomas Bushnell, BSG <tb@mit.edu>
* primes.c (_ihash_nextprime): Use a dynamically-sized array for `seive' instead of alloca, so that if we are looping we won't allocate more stack than necessary. Suggested by wesommer@mit.edu (Bill Sommerfeld).
Diffstat (limited to 'libihash/primes.c')
-rw-r--r--libihash/primes.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libihash/primes.c b/libihash/primes.c
index 3abc6f9d..c67b66fb 100644
--- a/libihash/primes.c
+++ b/libihash/primes.c
@@ -1,5 +1,5 @@
/* Prime number generation
- Copyright (C) 1994, 1996 Free Software Foundation
+ Copyright (C) 1994, 1996, 1999 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -72,11 +72,9 @@ _ihash_nextprime (unsigned n)
max_prime + 1 to 2 * max_prime, looking for more primes. */
unsigned start = next_sieve;
unsigned end = start + max_prime + 1;
- char *sieve = (char *) alloca ((end - start) * sizeof (*sieve));
+ char sieve[end - start];
int i;
- assert (sieve);
-
bzero (sieve, (end - start) * sizeof (*sieve));
/* Make the sieve indexed by prime number, rather than