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/02 00:29:41 UTC
[lucy-commits] [2/3] git commit: refs/heads/cfish-string-prep1 - Replace 'charbuf'
with 'string' in symbol names
Replace 'charbuf' with 'string' in symbol names
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/0af83df7
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/0af83df7
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/0af83df7
Branch: refs/heads/cfish-string-prep1
Commit: 0af83df7485706b8234e3e4c836ebf5002344be9
Parents: acec03c
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 2 00:10:00 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Sep 2 00:10:00 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/Test/TestObj.c | 14 +++----
.../runtime/core/Clownfish/Test/TestString.c | 38 +++++++++---------
clownfish/runtime/perl/t/binding/029-charbuf.t | 10 ++---
core/Lucy/Index/DocWriter.c | 2 +-
core/Lucy/Index/HighlightReader.c | 2 +-
core/Lucy/Index/HighlightWriter.c | 2 +-
core/Lucy/Index/Similarity.c | 4 +-
core/Lucy/Index/TermVector.c | 8 ++--
core/Lucy/Search/LeafQuery.c | 8 ++--
core/Lucy/Search/PhraseQuery.c | 4 +-
core/Lucy/Search/PolyQuery.c | 4 +-
core/Lucy/Search/RangeQuery.c | 4 +-
core/Lucy/Search/SortRule.c | 4 +-
core/Lucy/Search/TermQuery.c | 4 +-
core/Lucy/Test/Util/TestFreezer.c | 4 +-
core/Lucy/Util/Freezer.c | 42 ++++++++++----------
core/Lucy/Util/Freezer.cfh | 6 +--
core/LucyX/Search/ProximityQuery.c | 4 +-
perl/t/binding/029-charbuf.t | 10 ++---
19 files changed, 87 insertions(+), 87 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/clownfish/runtime/core/Clownfish/Test/TestObj.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestObj.c b/clownfish/runtime/core/Clownfish/Test/TestObj.c
index eba6122..cdc0961 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestObj.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestObj.c
@@ -103,17 +103,17 @@ test_Hash_Sum(TestBatchRunner *runner) {
static void
test_Is_A(TestBatchRunner *runner) {
- String *charbuf = Str_new(0);
- VTable *bb_vtable = Str_Get_VTable(charbuf);
- String *klass = Str_Get_Class_Name(charbuf);
+ String *string = Str_new(0);
+ VTable *str_vtable = Str_Get_VTable(string);
+ String *klass = Str_Get_Class_Name(string);
- TEST_TRUE(runner, Str_Is_A(charbuf, STRING), "String Is_A String.");
- TEST_TRUE(runner, Str_Is_A(charbuf, OBJ), "String Is_A Obj.");
- TEST_TRUE(runner, bb_vtable == STRING, "Get_VTable");
+ TEST_TRUE(runner, Str_Is_A(string, STRING), "String Is_A String.");
+ TEST_TRUE(runner, Str_Is_A(string, OBJ), "String Is_A Obj.");
+ TEST_TRUE(runner, str_vtable == STRING, "Get_VTable");
TEST_TRUE(runner, Str_Equals(VTable_Get_Name(STRING), (Obj*)klass),
"Get_Class_Name");
- DECREF(charbuf);
+ DECREF(string);
}
static void
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/clownfish/runtime/core/Clownfish/Test/TestString.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestString.c b/clownfish/runtime/core/Clownfish/Test/TestString.c
index ba8076f..9249d8d 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestString.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestString.c
@@ -224,40 +224,40 @@ test_Trim(TestBatchRunner *runner) {
static void
test_To_F64(TestBatchRunner *runner) {
- String *charbuf;
+ String *string;
- charbuf = S_get_cb("1.5");
- double difference = 1.5 - Str_To_F64(charbuf);
+ string = S_get_cb("1.5");
+ double difference = 1.5 - Str_To_F64(string);
if (difference < 0) { difference = 0 - difference; }
TEST_TRUE(runner, difference < 0.001, "To_F64");
- DECREF(charbuf);
+ DECREF(string);
- charbuf = S_get_cb("-1.5");
- difference = 1.5 + Str_To_F64(charbuf);
+ string = S_get_cb("-1.5");
+ difference = 1.5 + Str_To_F64(string);
if (difference < 0) { difference = 0 - difference; }
TEST_TRUE(runner, difference < 0.001, "To_F64 negative");
- DECREF(charbuf);
+ DECREF(string);
- charbuf = S_get_cb("1.59");
- double value_full = Str_To_F64(charbuf);
- Str_Set_Size(charbuf, 3);
- double value_short = Str_To_F64(charbuf);
+ string = S_get_cb("1.59");
+ double value_full = Str_To_F64(string);
+ Str_Set_Size(string, 3);
+ double value_short = Str_To_F64(string);
TEST_TRUE(runner, value_short < value_full,
"TO_F64 doesn't run past end of string");
- DECREF(charbuf);
+ DECREF(string);
}
static void
test_To_I64(TestBatchRunner *runner) {
- String *charbuf;
+ String *string;
- charbuf = S_get_cb("10");
- TEST_TRUE(runner, Str_To_I64(charbuf) == 10, "To_I64");
- DECREF(charbuf);
+ string = S_get_cb("10");
+ TEST_TRUE(runner, Str_To_I64(string) == 10, "To_I64");
+ DECREF(string);
- charbuf = S_get_cb("-10");
- TEST_TRUE(runner, Str_To_I64(charbuf) == -10, "To_I64 negative");
- DECREF(charbuf);
+ string = S_get_cb("-10");
+ TEST_TRUE(runner, Str_To_I64(string) == -10, "To_I64 negative");
+ DECREF(string);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/clownfish/runtime/perl/t/binding/029-charbuf.t
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/t/binding/029-charbuf.t b/clownfish/runtime/perl/t/binding/029-charbuf.t
index 23924a5..bc802e5 100644
--- a/clownfish/runtime/perl/t/binding/029-charbuf.t
+++ b/clownfish/runtime/perl/t/binding/029-charbuf.t
@@ -33,11 +33,11 @@ sub utf8_test_strings {
my ( $smiley, $not_a_smiley, $frowny ) = utf8_test_strings();
-my $charbuf = Clownfish::String->new($smiley);
-isa_ok( $charbuf, "Clownfish::String" );
-is( $charbuf->to_perl, $smiley, "round trip UTF-8" );
+my $string = Clownfish::String->new($smiley);
+isa_ok( $string, "Clownfish::String" );
+is( $string->to_perl, $smiley, "round trip UTF-8" );
-$charbuf = Clownfish::String->new($smiley);
-my $clone = $charbuf->clone;
+$string = Clownfish::String->new($smiley);
+my $clone = $string->clone;
is( $clone->to_perl, Clownfish::String->new($smiley)->to_perl, "clone" );
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Index/DocWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DocWriter.c b/core/Lucy/Index/DocWriter.c
index 5798170..cb8c9e3 100644
--- a/core/Lucy/Index/DocWriter.c
+++ b/core/Lucy/Index/DocWriter.c
@@ -112,7 +112,7 @@ DocWriter_Add_Inverted_Doc_IMP(DocWriter *self, Inverter *inverter,
if (FType_Stored(type)) {
String *field = Inverter_Get_Field_Name(inverter);
Obj *value = Inverter_Get_Value(inverter);
- Freezer_serialize_charbuf(field, dat_out);
+ Freezer_serialize_string(field, dat_out);
switch (FType_Primitive_ID(type) & FType_PRIMITIVE_ID_MASK) {
case FType_TEXT: {
uint8_t *buf = Str_Get_Ptr8((String*)value);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Index/HighlightReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/HighlightReader.c b/core/Lucy/Index/HighlightReader.c
index b76f2cb..f24c346 100644
--- a/core/Lucy/Index/HighlightReader.c
+++ b/core/Lucy/Index/HighlightReader.c
@@ -200,7 +200,7 @@ DefHLReader_Fetch_Doc_Vec_IMP(DefaultHighlightReader *self, int32_t doc_id) {
uint32_t num_fields = InStream_Read_C32(dat_in);
while (num_fields--) {
- String *field = Freezer_read_charbuf(dat_in);
+ String *field = Freezer_read_string(dat_in);
ByteBuf *field_buf = Freezer_read_bytebuf(dat_in);
DocVec_Add_Field_Buf(doc_vec, field, field_buf);
DECREF(field_buf);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Index/HighlightWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/HighlightWriter.c b/core/Lucy/Index/HighlightWriter.c
index fc89253..0d03233 100644
--- a/core/Lucy/Index/HighlightWriter.c
+++ b/core/Lucy/Index/HighlightWriter.c
@@ -130,7 +130,7 @@ HLWriter_Add_Inverted_Doc_IMP(HighlightWriter *self, Inverter *inverter,
String *field = Inverter_Get_Field_Name(inverter);
Inversion *inversion = Inverter_Get_Inversion(inverter);
ByteBuf *tv_buf = HLWriter_TV_Buf(self, inversion);
- Freezer_serialize_charbuf(field, dat_out);
+ Freezer_serialize_string(field, dat_out);
Freezer_serialize_bytebuf(tv_buf, dat_out);
DECREF(tv_buf);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Index/Similarity.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Similarity.c b/core/Lucy/Index/Similarity.c
index 9323e73..ddfbcf5 100644
--- a/core/Lucy/Index/Similarity.c
+++ b/core/Lucy/Index/Similarity.c
@@ -102,12 +102,12 @@ Sim_Load_IMP(Similarity *self, Obj *dump) {
void
Sim_Serialize_IMP(Similarity *self, OutStream *target) {
// Only the class name.
- Freezer_serialize_charbuf(Sim_Get_Class_Name(self), target);
+ Freezer_serialize_string(Sim_Get_Class_Name(self), target);
}
Similarity*
Sim_Deserialize_IMP(Similarity *self, InStream *instream) {
- String *class_name = Freezer_read_charbuf(instream);
+ String *class_name = Freezer_read_string(instream);
if (!Str_Equals(class_name, (Obj*)Sim_Get_Class_Name(self))) {
THROW(ERR, "Class name mismatch: '%o' '%o'", Sim_Get_Class_Name(self),
class_name);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Index/TermVector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/TermVector.c b/core/Lucy/Index/TermVector.c
index d8d292d..79dd977 100644
--- a/core/Lucy/Index/TermVector.c
+++ b/core/Lucy/Index/TermVector.c
@@ -86,8 +86,8 @@ TV_Serialize_IMP(TermVector *self, OutStream *target) {
int32_t *starts = I32Arr_IVARS(ivars->start_offsets)->ints;
int32_t *ends = I32Arr_IVARS(ivars->start_offsets)->ints;
- Freezer_serialize_charbuf(ivars->field, target);
- Freezer_serialize_charbuf(ivars->text, target);
+ Freezer_serialize_string(ivars->field, target);
+ Freezer_serialize_string(ivars->text, target);
OutStream_Write_C32(target, ivars->num_pos);
for (uint32_t i = 0; i < ivars->num_pos; i++) {
@@ -99,8 +99,8 @@ TV_Serialize_IMP(TermVector *self, OutStream *target) {
TermVector*
TV_Deserialize_IMP(TermVector *self, InStream *instream) {
- String *field = Freezer_read_charbuf(instream);
- String *text = Freezer_read_charbuf(instream);
+ String *field = Freezer_read_string(instream);
+ String *text = Freezer_read_string(instream);
uint32_t num_pos = InStream_Read_C32(instream);
// Read positional data.
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Search/LeafQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.c b/core/Lucy/Search/LeafQuery.c
index 488130f..9ff388c 100644
--- a/core/Lucy/Search/LeafQuery.c
+++ b/core/Lucy/Search/LeafQuery.c
@@ -88,12 +88,12 @@ LeafQuery_Serialize_IMP(LeafQuery *self, OutStream *outstream) {
LeafQueryIVARS *const ivars = LeafQuery_IVARS(self);
if (ivars->field) {
OutStream_Write_U8(outstream, true);
- Freezer_serialize_charbuf(ivars->field, outstream);
+ Freezer_serialize_string(ivars->field, outstream);
}
else {
OutStream_Write_U8(outstream, false);
}
- Freezer_serialize_charbuf(ivars->text, outstream);
+ Freezer_serialize_string(ivars->text, outstream);
OutStream_Write_F32(outstream, ivars->boost);
}
@@ -101,12 +101,12 @@ LeafQuery*
LeafQuery_Deserialize_IMP(LeafQuery *self, InStream *instream) {
LeafQueryIVARS *const ivars = LeafQuery_IVARS(self);
if (InStream_Read_U8(instream)) {
- ivars->field = Freezer_read_charbuf(instream);
+ ivars->field = Freezer_read_string(instream);
}
else {
ivars->field = NULL;
}
- ivars->text = Freezer_read_charbuf(instream);
+ ivars->text = Freezer_read_string(instream);
ivars->boost = InStream_Read_F32(instream);
return self;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Search/PhraseQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c
index f66f141..5bc3edb 100644
--- a/core/Lucy/Search/PhraseQuery.c
+++ b/core/Lucy/Search/PhraseQuery.c
@@ -78,14 +78,14 @@ void
PhraseQuery_Serialize_IMP(PhraseQuery *self, OutStream *outstream) {
PhraseQueryIVARS *const ivars = PhraseQuery_IVARS(self);
OutStream_Write_F32(outstream, ivars->boost);
- Freezer_serialize_charbuf(ivars->field, outstream);
+ Freezer_serialize_string(ivars->field, outstream);
Freezer_serialize_varray(ivars->terms, outstream);
}
PhraseQuery*
PhraseQuery_Deserialize_IMP(PhraseQuery *self, InStream *instream) {
float boost = InStream_Read_F32(instream);
- String *field = Freezer_read_charbuf(instream);
+ String *field = Freezer_read_string(instream);
VArray *terms = Freezer_read_varray(instream);
return S_do_init(self, field, terms, boost);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Search/PolyQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.c b/core/Lucy/Search/PolyQuery.c
index 45f6129..5a36db0 100644
--- a/core/Lucy/Search/PolyQuery.c
+++ b/core/Lucy/Search/PolyQuery.c
@@ -203,7 +203,7 @@ PolyCompiler_Highlight_Spans_IMP(PolyCompiler *self, Searcher *searcher,
void
PolyCompiler_Serialize_IMP(PolyCompiler *self, OutStream *outstream) {
PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self);
- Freezer_serialize_charbuf(PolyCompiler_Get_Class_Name(self), outstream);
+ Freezer_serialize_string(PolyCompiler_Get_Class_Name(self), outstream);
Freezer_serialize_varray(ivars->children, outstream);
PolyCompiler_Serialize_t super_serialize
= SUPER_METHOD_PTR(POLYCOMPILER, LUCY_PolyCompiler_Serialize);
@@ -213,7 +213,7 @@ PolyCompiler_Serialize_IMP(PolyCompiler *self, OutStream *outstream) {
PolyCompiler*
PolyCompiler_Deserialize_IMP(PolyCompiler *self, InStream *instream) {
PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self);
- String *class_name = Freezer_read_charbuf(instream);
+ String *class_name = Freezer_read_string(instream);
DECREF(class_name); // TODO Don't serialize class name.
ivars->children = Freezer_read_varray(instream);
PolyCompiler_Deserialize_t super_deserialize
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Search/RangeQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.c b/core/Lucy/Search/RangeQuery.c
index 5afad80..cbc5b74 100644
--- a/core/Lucy/Search/RangeQuery.c
+++ b/core/Lucy/Search/RangeQuery.c
@@ -120,7 +120,7 @@ void
RangeQuery_Serialize_IMP(RangeQuery *self, OutStream *outstream) {
RangeQueryIVARS *const ivars = RangeQuery_IVARS(self);
OutStream_Write_F32(outstream, ivars->boost);
- Freezer_serialize_charbuf(ivars->field, outstream);
+ Freezer_serialize_string(ivars->field, outstream);
if (ivars->lower_term) {
OutStream_Write_U8(outstream, true);
FREEZE(ivars->lower_term, outstream);
@@ -143,7 +143,7 @@ RangeQuery*
RangeQuery_Deserialize_IMP(RangeQuery *self, InStream *instream) {
// Deserialize components.
float boost = InStream_Read_F32(instream);
- String *field = Freezer_read_charbuf(instream);
+ String *field = Freezer_read_string(instream);
Obj *lower_term = InStream_Read_U8(instream) ? THAW(instream) : NULL;
Obj *upper_term = InStream_Read_U8(instream) ? THAW(instream) : NULL;
bool include_lower = InStream_Read_U8(instream);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Search/SortRule.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/SortRule.c b/core/Lucy/Search/SortRule.c
index 81af469..b129df7 100644
--- a/core/Lucy/Search/SortRule.c
+++ b/core/Lucy/Search/SortRule.c
@@ -65,7 +65,7 @@ SortRule_Deserialize_IMP(SortRule *self, InStream *instream) {
SortRuleIVARS *ivars = SortRule_IVARS(self);
ivars->type = InStream_Read_C32(instream);
if (ivars->type == SortRule_FIELD) {
- ivars->field = Freezer_read_charbuf(instream);
+ ivars->field = Freezer_read_string(instream);
}
ivars->reverse = InStream_Read_C32(instream);
return self;
@@ -76,7 +76,7 @@ SortRule_Serialize_IMP(SortRule *self, OutStream *target) {
SortRuleIVARS *ivars = SortRule_IVARS(self);
OutStream_Write_C32(target, ivars->type);
if (ivars->type == SortRule_FIELD) {
- Freezer_serialize_charbuf(ivars->field, target);
+ Freezer_serialize_string(ivars->field, target);
}
OutStream_Write_C32(target, !!ivars->reverse);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Search/TermQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.c b/core/Lucy/Search/TermQuery.c
index feb8b8b..3644834 100644
--- a/core/Lucy/Search/TermQuery.c
+++ b/core/Lucy/Search/TermQuery.c
@@ -60,7 +60,7 @@ TermQuery_Destroy_IMP(TermQuery *self) {
void
TermQuery_Serialize_IMP(TermQuery *self, OutStream *outstream) {
TermQueryIVARS *const ivars = TermQuery_IVARS(self);
- Freezer_serialize_charbuf(ivars->field, outstream);
+ Freezer_serialize_string(ivars->field, outstream);
FREEZE(ivars->term, outstream);
OutStream_Write_F32(outstream, ivars->boost);
}
@@ -68,7 +68,7 @@ TermQuery_Serialize_IMP(TermQuery *self, OutStream *outstream) {
TermQuery*
TermQuery_Deserialize_IMP(TermQuery *self, InStream *instream) {
TermQueryIVARS *const ivars = TermQuery_IVARS(self);
- ivars->field = Freezer_read_charbuf(instream);
+ ivars->field = Freezer_read_string(instream);
ivars->term = (Obj*)THAW(instream);
ivars->boost = InStream_Read_F32(instream);
return self;
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Test/Util/TestFreezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestFreezer.c b/core/Lucy/Test/Util/TestFreezer.c
index 4b4ffd6..0aab163 100644
--- a/core/Lucy/Test/Util/TestFreezer.c
+++ b/core/Lucy/Test/Util/TestFreezer.c
@@ -77,7 +77,7 @@ test_bytebuf(TestBatchRunner *runner) {
}
static void
-test_charbuf(TestBatchRunner *runner) {
+test_string(TestBatchRunner *runner) {
String *wanted = TestUtils_get_cb("foo");
String *got = (String*)S_freeze_thaw((Obj*)wanted);
TEST_TRUE(runner, got && Str_Equals(wanted, (Obj*)got),
@@ -174,7 +174,7 @@ void
TestFreezer_Run_IMP(TestFreezer *self, TestBatchRunner *runner) {
TestBatchRunner_Plan(runner, (TestBatch*)self, 10);
test_bytebuf(runner);
- test_charbuf(runner);
+ test_string(runner);
test_hash(runner);
test_num(runner);
test_varray(runner);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Util/Freezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c
index 8acf038..af425e5 100644
--- a/core/Lucy/Util/Freezer.c
+++ b/core/Lucy/Util/Freezer.c
@@ -35,13 +35,13 @@
void
Freezer_freeze(Obj *obj, OutStream *outstream) {
- Freezer_serialize_charbuf(Obj_Get_Class_Name(obj), outstream);
+ Freezer_serialize_string(Obj_Get_Class_Name(obj), outstream);
Freezer_serialize(obj, outstream);
}
Obj*
Freezer_thaw(InStream *instream) {
- String *class_name = Freezer_read_charbuf(instream);
+ String *class_name = Freezer_read_string(instream);
VTable *vtable = VTable_singleton(class_name, NULL);
Obj *blank = VTable_Make_Obj(vtable);
DECREF(class_name);
@@ -51,7 +51,7 @@ Freezer_thaw(InStream *instream) {
void
Freezer_serialize(Obj *obj, OutStream *outstream) {
if (Obj_Is_A(obj, STRING)) {
- Freezer_serialize_charbuf((String*)obj, outstream);
+ Freezer_serialize_string((String*)obj, outstream);
}
else if (Obj_Is_A(obj, BYTEBUF)) {
Freezer_serialize_bytebuf((ByteBuf*)obj, outstream);
@@ -124,7 +124,7 @@ Freezer_serialize(Obj *obj, OutStream *outstream) {
Obj*
Freezer_deserialize(Obj *obj, InStream *instream) {
if (Obj_Is_A(obj, STRING)) {
- obj = (Obj*)Freezer_deserialize_charbuf((String*)obj, instream);
+ obj = (Obj*)Freezer_deserialize_string((String*)obj, instream);
}
else if (Obj_Is_A(obj, BYTEBUF)) {
obj = (Obj*)Freezer_deserialize_bytebuf((ByteBuf*)obj, instream);
@@ -203,15 +203,15 @@ Freezer_deserialize(Obj *obj, InStream *instream) {
}
void
-Freezer_serialize_charbuf(String *charbuf, OutStream *outstream) {
- size_t size = Str_Get_Size(charbuf);
- uint8_t *buf = Str_Get_Ptr8(charbuf);
+Freezer_serialize_string(String *string, OutStream *outstream) {
+ size_t size = Str_Get_Size(string);
+ uint8_t *buf = Str_Get_Ptr8(string);
OutStream_Write_C64(outstream, size);
OutStream_Write_Bytes(outstream, buf, size);
}
String*
-Freezer_deserialize_charbuf(String *charbuf, InStream *instream) {
+Freezer_deserialize_string(String *string, InStream *instream) {
size_t size = InStream_Read_C32(instream);
if (size == SIZE_MAX) {
THROW(ERR, "Can't deserialize SIZE_MAX bytes");
@@ -223,13 +223,13 @@ Freezer_deserialize_charbuf(String *charbuf, InStream *instream) {
if (!StrHelp_utf8_valid(buf, size)) {
THROW(ERR, "Attempt to deserialize invalid UTF-8");
}
- return Str_init_steal_trusted_str(charbuf, buf, size, cap);
+ return Str_init_steal_trusted_str(string, buf, size, cap);
}
String*
-Freezer_read_charbuf(InStream *instream) {
- String *charbuf = (String*)VTable_Make_Obj(STRING);
- return Freezer_deserialize_charbuf(charbuf, instream);
+Freezer_read_string(InStream *instream) {
+ String *string = (String*)VTable_Make_Obj(STRING);
+ return Freezer_deserialize_string(string, instream);
}
void
@@ -295,7 +295,7 @@ void
Freezer_serialize_hash(Hash *hash, OutStream *outstream) {
Obj *key;
Obj *val;
- uint32_t charbuf_count = 0;
+ uint32_t string_count = 0;
uint32_t hash_size = Hash_Get_Size(hash);
OutStream_Write_C32(outstream, hash_size);
@@ -304,13 +304,13 @@ Freezer_serialize_hash(Hash *hash, OutStream *outstream) {
// we omit the per-key class name.
Hash_Iterate(hash);
while (Hash_Next(hash, &key, &val)) {
- if (Obj_Is_A(key, STRING)) { charbuf_count++; }
+ if (Obj_Is_A(key, STRING)) { string_count++; }
}
- OutStream_Write_C32(outstream, charbuf_count);
+ OutStream_Write_C32(outstream, string_count);
Hash_Iterate(hash);
while (Hash_Next(hash, &key, &val)) {
if (Obj_Is_A(key, STRING)) {
- Freezer_serialize_charbuf((String*)key, outstream);
+ Freezer_serialize_string((String*)key, outstream);
FREEZE(val, outstream);
}
}
@@ -327,15 +327,15 @@ Freezer_serialize_hash(Hash *hash, OutStream *outstream) {
Hash*
Freezer_deserialize_hash(Hash *hash, InStream *instream) {
- uint32_t size = InStream_Read_C32(instream);
- uint32_t num_charbufs = InStream_Read_C32(instream);
- uint32_t num_other = size - num_charbufs;
- String *key = num_charbufs ? Str_new(0) : NULL;
+ uint32_t size = InStream_Read_C32(instream);
+ uint32_t num_strings = InStream_Read_C32(instream);
+ uint32_t num_other = size - num_strings;
+ String *key = num_strings ? Str_new(0) : NULL;
Hash_init(hash, size);
// Read key-value pairs with String keys.
- while (num_charbufs--) {
+ while (num_strings--) {
uint32_t len = InStream_Read_C32(instream);
char *key_buf = Str_Grow(key, len);
InStream_Read_Bytes(instream, key_buf, len);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/Lucy/Util/Freezer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Freezer.cfh b/core/Lucy/Util/Freezer.cfh
index f393446..5de2474 100644
--- a/core/Lucy/Util/Freezer.cfh
+++ b/core/Lucy/Util/Freezer.cfh
@@ -56,13 +56,13 @@ inert class Lucy::Util::Freezer {
load(Obj *dump);
inert void
- serialize_charbuf(String *charbuf, OutStream *outstream);
+ serialize_string(String *string, OutStream *outstream);
inert incremented String*
- deserialize_charbuf(decremented String *charbuf, InStream *instream);
+ deserialize_string(decremented String *string, InStream *instream);
inert incremented String*
- read_charbuf(InStream *instream);
+ read_string(InStream *instream);
inert void
serialize_bytebuf(ByteBuf *bytebuf, OutStream *outstream);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/core/LucyX/Search/ProximityQuery.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.c b/core/LucyX/Search/ProximityQuery.c
index a96c44d..33e4865 100644
--- a/core/LucyX/Search/ProximityQuery.c
+++ b/core/LucyX/Search/ProximityQuery.c
@@ -82,7 +82,7 @@ void
ProximityQuery_Serialize_IMP(ProximityQuery *self, OutStream *outstream) {
ProximityQueryIVARS *const ivars = ProximityQuery_IVARS(self);
OutStream_Write_F32(outstream, ivars->boost);
- Freezer_serialize_charbuf(ivars->field, outstream);
+ Freezer_serialize_string(ivars->field, outstream);
Freezer_serialize_varray(ivars->terms, outstream);
OutStream_Write_C32(outstream, ivars->within);
}
@@ -90,7 +90,7 @@ ProximityQuery_Serialize_IMP(ProximityQuery *self, OutStream *outstream) {
ProximityQuery*
ProximityQuery_Deserialize_IMP(ProximityQuery *self, InStream *instream) {
float boost = InStream_Read_F32(instream);
- String *field = Freezer_read_charbuf(instream);
+ String *field = Freezer_read_string(instream);
VArray *terms = Freezer_read_varray(instream);
uint32_t within = InStream_Read_C32(instream);
return S_do_init(self, field, terms, boost, within);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0af83df7/perl/t/binding/029-charbuf.t
----------------------------------------------------------------------
diff --git a/perl/t/binding/029-charbuf.t b/perl/t/binding/029-charbuf.t
index 8b1d073..fd30032 100644
--- a/perl/t/binding/029-charbuf.t
+++ b/perl/t/binding/029-charbuf.t
@@ -22,11 +22,11 @@ use Lucy::Test::TestUtils qw( utf8_test_strings );
my ( $smiley, $not_a_smiley, $frowny ) = utf8_test_strings();
-my $charbuf = Clownfish::String->new($smiley);
-isa_ok( $charbuf, "Clownfish::String" );
-is( $charbuf->to_perl, $smiley, "round trip UTF-8" );
+my $string = Clownfish::String->new($smiley);
+isa_ok( $string, "Clownfish::String" );
+is( $string->to_perl, $smiley, "round trip UTF-8" );
-$charbuf = Clownfish::String->new($smiley);
-my $clone = $charbuf->clone;
+$string = Clownfish::String->new($smiley);
+my $clone = $string->clone;
is( $clone->to_perl, Clownfish::String->new($smiley)->to_perl, "clone" );