Commit 40c68b13 authored by Per Cederqvist's avatar Per Cederqvist

(L2G_BLOCKSIZE): Now a static int instead of a define.

(l2g_set_block_size): New function, that can be called once to set the
	block size.
(l2g_init): Set the block size to 250 unless it has already been set.
parent b67a4168
......@@ -34,11 +34,9 @@
/* The test suite requires L2G_BLOCKSIZE to be 10, but that small
blocks will result in far too much malloc-overhead. A value of at
least 100 is probably needed for reasonable performance. */
/* FIXME: make this a global variable that is initialized to, say,
250, and that the test suite program can change to 10 before it
does anything else. */
#define L2G_BLOCKSIZE 10 /* Doesn't seem to matter much. */
least 100 is probably needed for reasonable performance. The user
can call l2g_set_block_size to set this to a reasonable value. */
static int L2G_BLOCKSIZE = -1;
struct l2g_block_info {
......@@ -523,6 +521,14 @@ join_blocks(Local_to_global *l2g,
/* ================================================================ */
void
l2g_set_block_size(int sz)
{
assert(L2G_BLOCKSIZE == -1);
L2G_BLOCKSIZE = sz;
}
void
l2g_destruct(Local_to_global *l2g)
{
......@@ -540,6 +546,9 @@ l2g_destruct(Local_to_global *l2g)
void
l2g_init(Local_to_global *l2g)
{
if (L2G_BLOCKSIZE == -1)
L2G_BLOCKSIZE = 250;
/* Initialize the main structure */
l2g->num_blocks = 0;
l2g->first_unused = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment