[MLton-commit] r5220

Wesley Terpstra wesley at mlton.org
Fri Feb 16 08:47:49 PST 2007


two free-list bugs
----------------------------------------------------------------------

U   mltonlib/trunk/ca/terpstra/sqlite3/buffer.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/ca/terpstra/sqlite3/buffer.sml
===================================================================
--- mltonlib/trunk/ca/terpstra/sqlite3/buffer.sml	2007-02-16 16:39:02 UTC (rev 5219)
+++ mltonlib/trunk/ca/terpstra/sqlite3/buffer.sml	2007-02-16 16:47:48 UTC (rev 5220)
@@ -23,7 +23,7 @@
          let
             val oldlen = Array.length (!buf)
             val newlen = oldlen  * 2
-            fun get i = if i = oldlen then FREE ~1 else
+            fun get i = if i = oldlen then FREE (IntX.fromInt (!free)) else
                         if i > oldlen then FREE (IntX.fromInt (i-1)) else
                         Array.sub (!buf, i)
             val () = buf := Array.tabulate (newlen, get)
@@ -37,7 +37,7 @@
             FULL _ => raise Fail "Buggy free list in Buffer.push"
           | FREE n => (
                Array.update (!buf, !free, FULL v);
-               !free before free := IntX.toInt n + 1))
+               !free before free := IntX.toInt n))
       
       fun free ({ buf, free }, i) = (
 (*




More information about the MLton-commit mailing list