You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2013/07/12 00:33:29 UTC

[lucy-commits] [04/11] git commit: refs/heads/ivars-wip1 - Fixup Lucy Util classes IVARS glitches.

Fixup Lucy Util classes IVARS glitches.

(Will be folded into earlier commit before merging to master.)


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/13387706
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/13387706
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/13387706

Branch: refs/heads/ivars-wip1
Commit: 133877061c3408daa46a56a1914d91255f14face
Parents: cc06760
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 11 15:02:08 2013 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Jul 11 15:02:08 2013 -0700

----------------------------------------------------------------------
 core/Lucy/Util/SortExternal.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/13387706/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index 4114642..6337ee1 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -198,15 +198,16 @@ S_find_endpost(SortExternal *self, SortExternalIVARS *ivars) {
     for (uint32_t i = 0, max = VA_Get_Size(ivars->runs); i < max; i++) {
         // Get a run and retrieve the last item in its cache.
         SortExternal *const run = (SortExternal*)VA_Fetch(ivars->runs, i);
-        const uint32_t tick = run->cache_max - 1;
-        if (tick >= run->cache_cap || run->cache_max < 1) {
+        SortExternalIVARS *const run_ivars = SortEx_IVARS(run);
+        const uint32_t tick = run_ivars->cache_max - 1;
+        if (tick >= run_ivars->cache_cap || run_ivars->cache_max < 1) {
             THROW(ERR, "Invalid SortExternal cache access: %u32 %u32 %u32", tick,
-                  run->cache_max, run->cache_cap);
+                  run_ivars->cache_max, run_ivars->cache_cap);
         }
         else {
             // Cache item with the highest sort value currently held in memory
             // by the run.
-            uint8_t *candidate = run->cache + tick * width;
+            uint8_t *candidate = run_ivars->cache + tick * width;
 
             // If it's the first run, item is automatically the new endpost.
             if (i == 0) {
@@ -249,9 +250,9 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
                 SortEx_Grow_Cache(self, cap);
             }
             memcpy(ivars->cache + ivars->cache_max * width,
-                   run->cache + run->cache_tick * width,
+                   run_ivars->cache + run_ivars->cache_tick * width,
                    slice_size * width);
-            run->cache_tick += slice_size;
+            run_ivars->cache_tick += slice_size;
             ivars->cache_max += slice_size;
 
             // Track number of slices and slice sizes.