lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [26/50] [abbrv] git commit: refs/heads/master - Rework previous change to SortFieldWriter
Date Fri, 11 Oct 2013 13:32:04 GMT
Rework previous change to SortFieldWriter

I'm still not sure whether this is safe.


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

Branch: refs/heads/master
Commit: 7ba4174cfbe66f4ab097ce3f6d5578ee3be72a36
Parents: 2e8f892
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sat Sep 14 21:07:44 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Fri Oct 11 15:28:17 2013 +0200

----------------------------------------------------------------------
 core/Lucy/Index/SortFieldWriter.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/7ba4174c/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 86bb84d..bf08089 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -552,7 +552,7 @@ S_write_files(SortFieldWriter *self, OutStream *ord_out, OutStream *ix_out,
     ords[0] = 0;
 
     // Build array of ords, write non-NULL sorted values.
-    Obj *val = elem->value;
+    Obj *val = INCREF(elem->value);
     Obj *last_val_address = elem->value;
     S_write_val(elem->value, prim_id, ix_out, dat_out, dat_start);
     while (NULL != (elem = (SFWriterElem*)SortFieldWriter_Fetch(self))) {
@@ -562,12 +562,14 @@ S_write_files(SortFieldWriter *self, OutStream *ord_out, OutStream *ix_out,
             if (comparison != 0) {
                 ord++;
                 S_write_val(elem->value, prim_id, ix_out, dat_out, dat_start);
-                val = elem->value;
+                DECREF(val);
+                val = INCREF(elem->value);
             }
             last_val_address = elem->value;
         }
         ords[elem->doc_id] = ord;
     }
+    DECREF(val);
 
     // If there are NULL values, write one now and record the NULL ord.
     if (has_nulls) {


Mime
View raw message