summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libihash/ChangeLog7
-rw-r--r--libihash/primes.c6
2 files changed, 9 insertions, 4 deletions
diff --git a/libihash/ChangeLog b/libihash/ChangeLog
index 62f056e9..000d60a6 100644
--- a/libihash/ChangeLog
+++ b/libihash/ChangeLog
@@ -1,3 +1,10 @@
+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).
+
1997-06-20 Miles Bader <miles@gnu.ai.mit.edu>
* ihash.c (ihash_create): Initialize CLEANUP & CLEANUP_ARG fields.
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