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/09/14 21:29:46 UTC
[lucy-commits] [14/15] git commit: refs/heads/cfish-string-prep1 - 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/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 <we...@aevum.de>
Authored: Sat Sep 14 21:07:44 2013 +0200
Committer: Nick Wellnhofer <we...@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) {