lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [14/15] git commit: refs/heads/cfish-string-prep1 - Rework previous change to SortFieldWriter
Date Sat, 14 Sep 2013 19:29:46 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/3c9c7da1
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/3c9c7da1
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/3c9c7da1

Branch: refs/heads/cfish-string-prep1
Commit: 3c9c7da1336ca9c2ed02fcd4539010a128060908
Parents: 6f3f752
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sat Sep 14 21:07:44 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Sat Sep 14 21:07:44 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/3c9c7da1/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