From: Kim Nguyễn Date: Mon, 2 Apr 2012 13:00:24 +0000 (+0200) Subject: Fix bug where the Lvl2 Cache got corrupted upon resizing. X-Git-Url: http://git.nguyen.vg/gitweb/?p=SXSI%2Fxpathcomp.git;a=commitdiff_plain;h=5127077332d041b90fd1f093ddac02ae6178d617 Fix bug where the Lvl2 Cache got corrupted upon resizing. --- diff --git a/src/cache.ml b/src/cache.ml index 68cae67..dac1dbc 100644 --- a/src/cache.ml +++ b/src/cache.ml @@ -1,4 +1,3 @@ - let realloc l old_size new_size dummy = let l' = Array.create new_size dummy in for i = 0 to (min old_size new_size) - 1 do @@ -130,9 +129,9 @@ struct let add a i j k v = let line = Lvl1.find a i in if line == a.Lvl1.dummy then - let nline = { line with Lvl1.offset = ~-1 } in - Lvl2.add nline j k v; - Lvl1.add a i nline + let nline = Lvl1.create 0 line.Lvl1.dummy in + Lvl1.add a i nline; + Lvl2.add nline j k v else Lvl2.add line j k v