Settle on uint32_t for mem thresh. The memory threshold which triggers a flush could be a size_t but doesn't need to be and it's less work to settle on uint32_t.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f6a4e0af Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f6a4e0af Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f6a4e0af Branch: refs/heads/master Commit: f6a4e0af445e80b839b86f47de1fdc3dca833fba Parents: 94b48ca Author: Marvin Humphrey <[email protected]> Authored: Thu May 26 19:56:50 2016 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Thu May 26 19:56:50 2016 -0700 ---------------------------------------------------------------------- core/Lucy/Index/SortFieldWriter.c | 10 +++++----- core/Lucy/Index/SortFieldWriter.cfh | 4 ++-- core/Lucy/Index/SortWriter.c | 4 ++-- core/Lucy/Index/SortWriter.cfh | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/f6a4e0af/core/Lucy/Index/SortFieldWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c index af6d093..bf3b3e4 100644 --- a/core/Lucy/Index/SortFieldWriter.c +++ b/core/Lucy/Index/SortFieldWriter.c @@ -42,7 +42,7 @@ // Prepare to read back a run. static void -S_flip_run(SortFieldWriter *run, size_t sub_thresh, InStream *ord_in, +S_flip_run(SortFieldWriter *run, uint32_t sub_thresh, InStream *ord_in, InStream *ix_in, InStream *dat_in); // Write out a sort cache. Returns the number of unique values in the sort @@ -68,7 +68,7 @@ SI_increase_to_word_multiple(int64_t amount) { SortFieldWriter* SortFieldWriter_new(Schema *schema, Snapshot *snapshot, Segment *segment, PolyReader *polyreader, String *field, - Counter *counter, size_t mem_thresh, + Counter *counter, uint32_t mem_thresh, OutStream *temp_ord_out, OutStream *temp_ix_out, OutStream *temp_dat_out) { SortFieldWriter *self @@ -82,7 +82,7 @@ SortFieldWriter* SortFieldWriter_init(SortFieldWriter *self, Schema *schema, Snapshot *snapshot, Segment *segment, PolyReader *polyreader, String *field, - Counter *counter, size_t mem_thresh, + Counter *counter, uint32_t mem_thresh, OutStream *temp_ord_out, OutStream *temp_ix_out, OutStream *temp_dat_out) { // Init. @@ -518,7 +518,7 @@ SortFieldWriter_Flip_IMP(SortFieldWriter *self) { if (!ivars->dat_in) { RETHROW(INCREF(Err_get_error())); } // Assign streams and a slice of mem_thresh. - size_t sub_thresh = ivars->mem_thresh / num_runs; + uint32_t sub_thresh = ivars->mem_thresh / num_runs; if (sub_thresh < 65536) { sub_thresh = 65536; } for (size_t i = 0; i < num_runs; i++) { SortFieldWriter *run = (SortFieldWriter*)Vec_Fetch(ivars->runs, i); @@ -682,7 +682,7 @@ SortFieldWriter_Finish_IMP(SortFieldWriter *self) { } static void -S_flip_run(SortFieldWriter *run, size_t sub_thresh, InStream *ord_in, +S_flip_run(SortFieldWriter *run, uint32_t sub_thresh, InStream *ord_in, InStream *ix_in, InStream *dat_in) { SortFieldWriterIVARS *const run_ivars = SortFieldWriter_IVARS(run); http://git-wip-us.apache.org/repos/asf/lucy/blob/f6a4e0af/core/Lucy/Index/SortFieldWriter.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortFieldWriter.cfh b/core/Lucy/Index/SortFieldWriter.cfh index f0bcdea..73675fe 100644 --- a/core/Lucy/Index/SortFieldWriter.cfh +++ b/core/Lucy/Index/SortFieldWriter.cfh @@ -54,13 +54,13 @@ class Lucy::Index::SortFieldWriter inert incremented SortFieldWriter* new(Schema *schema, Snapshot *snapshot, Segment *segment, PolyReader *polyreader, String *field, Counter *counter, - size_t mem_thresh, OutStream *temp_ord_out, OutStream *temp_ix_out, + uint32_t mem_thresh, OutStream *temp_ord_out, OutStream *temp_ix_out, OutStream *temp_dat_out); inert SortFieldWriter* init(SortFieldWriter *self, Schema *schema, Snapshot *snapshot, Segment *segment, PolyReader *polyreader, String *field, - Counter *counter, size_t mem_thresh, OutStream *temp_ord_out, + Counter *counter, uint32_t mem_thresh, OutStream *temp_ord_out, OutStream *temp_ix_out, OutStream *temp_dat_out); void http://git-wip-us.apache.org/repos/asf/lucy/blob/f6a4e0af/core/Lucy/Index/SortWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortWriter.c b/core/Lucy/Index/SortWriter.c index f91b8b1..651f062 100644 --- a/core/Lucy/Index/SortWriter.c +++ b/core/Lucy/Index/SortWriter.c @@ -38,7 +38,7 @@ int32_t SortWriter_current_file_format = 3; -static size_t default_mem_thresh = 0x400000; // 4 MB +static uint32_t default_mem_thresh = 0x400000; // 4 MB SortWriter* SortWriter_new(Schema *schema, Snapshot *snapshot, Segment *segment, @@ -84,7 +84,7 @@ SortWriter_Destroy_IMP(SortWriter *self) { } void -SortWriter_set_default_mem_thresh(size_t mem_thresh) { +SortWriter_set_default_mem_thresh(uint32_t mem_thresh) { default_mem_thresh = mem_thresh; } http://git-wip-us.apache.org/repos/asf/lucy/blob/f6a4e0af/core/Lucy/Index/SortWriter.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortWriter.cfh b/core/Lucy/Index/SortWriter.cfh index 52296b2..f31ea69 100644 --- a/core/Lucy/Index/SortWriter.cfh +++ b/core/Lucy/Index/SortWriter.cfh @@ -36,7 +36,7 @@ class Lucy::Index::SortWriter inherits Lucy::Index::DataWriter { OutStream *temp_ix_out; OutStream *temp_dat_out; Counter *counter; - size_t mem_thresh; + uint32_t mem_thresh; bool flush_at_finish; inert int32_t current_file_format; @@ -51,7 +51,7 @@ class Lucy::Index::SortWriter inherits Lucy::Index::DataWriter { /* Test only. */ inert void - set_default_mem_thresh(size_t mem_thresh); + set_default_mem_thresh(uint32_t mem_thresh); void Add_Inverted_Doc(SortWriter *self, Inverter *inverter, int32_t doc_id);
