summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-03-20 10:08:55 +0100
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:56 +0200
commitc2dddb53a10205f986ae782e5b1e7105f0ea80c5 (patch)
tree311e1519f2ee67241419a1a443694dcd06bff7b4 /misc.c
parentdc399deadba2c4344d3e9952d1ee2b7bbf24b5e5 (diff)
2011-03-20 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_finish_collection): Remove redundant brackets; adjust code indentation. * blacklst.c (GC_add_to_black_list_normal): Simplify expression (to improve code readability). * blacklst.c (GC_is_black_listed): Join nested "if" (into a single conditional expression); initialize "nblocks" just before the loop beginning. * misc.c (GC_init): Don't compute initial_heap_sz if GC is already initialized. * include/private/gc_priv.h (GC_initialize_offsets): Move the function declaration to misc.c file. * obj_map.c (GC_initialize_offsets): Remove offsets_initialized static variable since the function is called only once. * tests/middle.c: Include "gc.h" instead of <gc.h>; expand all tabs to spaces; adjust code indentation; replace the K&R-style function definition with the ANSI C one. * tests/smash_test.c: Ditto. * tests/middle.c (main): Use setter for GC_all_interior_pointers; adjust printf format specifier (and cast the value passed to).
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/misc.c b/misc.c
index b058228..75b92b0 100644
--- a/misc.c
+++ b/misc.c
@@ -630,21 +630,24 @@ STATIC void GC_exit_check(void)
STATIC int GC_log = 2;
#endif
+GC_INNER void GC_initialize_offsets(void); /* defined in obj_map.c */
+
GC_API void GC_CALL GC_init(void)
{
/* LOCK(); -- no longer does anything this early. */
# if !defined(THREADS) && defined(GC_ASSERTIONS)
word dummy;
# endif
-# ifdef GC_INITIAL_HEAP_SIZE
- word initial_heap_sz = divHBLKSZ(GC_INITIAL_HEAP_SIZE);
-# else
- word initial_heap_sz = (word)MINHINCR;
-# endif
+ word initial_heap_sz;
IF_CANCEL(int cancel_state;)
if (GC_is_initialized) return;
+# ifdef GC_INITIAL_HEAP_SIZE
+ initial_heap_sz = divHBLKSZ(GC_INITIAL_HEAP_SIZE);
+# else
+ initial_heap_sz = (word)MINHINCR;
+# endif
DISABLE_CANCEL(cancel_state);
/* Note that although we are nominally called with the */
/* allocation lock held, the allocation lock is now */