summaryrefslogtreecommitdiff
path: root/tests/middle.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-03-20 09:08:55 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:56 +0400
commitc2dddb53a10205f986ae782e5b1e7105f0ea80c5 (patch)
tree311e1519f2ee67241419a1a443694dcd06bff7b4 /tests/middle.c
parentdc399deadba2c4344d3e9952d1ee2b7bbf24b5e5 (diff)
downloadbdwgc-c2dddb53a10205f986ae782e5b1e7105f0ea80c5.tar.gz
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 'tests/middle.c')
-rw-r--r--tests/middle.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/tests/middle.c b/tests/middle.c
index ebb348c4..ff0a2355 100644
--- a/tests/middle.c
+++ b/tests/middle.c
@@ -2,25 +2,24 @@
* Test at the boundary between small and large objects.
* Inspired by a test case from Zoltan Varga.
*/
-#include <gc.h>
+#include "gc.h"
#include <stdio.h>
-int main ()
+int main (void)
{
- int i;
+ int i;
- GC_all_interior_pointers = 0;
- GC_INIT();
+ GC_set_all_interior_pointers(0);
+ GC_INIT();
- for (i = 0; i < 20000; ++i) {
- GC_malloc_atomic (4096);
- GC_malloc (4096);
- }
- for (i = 0; i < 20000; ++i) {
- GC_malloc_atomic (2048);
- GC_malloc (2048);
- }
- printf("Final heap size is %ld\n", GC_get_heap_size());
- return 0;
+ for (i = 0; i < 20000; ++i) {
+ GC_malloc_atomic (4096);
+ GC_malloc (4096);
+ }
+ for (i = 0; i < 20000; ++i) {
+ GC_malloc_atomic (2048);
+ GC_malloc (2048);
+ }
+ printf("Final heap size is %lu\n", (unsigned long)GC_get_heap_size());
+ return 0;
}
-