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 2012/04/11 18:24:42 UTC
[lucy-commits] svn commit: r1324848 - in /lucy/trunk/core/Lucy/Index: Posting/RawPosting.c
Posting/RawPosting.cfh PostingPool.c
Author: marvin
Date: Wed Apr 11 16:24:41 2012
New Revision: 1324848
URL: http://svn.apache.org/viewvc?rev=1324848&view=rev
Log:
Kill off RAWPOSTING_BLANK.
Modified:
lucy/trunk/core/Lucy/Index/Posting/RawPosting.c
lucy/trunk/core/Lucy/Index/Posting/RawPosting.cfh
lucy/trunk/core/Lucy/Index/PostingPool.c
Modified: lucy/trunk/core/Lucy/Index/Posting/RawPosting.c
URL: http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Index/Posting/RawPosting.c?rev=1324848&r1=1324847&r2=1324848&view=diff
==============================================================================
--- lucy/trunk/core/Lucy/Index/Posting/RawPosting.c (original)
+++ lucy/trunk/core/Lucy/Index/Posting/RawPosting.c Wed Apr 11 16:24:41 2012
@@ -30,17 +30,6 @@
#include "Lucy/Store/OutStream.h"
#include "Lucy/Util/StringHelper.h"
-RawPosting RAWPOSTING_BLANK = {
- RAWPOSTING,
- {1}, // ref.count
- 0, // doc_id
- 1, // freq
- 0, // content_len
- 0, // aux_len
- { '\0' } // blob
-};
-
-
RawPosting*
RawPost_new(void *pre_allocated_memory, int32_t doc_id, uint32_t freq,
char *term_text, size_t term_text_len) {
Modified: lucy/trunk/core/Lucy/Index/Posting/RawPosting.cfh
URL: http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Index/Posting/RawPosting.cfh?rev=1324848&r1=1324847&r2=1324848&view=diff
==============================================================================
--- lucy/trunk/core/Lucy/Index/Posting/RawPosting.cfh (original)
+++ lucy/trunk/core/Lucy/Index/Posting/RawPosting.cfh Wed Apr 11 16:24:41 2012
@@ -92,12 +92,3 @@ class Lucy::Index::Posting::RawPostingWr
Write_Posting(RawPostingWriter *self, RawPosting *posting);
}
-__C__
-extern lucy_RawPosting LUCY_RAWPOSTING_BLANK;
-
-#ifdef LUCY_USE_SHORT_NAMES
- #define RAWPOSTING_BLANK LUCY_RAWPOSTING_BLANK
-#endif
-__END_C__
-
-
Modified: lucy/trunk/core/Lucy/Index/PostingPool.c
URL: http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Index/PostingPool.c?rev=1324848&r1=1324847&r2=1324848&view=diff
==============================================================================
--- lucy/trunk/core/Lucy/Index/PostingPool.c (original)
+++ lucy/trunk/core/Lucy/Index/PostingPool.c Wed Apr 11 16:24:41 2012
@@ -365,13 +365,21 @@ S_write_terms_and_postings(PostingPool *
uint32_t last_text_size = CB_Get_Size(last_term_text);
SkipStepper_Set_ID_And_Filepos(skip_stepper, 0, 0);
+ // Initialize sentinel to be used on the last iter, using an empty string
+ // in order to make LexiconWriter Do The Right Thing.
+ size_t sentinel_size = VTable_Get_Obj_Alloc_Size(RAWPOSTING)
+ + 20; // blob length + cushion
+ char empty_string[] = "";
+ RawPosting *sentinel = RawPost_new(alloca(sentinel_size), 0, 1,
+ empty_string, 0);
+
while (1) {
bool_t same_text_as_last = true;
if (posting == NULL) {
// On the last iter, use an empty string to make LexiconWriter
// DTRT.
- posting = &RAWPOSTING_BLANK;
+ posting = sentinel;
same_text_as_last = false;
}
else {
@@ -409,7 +417,7 @@ S_write_terms_and_postings(PostingPool *
}
// Bail on last iter before writing invalid posting data.
- if (posting == &RAWPOSTING_BLANK) { break; }
+ if (posting == sentinel) { break; }
// Write posting data.
PostWriter_Write_Posting(post_writer, posting);