aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/alloc.h8
-rw-r--r--src/arena.c8
2 files changed, 9 insertions, 7 deletions
diff --git a/src/alloc.h b/src/alloc.h
index bc4bd69..8ac1f1f 100644
--- a/src/alloc.h
+++ b/src/alloc.h
@@ -6,6 +6,14 @@
#include "common.h"
+/* Callers should not modify _ARENA_DFLT_CAP. This is included here so
+ that it can be accessed from the automated tests. */
+#if DEBUG
+# define _ARENA_DFLT_CAP (8)
+#else
+# define _ARENA_DFLT_CAP (2 * 1024)
+#endif
+
typedef struct _arena *arena_t;
typedef struct {
void *p;
diff --git a/src/arena.c b/src/arena.c
index 525acfe..20083b5 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -16,12 +16,6 @@
# error "System not supported (missing MAP_ANON)"
#endif
-#if DEBUG
-# define ARENA_DFLT_CAP (8)
-#else
-# define ARENA_DFLT_CAP (2048)
-#endif
-
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define IS_POW_2(n) ((n) != 0 && ((n) & ((n)-1)) == 0)
@@ -68,7 +62,7 @@ arena_alloc(struct _arena **a, size_t nmemb, size_t size, size_t align)
}
/* No page exists with enough space */
- struct _arena *p = mkblk(MAX(size, ARENA_DFLT_CAP));
+ struct _arena *p = mkblk(MAX(size, _ARENA_DFLT_CAP));
p->next = *a;
*a = p;
p->free = (char *)p->data + size;