From bc82f836a352b0fcded7034fed043f6efaec9c01 Mon Sep 17 00:00:00 2001 From: Chris Walsh Date: Wed, 17 Feb 2016 12:15:36 -0500 Subject: [PATCH] Previous checkin incomplete - fixed omissions --- chibi-gdb | 1 + gc_heap.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100755 chibi-gdb diff --git a/chibi-gdb b/chibi-gdb new file mode 100755 index 00000000..8c4e3714 --- /dev/null +++ b/chibi-gdb @@ -0,0 +1 @@ +LD_LIBRARY_PATH=.: DYLD_LIBRARY_PATH=.: CHIBI_MODULE_PATH=lib gdb --args ./chibi-scheme "$@" diff --git a/gc_heap.c b/gc_heap.c index b18e6cb7..10bb401e 100644 --- a/gc_heap.c +++ b/gc_heap.c @@ -279,7 +279,7 @@ static int heaps_compar(const void* v1, const void* v2) { sexp_heap h1 = *((sexp_heap*)v1); sexp_heap h2 = *((sexp_heap*)v2); return - (h1 < h1) ? -1 : + (h1 < h2) ? -1 : (h1 > h2) ? 1 : 0; } @@ -315,6 +315,7 @@ sexp sexp_gc_heap_pack(sexp ctx_src, sexp_uint_t heap_free_size) { res = sexp_global(ctx_src, SEXP_G_OOM_ERROR); goto done; } sexp_heap h = sexp_context_heap(ctx_src); + for (i = 0; h; i++, h=h->next) { heaps[i] = h; } qsort(heaps, state.heaps_count, sizeof(sexp_heap), heaps_compar); /* 4. Pack the sexps into the new heap */ @@ -415,7 +416,7 @@ sexp sexp_save_image (sexp ctx_in, const char* filename) { done: if (fp) fclose(fp); if (heap) sexp_free_heap(heap); - //if (res != SEXP_TRUE) res = sexp_user_exception(ctx_in, NULL, gc_heap_err_str, NULL); + if (res != SEXP_TRUE) res = sexp_user_exception(ctx_in, NULL, gc_heap_err_str, NULL); return res; }