gc: remove unused local variable
[nit.git] / clib / gc.c
index de0a723..19f2d9e 100644 (file)
--- a/clib/gc.c
+++ b/clib/gc.c
@@ -80,7 +80,6 @@ static val_t GC_evacuation(obj_t object) {
        bigint objectSize;
        val_t newAdress;
        Nit_NativeArray array;
-       BOX_struct box;
 
        assert(ISOBJ(object) && !ISNULL(object));
        if (GET_MARKBIT(object) != (bigint)0) {
@@ -92,7 +91,6 @@ static val_t GC_evacuation(obj_t object) {
                        array = (Nit_NativeArray)object;
                        size = sizeof(struct Nit_NativeArray) + ((array->size - 1) * sizeof(val_t));
                } else if (OBJ_IS_BOX(object)) {
-                       box = (BOX_struct)object;
                        size = sizeof(struct TBOX_struct);
                } else {
                        objectSize = (bigint)((object)[0].vft[1].i);
@@ -194,7 +192,13 @@ static void GC_prepare_heap_size(size_t size) {
 }
 
 void Nit_gc_print_usage(void) {
-       printf("GC: Size %d usage %d (%.2f%%)\n", gc_heap_size, gc_used_size, 100.0*gc_used_size/gc_heap_size);
+#if __STDC_VERSION >= 199901L
+       /* If we are compiling with standard C99 or more recent, we can use %zu. */
+       printf("GC: Size %zu usage %zu (%.2f%%)\n", gc_heap_size, gc_used_size, 100.0*gc_used_size/gc_heap_size);
+#else
+       /* We are not compiling with a standard that allows us to use %zu, let's cast the two unsigned integers into the biggest we can !*/
+       printf("GC: Size %lu usage %lu (%.2f%%)\n", (unsigned long)gc_heap_size, (unsigned long)gc_used_size, 100.0*gc_used_size/gc_heap_size);
+#endif
 }
 
 /** Enlarge the heap and collect dead objects. Can also shrink the heap.