You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/10/11 15:32:04 UTC
[lucy-commits] [26/50] [abbrv] git commit: refs/heads/master - Rework previous
change to SortFieldWriter
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 <we...@aevum.de>
Authored: Sat Sep 14 21:07:44 2013 +0200
Committer: Nick Wellnhofer <we...@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) {