From 8d13b7ace8786a28d9c80d9457cb1a488c186e27 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sun, 9 Jan 2011 16:25:58 +0900 Subject: [PATCH] heap-stats will now build with Boehm, but just as a noop --- lib/chibi/heap-stats.c | 17 +++++++++++++++-- lib/chibi/io/port.c | 3 ++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/chibi/heap-stats.c b/lib/chibi/heap-stats.c index 8b977f1a..d0859d0e 100644 --- a/lib/chibi/heap-stats.c +++ b/lib/chibi/heap-stats.c @@ -1,11 +1,13 @@ /* heap-stats.c -- count or dump heap objects */ -/* Copyright (c) 2009-2010 Alex Shinn. All rights reserved. */ +/* Copyright (c) 2009-2011 Alex Shinn. All rights reserved. */ /* BSD-style license: http://synthcode.com/license.txt */ #include #define SEXP_HEAP_VECTOR_DEPTH 1 +#if ! SEXP_USE_BOEHM + extern sexp sexp_gc (sexp ctx, size_t *sum_freed); extern sexp_uint_t sexp_allocated_bytes (sexp ctx, sexp x); @@ -112,9 +114,20 @@ static sexp sexp_heap_dump (sexp ctx sexp_api_params(self, n), sexp depth) { return sexp_heap_walk(ctx, sexp_unbox_fixnum(depth), 1); } +#else + +static sexp sexp_heap_stats (sexp ctx sexp_api_params(self, n)) { + return SEXP_NULL; +} + +static sexp sexp_heap_dump (sexp ctx sexp_api_params(self, n), sexp depth) { + return SEXP_NULL; +} + +#endif + sexp sexp_init_library (sexp ctx sexp_api_params(self, n), sexp env) { sexp_define_foreign(ctx, env, "heap-stats", 0, sexp_heap_stats); sexp_define_foreign_opt(ctx, env, "heap-dump", 1, sexp_heap_dump, SEXP_ONE); return SEXP_VOID; } - diff --git a/lib/chibi/io/port.c b/lib/chibi/io/port.c index 292b0eef..826d7948 100644 --- a/lib/chibi/io/port.c +++ b/lib/chibi/io/port.c @@ -29,8 +29,9 @@ static int sexp_in_heap_p (sexp_heap h, sexp p) { #endif static sexp sexp_last_context (sexp ctx, sexp *cstack) { - sexp res=SEXP_FALSE, p; + sexp res=SEXP_FALSE; #if ! SEXP_USE_BOEHM + sexp p; sexp_sint_t i; sexp_heap h = sexp_context_heap(ctx); for (i=0; i