Revision
3806
Author
pthomson@apple.com
Date
2010-03-18 09:25:18 -0700 (Thu, 18 Mar 2010)

Log Message

Fix bug in rb_big_realloc (fixes ticket #615).

Modified Paths

Diff

Modified: MacRuby/trunk/bignum.c (3805 => 3806)


--- MacRuby/trunk/bignum.c	2010-03-18 08:04:59 UTC (rev 3805)
+++ MacRuby/trunk/bignum.c	2010-03-18 16:25:18 UTC (rev 3806)
@@ -105,15 +105,9 @@
 	    }
 	}
 	else {
-	    if (RBIGNUM_LEN(big) == 0) {
-		GC_WB(&RBIGNUM(big)->as.heap.digits, ALLOC_N(BDIGIT, len));
-	    }
-	    else {
-		void *tmp = ruby_xrealloc(RBIGNUM(big)->as.heap.digits, sizeof(BDIGIT) * len);
-		if (tmp != RBIGNUM(big)->as.heap.digits) {
-		    GC_WB(&RBIGNUM(big)->as.heap.digits, tmp);
-		}
-	    }
+	    RBIGNUM(big)->as.heap.digits = NULL;
+	    GC_WB(&RBIGNUM(big)->as.heap.digits, ALLOC_N(BDIGIT, len));
+	    RBIGNUM_SET_LEN(big, len);
 	}
     }
 }