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:40 UTC
[lucy-commits] [1/3] git commit: refs/heads/cfish-string-prep1 - Fix CharBuf
DocuComments
Updated Branches:
refs/heads/cfish-string-prep1 859a53d3b -> 976a687ff
Fix CharBuf DocuComments
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/acec03c9
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/acec03c9
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/acec03c9
Branch: refs/heads/cfish-string-prep1
Commit: acec03c9089bab0270c4558452b08bb0d679eb6c
Parents: 859a53d
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Sep 1 23:26:28 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun Sep 1 23:26:28 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/CharBuf.cfh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/acec03c9/clownfish/runtime/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.cfh b/clownfish/runtime/core/Clownfish/CharBuf.cfh
index 105386c..a08ba4f 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.cfh
+++ b/clownfish/runtime/core/Clownfish/CharBuf.cfh
@@ -51,7 +51,7 @@ class Clownfish::CharBuf cnick CB
new_from_trusted_utf8(const char *utf8, size_t size);
/** Return a pointer to a new CharBuf which contains formatted data
- * expanded according to Str_VCatF.
+ * expanded according to CB_VCatF.
*
* Note: a user-supplied <code>pattern</code> string is a security hole
* and must not be allowed.
@@ -92,12 +92,12 @@ class Clownfish::CharBuf cnick CB
* hex: %x32
*
* Note that all Clownfish Objects, including CharBufs, are printed via
- * %o (which invokes Obj_To_CharBuf()).
+ * %o (which invokes Obj_To_String()).
*/
void
VCatF(CharBuf *self, const char *pattern, va_list args);
- /** Invokes Str_VCatF to concatenate formatted arguments. Note that this
+ /** Invokes CB_VCatF to concatenate formatted arguments. Note that this
* is only a function and not a method.
*/
inert void
@@ -117,7 +117,7 @@ class Clownfish::CharBuf cnick CB
char*
Grow(CharBuf *self, size_t size);
- /** Set the String's <code>size</code> attribute.
+ /** Set the CharBuf's <code>size</code> attribute.
*/
void
Set_Size(CharBuf *self, size_t size);
[lucy-commits] [3/3] git commit: refs/heads/cfish-string-prep1 - Replace 'cb' with
'str' in symbol names
Posted by nw...@apache.org.
Replace 'cb' with 'str' 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/976a687f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/976a687f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/976a687f
Branch: refs/heads/cfish-string-prep1
Commit: 976a687ffa334b0c4bf0d11b868d11ce0ee4a5d0
Parents: 0af83df
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 2 00:15:42 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Sep 2 00:28:55 2013 +0200
----------------------------------------------------------------------
c/sample/getting_started.c | 46 +--
clownfish/compiler/src/CFCPerlMethod.c | 2 +-
.../runtime/core/Clownfish/Test/TestHash.c | 30 +-
.../runtime/core/Clownfish/Test/TestString.c | 88 ++---
.../core/Clownfish/TestHarness/TestUtils.c | 2 +-
.../core/Clownfish/TestHarness/TestUtils.cfh | 2 +-
.../perl/buildlib/Clownfish/Build/Binding.pm | 2 +-
clownfish/runtime/perl/xs/XSBind.c | 14 +-
clownfish/runtime/perl/xs/XSBind.h | 4 +-
clownfish/runtime/ruby/ext/Bind.c | 8 +-
clownfish/runtime/ruby/ext/Bind.h | 2 +-
core/Lucy/Test/Plan/TestFieldMisc.c | 86 ++---
core/Lucy/Test/Search/TestQueryParser.c | 2 +-
core/Lucy/Test/Search/TestQueryParserSyntax.c | 16 +-
core/Lucy/Test/Search/TestSortSpec.c | 370 +++++++++----------
core/Lucy/Test/TestUtils.c | 32 +-
core/Lucy/Test/Util/TestFreezer.c | 8 +-
perl/buildlib/Lucy/Build/Binding/Util.pm | 2 +-
perl/xs/Lucy/Analysis/RegexTokenizer.c | 2 +-
perl/xs/Lucy/Document/Doc.c | 2 +-
20 files changed, 360 insertions(+), 360 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/c/sample/getting_started.c
----------------------------------------------------------------------
diff --git a/c/sample/getting_started.c b/c/sample/getting_started.c
index ae2e2b0..b4f697e 100644
--- a/c/sample/getting_started.c
+++ b/c/sample/getting_started.c
@@ -89,15 +89,15 @@ S_create_schema() {
FullTextType *type = FullTextType_new((Analyzer*)analyzer);
{
- String *field_cb = Str_newf("title");
- Schema_Spec_Field(schema, field_cb, (FieldType*)type);
- DECREF(field_cb);
+ String *field_str = Str_newf("title");
+ Schema_Spec_Field(schema, field_str, (FieldType*)type);
+ DECREF(field_str);
}
{
- String *field_cb = Str_newf("content");
- Schema_Spec_Field(schema, field_cb, (FieldType*)type);
- DECREF(field_cb);
+ String *field_str = Str_newf("content");
+ Schema_Spec_Field(schema, field_str, (FieldType*)type);
+ DECREF(field_str);
}
DECREF(language);
@@ -139,20 +139,20 @@ S_add_document(Indexer *indexer, const char *title, const char *content) {
{
// Store 'title' field
- String *field_cb = Str_newf("title");
- String *value_cb = Str_new_from_utf8(title, strlen(title));
- Doc_Store(doc, field_cb, (Obj*)value_cb);
- DECREF(field_cb);
- DECREF(value_cb);
+ String *field_str = Str_newf("title");
+ String *value_str = Str_new_from_utf8(title, strlen(title));
+ Doc_Store(doc, field_str, (Obj*)value_str);
+ DECREF(field_str);
+ DECREF(value_str);
}
{
// Store 'content' field
- String *field_cb = Str_newf("content");
- String *value_cb = Str_new_from_utf8(content, strlen(content));
- Doc_Store(doc, field_cb, (Obj*)value_cb);
- DECREF(field_cb);
- DECREF(value_cb);
+ String *field_str = Str_newf("content");
+ String *value_str = Str_new_from_utf8(content, strlen(content));
+ Doc_Store(doc, field_str, (Obj*)value_str);
+ DECREF(field_str);
+ DECREF(value_str);
}
Indexer_Add_Doc(indexer, doc, 1.0);
@@ -165,18 +165,18 @@ S_search(IndexSearcher *searcher, const char *query) {
printf("Searching for: %s\n", query);
// Execute search query.
- String *query_cb = Str_new_from_utf8(query, strlen(query));
- Hits *hits = IxSearcher_Hits(searcher, (Obj*)query_cb, 0, 10, NULL);
+ String *query_str = Str_new_from_utf8(query, strlen(query));
+ Hits *hits = IxSearcher_Hits(searcher, (Obj*)query_str, 0, 10, NULL);
- String *field_cb = Str_newf("title");
+ String *field_str = Str_newf("title");
HitDoc *hit;
int i = 1;
// Loop over search results.
while (NULL != (hit = Hits_Next(hits))) {
- String *value_cb = (String*)HitDoc_Extract(hit, field_cb, NULL);
+ String *value_str = (String*)HitDoc_Extract(hit, field_str, NULL);
- printf("Result %d: %s\n", i, Str_Get_Ptr8(value_cb));
+ printf("Result %d: %s\n", i, Str_Get_Ptr8(value_str));
DECREF(hit);
i++;
@@ -184,8 +184,8 @@ S_search(IndexSearcher *searcher, const char *query) {
printf("\n");
- DECREF(query_cb);
+ DECREF(query_str);
DECREF(hits);
- DECREF(field_cb);
+ DECREF(field_str);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/clownfish/compiler/src/CFCPerlMethod.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlMethod.c b/clownfish/compiler/src/CFCPerlMethod.c
index 84fc04a..a5c0bd0 100644
--- a/clownfish/compiler/src/CFCPerlMethod.c
+++ b/clownfish/compiler/src/CFCPerlMethod.c
@@ -473,7 +473,7 @@ S_callback_start(CFCMethod *method) {
if (CFCType_is_string_type(type)) {
// Convert Clownfish string type to UTF-8 Perl string scalars.
- params = CFCUtil_cat(params, " mPUSHs(XSBind_cb_to_sv(",
+ params = CFCUtil_cat(params, " mPUSHs(XSBind_str_to_sv(",
"(cfish_String*)", name, "));\n", NULL);
}
else if (CFCType_is_object(type)) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/clownfish/runtime/core/Clownfish/Test/TestHash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestHash.c b/clownfish/runtime/core/Clownfish/Test/TestHash.c
index 1e5bfcd..ef29c7a 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestHash.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestHash.c
@@ -73,10 +73,10 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
StackString *foo = SSTR_WRAP_STR("foo", 3);
for (int32_t i = 0; i < 100; i++) {
- String *cb = Str_newf("%i32", i);
- Hash_Store(hash, (Obj*)cb, (Obj*)cb);
- Hash_Store(dupe, (Obj*)cb, INCREF(cb));
- VA_Push(expected, INCREF(cb));
+ String *str = Str_newf("%i32", i);
+ Hash_Store(hash, (Obj*)str, (Obj*)str);
+ Hash_Store(dupe, (Obj*)str, INCREF(str));
+ VA_Push(expected, INCREF(str));
}
TEST_TRUE(runner, Hash_Equals(hash, (Obj*)dupe), "Equals");
@@ -135,9 +135,9 @@ test_Keys_Values_Iter(TestBatchRunner *runner) {
VArray *values;
for (uint32_t i = 0; i < 500; i++) {
- String *cb = Str_newf("%u32", i);
- Hash_Store(hash, (Obj*)cb, (Obj*)cb);
- VA_Push(expected, INCREF(cb));
+ String *str = Str_newf("%u32", i);
+ Hash_Store(hash, (Obj*)str, (Obj*)str);
+ VA_Push(expected, INCREF(str));
}
VA_Sort(expected, NULL, NULL);
@@ -190,21 +190,21 @@ test_stress(TestBatchRunner *runner) {
VArray *values;
for (uint32_t i = 0; i < 1000; i++) {
- String *cb = TestUtils_random_string(rand() % 1200);
- while (Hash_Fetch(hash, (Obj*)cb)) {
- DECREF(cb);
- cb = TestUtils_random_string(rand() % 1200);
+ String *str = TestUtils_random_string(rand() % 1200);
+ while (Hash_Fetch(hash, (Obj*)str)) {
+ DECREF(str);
+ str = TestUtils_random_string(rand() % 1200);
}
- Hash_Store(hash, (Obj*)cb, (Obj*)cb);
- VA_Push(expected, INCREF(cb));
+ Hash_Store(hash, (Obj*)str, (Obj*)str);
+ VA_Push(expected, INCREF(str));
}
VA_Sort(expected, NULL, NULL);
// Overwrite for good measure.
for (uint32_t i = 0; i < 1000; i++) {
- String *cb = (String*)VA_Fetch(expected, i);
- Hash_Store(hash, (Obj*)cb, INCREF(cb));
+ String *str = (String*)VA_Fetch(expected, i);
+ Hash_Store(hash, (Obj*)str, INCREF(str));
}
keys = Hash_Keys(hash);
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/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 9249d8d..a3da8ce 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestString.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestString.c
@@ -41,7 +41,7 @@ TestStr_new() {
}
static String*
-S_get_cb(const char *string) {
+S_get_str(const char *string) {
return Str_new_from_utf8(string, strlen(string));
}
@@ -51,19 +51,19 @@ test_Cat(TestBatchRunner *runner) {
String *source;
String *got;
- source = S_get_cb("");
+ source = S_get_str("");
got = Str_Immutable_Cat(source, wanted);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "Cat");
DECREF(got);
DECREF(source);
- source = S_get_cb("a");
+ source = S_get_str("a");
got = Str_Immutable_Cat_UTF8(source, smiley, smiley_len);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "Cat_UTF8");
DECREF(got);
DECREF(source);
- source = S_get_cb("a");
+ source = S_get_str("a");
got = Str_Immutable_Cat_Trusted_UTF8(source, smiley, smiley_len);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "Cat_Trusted_UTF8");
DECREF(got);
@@ -74,14 +74,14 @@ test_Cat(TestBatchRunner *runner) {
static void
test_Mimic_and_Clone(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo");
- String *got = S_get_cb("bar");
+ String *wanted = S_get_str("foo");
+ String *got = S_get_str("bar");
Str_Mimic(got, (Obj*)wanted);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "Mimic");
DECREF(got);
- got = S_get_cb("bar");
+ got = S_get_str("bar");
Str_Mimic_Str(got, "foo", 3);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "Mimic_Str");
DECREF(got);
@@ -96,23 +96,23 @@ test_Mimic_and_Clone(TestBatchRunner *runner) {
static void
test_Find(TestBatchRunner *runner) {
String *string;
- String *substring = S_get_cb("foo");
+ String *substring = S_get_str("foo");
- string = S_get_cb("");
+ string = S_get_str("");
TEST_TRUE(runner, Str_Find(string, substring) == -1, "Not in empty string");
DECREF(string);
- string = S_get_cb("foo");
+ string = S_get_str("foo");
TEST_TRUE(runner, Str_Find(string, substring) == 0, "Find complete string");
DECREF(string);
- string = S_get_cb("afoo");
+ string = S_get_str("afoo");
TEST_TRUE(runner, Str_Find(string, substring) == 1, "Find after first");
Str_Set_Size(string, 3);
TEST_TRUE(runner, Str_Find(string, substring) == -1, "Don't overrun");
DECREF(string);
- string = S_get_cb("afood");
+ string = S_get_str("afood");
TEST_TRUE(runner, Str_Find(string, substring) == 1, "Find in middle");
DECREF(string);
@@ -226,19 +226,19 @@ static void
test_To_F64(TestBatchRunner *runner) {
String *string;
- string = S_get_cb("1.5");
+ string = S_get_str("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(string);
- string = S_get_cb("-1.5");
+ string = S_get_str("-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(string);
- string = S_get_cb("1.59");
+ string = S_get_str("1.59");
double value_full = Str_To_F64(string);
Str_Set_Size(string, 3);
double value_short = Str_To_F64(string);
@@ -251,11 +251,11 @@ static void
test_To_I64(TestBatchRunner *runner) {
String *string;
- string = S_get_cb("10");
+ string = S_get_str("10");
TEST_TRUE(runner, Str_To_I64(string) == 10, "To_I64");
DECREF(string);
- string = S_get_cb("-10");
+ string = S_get_str("-10");
TEST_TRUE(runner, Str_To_I64(string) == -10, "To_I64 negative");
DECREF(string);
}
@@ -263,8 +263,8 @@ test_To_I64(TestBatchRunner *runner) {
static void
test_vcatf_s(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar bizzle baz");
- String *got = S_get_cb("foo ");
+ String *wanted = S_get_str("foo bar bizzle baz");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %s baz", "bizzle");
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%s");
DECREF(wanted);
@@ -273,8 +273,8 @@ test_vcatf_s(TestBatchRunner *runner) {
static void
test_vcatf_null_string(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar [NULL] baz");
- String *got = S_get_cb("foo ");
+ String *wanted = S_get_str("foo bar [NULL] baz");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %s baz", NULL);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%s NULL");
DECREF(wanted);
@@ -282,10 +282,10 @@ test_vcatf_null_string(TestBatchRunner *runner) {
}
static void
-test_vcatf_cb(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar ZEKE baz");
- String *catworthy = S_get_cb("ZEKE");
- String *got = S_get_cb("foo ");
+test_vcatf_str(TestBatchRunner *runner) {
+ String *wanted = S_get_str("foo bar ZEKE baz");
+ String *catworthy = S_get_str("ZEKE");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %o baz", catworthy);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%o String");
DECREF(catworthy);
@@ -295,9 +295,9 @@ test_vcatf_cb(TestBatchRunner *runner) {
static void
test_vcatf_obj(TestBatchRunner *runner) {
- String *wanted = S_get_cb("ooga 20 booga");
+ String *wanted = S_get_str("ooga 20 booga");
Integer32 *i32 = Int32_new(20);
- String *got = S_get_cb("ooga");
+ String *got = S_get_str("ooga");
Str_catf(got, " %o booga", i32);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%o Obj");
DECREF(i32);
@@ -307,8 +307,8 @@ test_vcatf_obj(TestBatchRunner *runner) {
static void
test_vcatf_null_obj(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar [NULL] baz");
- String *got = S_get_cb("foo ");
+ String *wanted = S_get_str("foo bar [NULL] baz");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %o baz", NULL);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%o NULL");
DECREF(wanted);
@@ -317,9 +317,9 @@ test_vcatf_null_obj(TestBatchRunner *runner) {
static void
test_vcatf_i8(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar -3 baz");
+ String *wanted = S_get_str("foo bar -3 baz");
int8_t num = -3;
- String *got = S_get_cb("foo ");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %i8 baz", num);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%i8");
DECREF(wanted);
@@ -328,9 +328,9 @@ test_vcatf_i8(TestBatchRunner *runner) {
static void
test_vcatf_i32(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar -100000 baz");
+ String *wanted = S_get_str("foo bar -100000 baz");
int32_t num = -100000;
- String *got = S_get_cb("foo ");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %i32 baz", num);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%i32");
DECREF(wanted);
@@ -339,9 +339,9 @@ test_vcatf_i32(TestBatchRunner *runner) {
static void
test_vcatf_i64(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar -5000000000 baz");
+ String *wanted = S_get_str("foo bar -5000000000 baz");
int64_t num = INT64_C(-5000000000);
- String *got = S_get_cb("foo ");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %i64 baz", num);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%i64");
DECREF(wanted);
@@ -350,9 +350,9 @@ test_vcatf_i64(TestBatchRunner *runner) {
static void
test_vcatf_u8(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar 3 baz");
+ String *wanted = S_get_str("foo bar 3 baz");
uint8_t num = 3;
- String *got = S_get_cb("foo ");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %u8 baz", num);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%u8");
DECREF(wanted);
@@ -361,9 +361,9 @@ test_vcatf_u8(TestBatchRunner *runner) {
static void
test_vcatf_u32(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar 100000 baz");
+ String *wanted = S_get_str("foo bar 100000 baz");
uint32_t num = 100000;
- String *got = S_get_cb("foo ");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %u32 baz", num);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%u32");
DECREF(wanted);
@@ -372,9 +372,9 @@ test_vcatf_u32(TestBatchRunner *runner) {
static void
test_vcatf_u64(TestBatchRunner *runner) {
- String *wanted = S_get_cb("foo bar 5000000000 baz");
+ String *wanted = S_get_str("foo bar 5000000000 baz");
uint64_t num = UINT64_C(5000000000);
- String *got = S_get_cb("foo ");
+ String *got = S_get_str("foo ");
Str_catf(got, "bar %u64 baz", num);
TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "%%u64");
DECREF(wanted);
@@ -386,7 +386,7 @@ test_vcatf_f64(TestBatchRunner *runner) {
String *wanted;
char buf[64];
float num = 1.3f;
- String *got = S_get_cb("foo ");
+ String *got = S_get_str("foo ");
sprintf(buf, "foo bar %g baz", num);
wanted = Str_new_from_trusted_utf8(buf, strlen(buf));
Str_catf(got, "bar %f64 baz", num);
@@ -400,7 +400,7 @@ test_vcatf_x32(TestBatchRunner *runner) {
String *wanted;
char buf[64];
unsigned long num = INT32_MAX;
- String *got = S_get_cb("foo ");
+ String *got = S_get_str("foo ");
#if (SIZEOF_LONG == 4)
sprintf(buf, "foo bar %.8lx baz", num);
#elif (SIZEOF_INT == 4)
@@ -418,7 +418,7 @@ TestStr_Run_IMP(TestString *self, TestBatchRunner *runner) {
TestBatchRunner_Plan(runner, (TestBatch*)self, 53);
test_vcatf_s(runner);
test_vcatf_null_string(runner);
- test_vcatf_cb(runner);
+ test_vcatf_str(runner);
test_vcatf_obj(runner);
test_vcatf_null_obj(runner);
test_vcatf_i8(runner);
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
index c7af57e..31195ed 100644
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
+++ b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
@@ -113,7 +113,7 @@ TestUtils_random_string(size_t length) {
}
String*
-TestUtils_get_cb(const char *ptr) {
+TestUtils_get_str(const char *ptr) {
return Str_new_from_utf8(ptr, strlen(ptr));
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.cfh b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.cfh
index 3e13439..90a9e36 100644
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.cfh
+++ b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.cfh
@@ -21,7 +21,7 @@ inert class Clownfish::TestHarness::TestUtils {
/** Testing-only String factory which uses strlen().
*/
inert incremented String*
- get_cb(const char *utf8);
+ get_str(const char *utf8);
/** Return a random unsigned 64-bit integer.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
index 931d357..6bed856 100644
--- a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -175,7 +175,7 @@ SV*
to_perl(self)
cfish_String *self;
CODE:
- RETVAL = XSBind_cb_to_sv(self);
+ RETVAL = XSBind_str_to_sv(self);
OUTPUT: RETVAL
MODULE = Clownfish PACKAGE = Clownfish::ViewCharBuf
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index f1e9ab1..a67e07c 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -135,7 +135,7 @@ XSBind_cfish_to_perl(cfish_Obj *obj) {
return newSV(0);
}
else if (CFISH_Obj_Is_A(obj, CFISH_STRING)) {
- return XSBind_cb_to_sv((cfish_String*)obj);
+ return XSBind_str_to_sv((cfish_String*)obj);
}
else if (CFISH_Obj_Is_A(obj, CFISH_BYTEBUF)) {
return XSBind_bb_to_sv((cfish_ByteBuf*)obj);
@@ -224,12 +224,12 @@ XSBind_bb_to_sv(const cfish_ByteBuf *bb) {
}
SV*
-XSBind_cb_to_sv(const cfish_String *cb) {
- if (!cb) {
+XSBind_str_to_sv(const cfish_String *str) {
+ if (!str) {
return newSV(0);
}
else {
- SV *sv = newSVpvn((char*)CFISH_Str_Get_Ptr8(cb), CFISH_Str_Get_Size(cb));
+ SV *sv = newSVpvn((char*)CFISH_Str_Get_Ptr8(str), CFISH_Str_Get_Size(str));
SvUTF8_on(sv);
return sv;
}
@@ -725,7 +725,7 @@ cfish_VTable_fresh_host_methods(const cfish_String *class_name) {
SAVETMPS;
EXTEND(SP, 1);
PUSHMARK(SP);
- mPUSHs(XSBind_cb_to_sv(class_name));
+ mPUSHs(XSBind_str_to_sv(class_name));
PUTBACK;
call_pv("Clownfish::VTable::_fresh_host_methods", G_SCALAR);
SPAGAIN;
@@ -743,7 +743,7 @@ cfish_VTable_find_parent_class(const cfish_String *class_name) {
SAVETMPS;
EXTEND(SP, 1);
PUSHMARK(SP);
- mPUSHs(XSBind_cb_to_sv(class_name));
+ mPUSHs(XSBind_str_to_sv(class_name));
PUTBACK;
call_pv("Clownfish::VTable::_find_parent_class", G_SCALAR);
SPAGAIN;
@@ -867,7 +867,7 @@ cfish_Err_throw_mess(cfish_VTable *vtable, cfish_String *message) {
void
cfish_Err_warn_mess(cfish_String *message) {
- SV *error_sv = XSBind_cb_to_sv(message);
+ SV *error_sv = XSBind_str_to_sv(message);
CFISH_DECREF(message);
warn("%s", SvPV_nolen(error_sv));
SvREFCNT_dec(error_sv);
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/clownfish/runtime/perl/xs/XSBind.h
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.h b/clownfish/runtime/perl/xs/XSBind.h
index 8b485fd..851422b 100644
--- a/clownfish/runtime/perl/xs/XSBind.h
+++ b/clownfish/runtime/perl/xs/XSBind.h
@@ -133,7 +133,7 @@ cfish_XSBind_bb_to_sv(const cfish_ByteBuf *bb);
/** Convert a String into a new UTF-8 string SV.
*/
CFISH_VISIBLE SV*
-cfish_XSBind_cb_to_sv(const cfish_String *cb);
+cfish_XSBind_str_to_sv(const cfish_String *str);
/** Perl-specific wrapper for Err#trap. The "routine" must be either a
* subroutine reference or the name of a subroutine.
@@ -313,7 +313,7 @@ cfish_XSBind_allot_params(SV** stack, int32_t start,
#define XSBind_cfish_to_perl cfish_XSBind_cfish_to_perl
#define XSBind_perl_to_cfish cfish_XSBind_perl_to_cfish
#define XSBind_bb_to_sv cfish_XSBind_bb_to_sv
-#define XSBind_cb_to_sv cfish_XSBind_cb_to_sv
+#define XSBind_str_to_sv cfish_XSBind_str_to_sv
#define XSBind_trap cfish_XSBind_trap
#define XSBind_enable_overload cfish_XSBind_enable_overload
#define XSBind_allot_params cfish_XSBind_allot_params
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/clownfish/runtime/ruby/ext/Bind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/ruby/ext/Bind.c b/clownfish/runtime/ruby/ext/Bind.c
index 199bba5..2113176 100644
--- a/clownfish/runtime/ruby/ext/Bind.c
+++ b/clownfish/runtime/ruby/ext/Bind.c
@@ -22,7 +22,7 @@
VALUE
Bind_cfish_to_ruby(cfish_Obj *obj) {
if (CFISH_Obj_Is_A(obj, CFISH_STRING)) {
- return Bind_cb_to_ruby((cfish_String*)obj);
+ return Bind_str_to_ruby((cfish_String*)obj);
}
else if (CFISH_Obj_Is_A(obj, CFISH_VARRAY)) {
return S_cfish_array_to_ruby_array((cfish_VArray*)obj);
@@ -30,12 +30,12 @@ Bind_cfish_to_ruby(cfish_Obj *obj) {
}
VALUE
-Bind_cb_to_ruby(const cfish_String *cb) {
- if (!cb) {
+Bind_str_to_ruby(const cfish_String *str) {
+ if (!str) {
return rb_str_new2("");
}
else {
- return rb_str_new((char*)CFISH_Str_Get_Ptr8(cb), CFISH_Str_Get_Size(cb));
+ return rb_str_new((char*)CFISH_Str_Get_Ptr8(str), CFISH_Str_Get_Size(str));
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/clownfish/runtime/ruby/ext/Bind.h
----------------------------------------------------------------------
diff --git a/clownfish/runtime/ruby/ext/Bind.h b/clownfish/runtime/ruby/ext/Bind.h
index c7740a2..cf6a2b1 100644
--- a/clownfish/runtime/ruby/ext/Bind.h
+++ b/clownfish/runtime/ruby/ext/Bind.h
@@ -35,7 +35,7 @@ extern "C" {
#include "Clownfish/VTable.h"
VALUE Bind_cfish_to_ruby(cfish_Obj *obj);
-VALUE Bind_cb_to_ruby(const cfish_String *cb);
+VALUE Bind_str_to_ruby(const cfish_String *str);
static VALUE S_cfish_array_to_ruby_array(cfish_VArray *varray);
#ifdef __cplusplus
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/core/Lucy/Test/Plan/TestFieldMisc.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFieldMisc.c b/core/Lucy/Test/Plan/TestFieldMisc.c
index 7b86b43..028ac35 100644
--- a/core/Lucy/Test/Plan/TestFieldMisc.c
+++ b/core/Lucy/Test/Plan/TestFieldMisc.c
@@ -34,14 +34,14 @@
#include "Lucy/Search/TermQuery.h"
#include "Lucy/Store/RAMFolder.h"
-static String *analyzed_cb;
-static String *easy_analyzed_cb;
-static String *state_cb;
-static String *states_cb;
-static String *string_cb;
-static String *unindexed_but_analyzed_cb;
-static String *unindexed_unanalyzed_cb;
-static String *united_states_cb;
+static String *analyzed_str;
+static String *easy_analyzed_str;
+static String *state_str;
+static String *states_str;
+static String *string_str;
+static String *unindexed_but_analyzed_str;
+static String *unindexed_unanalyzed_str;
+static String *united_states_str;
TestFieldMisc*
TestFieldMisc_new() {
@@ -50,26 +50,26 @@ TestFieldMisc_new() {
static void
S_init_strings() {
- analyzed_cb = Str_newf("analyzed");
- easy_analyzed_cb = Str_newf("easy_analyzed");
- state_cb = Str_newf("state");
- states_cb = Str_newf("States");
- string_cb = Str_newf("string");
- unindexed_but_analyzed_cb = Str_newf("unindexed_but_analyzed");
- unindexed_unanalyzed_cb = Str_newf("unindexed_unanalyzed");
- united_states_cb = Str_newf("United States");
+ analyzed_str = Str_newf("analyzed");
+ easy_analyzed_str = Str_newf("easy_analyzed");
+ state_str = Str_newf("state");
+ states_str = Str_newf("States");
+ string_str = Str_newf("string");
+ unindexed_but_analyzed_str = Str_newf("unindexed_but_analyzed");
+ unindexed_unanalyzed_str = Str_newf("unindexed_unanalyzed");
+ united_states_str = Str_newf("United States");
}
static void
S_destroy_strings() {
- DECREF(analyzed_cb);
- DECREF(easy_analyzed_cb);
- DECREF(state_cb);
- DECREF(states_cb);
- DECREF(string_cb);
- DECREF(unindexed_but_analyzed_cb);
- DECREF(unindexed_unanalyzed_cb);
- DECREF(united_states_cb);
+ DECREF(analyzed_str);
+ DECREF(easy_analyzed_str);
+ DECREF(state_str);
+ DECREF(states_str);
+ DECREF(string_str);
+ DECREF(unindexed_but_analyzed_str);
+ DECREF(unindexed_unanalyzed_str);
+ DECREF(united_states_str);
}
static Schema*
@@ -92,12 +92,12 @@ S_create_schema() {
StringType *unindexed_unanalyzed = StringType_new();
StringType_Set_Indexed(unindexed_unanalyzed, false);
- Schema_Spec_Field(schema, analyzed_cb, (FieldType*)plain);
- Schema_Spec_Field(schema, easy_analyzed_cb, (FieldType*)easy_analyzed);
- Schema_Spec_Field(schema, string_cb, (FieldType*)string_spec);
- Schema_Spec_Field(schema, unindexed_but_analyzed_cb,
+ Schema_Spec_Field(schema, analyzed_str, (FieldType*)plain);
+ Schema_Spec_Field(schema, easy_analyzed_str, (FieldType*)easy_analyzed);
+ Schema_Spec_Field(schema, string_str, (FieldType*)string_spec);
+ Schema_Spec_Field(schema, unindexed_but_analyzed_str,
(FieldType*)unindexed_but_analyzed);
- Schema_Spec_Field(schema, unindexed_unanalyzed_cb,
+ Schema_Spec_Field(schema, unindexed_unanalyzed_str,
(FieldType*)unindexed_unanalyzed);
DECREF(unindexed_unanalyzed);
@@ -115,7 +115,7 @@ S_create_schema() {
static void
S_add_doc(Indexer *indexer, String *field_name) {
Doc *doc = Doc_new(NULL, 0);
- Doc_Store(doc, field_name, (Obj*)united_states_cb);
+ Doc_Store(doc, field_name, (Obj*)united_states_str);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
}
@@ -135,7 +135,7 @@ S_check(TestBatchRunner *runner, RAMFolder *folder, String *field,
HitDoc *hit = Hits_Next(hits);
ViewCharBuf *value = (ViewCharBuf*)SStr_BLANK();
HitDoc_Extract(hit, field, value);
- TEST_TRUE(runner, Str_Equals(united_states_cb, (Obj*)value),
+ TEST_TRUE(runner, Str_Equals(united_states_str, (Obj*)value),
"%s correct doc returned", Str_Get_Ptr8(field));
DECREF(hit);
}
@@ -151,21 +151,21 @@ test_spec_field(TestBatchRunner *runner) {
Schema *schema = S_create_schema();
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
- S_add_doc(indexer, analyzed_cb);
- S_add_doc(indexer, easy_analyzed_cb);
- S_add_doc(indexer, string_cb);
- S_add_doc(indexer, unindexed_but_analyzed_cb);
- S_add_doc(indexer, unindexed_unanalyzed_cb);
+ S_add_doc(indexer, analyzed_str);
+ S_add_doc(indexer, easy_analyzed_str);
+ S_add_doc(indexer, string_str);
+ S_add_doc(indexer, unindexed_but_analyzed_str);
+ S_add_doc(indexer, unindexed_unanalyzed_str);
Indexer_Commit(indexer);
- S_check(runner, folder, analyzed_cb, states_cb, 1);
- S_check(runner, folder, easy_analyzed_cb, state_cb, 1);
- S_check(runner, folder, string_cb, united_states_cb, 1);
- S_check(runner, folder, unindexed_but_analyzed_cb, state_cb, 0);
- S_check(runner, folder, unindexed_but_analyzed_cb, united_states_cb, 0);
- S_check(runner, folder, unindexed_unanalyzed_cb, state_cb, 0);
- S_check(runner, folder, unindexed_unanalyzed_cb, united_states_cb, 0);
+ S_check(runner, folder, analyzed_str, states_str, 1);
+ S_check(runner, folder, easy_analyzed_str, state_str, 1);
+ S_check(runner, folder, string_str, united_states_str, 1);
+ S_check(runner, folder, unindexed_but_analyzed_str, state_str, 0);
+ S_check(runner, folder, unindexed_but_analyzed_str, united_states_str, 0);
+ S_check(runner, folder, unindexed_unanalyzed_str, state_str, 0);
+ S_check(runner, folder, unindexed_unanalyzed_str, united_states_str, 0);
DECREF(indexer);
DECREF(schema);
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/core/Lucy/Test/Search/TestQueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParser.c b/core/Lucy/Test/Search/TestQueryParser.c
index 4ba025d..6e0c1fa 100644
--- a/core/Lucy/Test/Search/TestQueryParser.c
+++ b/core/Lucy/Test/Search/TestQueryParser.c
@@ -41,7 +41,7 @@ TestQueryParser*
TestQP_init(TestQueryParser *self, const char *query_string, Query *tree,
Query *expanded, uint32_t num_hits) {
TestQueryParserIVARS *const ivars = TestQP_IVARS(self);
- ivars->query_string = query_string ? TestUtils_get_cb(query_string) : NULL;
+ ivars->query_string = query_string ? TestUtils_get_str(query_string) : NULL;
ivars->tree = tree ? tree : NULL;
ivars->expanded = expanded ? expanded : NULL;
ivars->num_hits = num_hits;
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/core/Lucy/Test/Search/TestQueryParserSyntax.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserSyntax.c b/core/Lucy/Test/Search/TestQueryParserSyntax.c
index a4a180e..d2aab4e 100644
--- a/core/Lucy/Test/Search/TestQueryParserSyntax.c
+++ b/core/Lucy/Test/Search/TestQueryParserSyntax.c
@@ -80,10 +80,10 @@ build_index() {
// Schema.
Schema *schema = Schema_new();
- String *plain_cb = Str_newf("plain");
- String *fancy_cb = Str_newf("fancy");
- Schema_Spec_Field(schema, plain_cb, (FieldType*)plain);
- Schema_Spec_Field(schema, fancy_cb, (FieldType*)fancy);
+ String *plain_str = Str_newf("plain");
+ String *fancy_str = Str_newf("fancy");
+ Schema_Spec_Field(schema, plain_str, (FieldType*)plain);
+ Schema_Spec_Field(schema, fancy_str, (FieldType*)fancy);
// Indexer.
RAMFolder *folder = RAMFolder_new(NULL);
@@ -94,8 +94,8 @@ build_index() {
for (uint32_t i = 0; i < VA_Get_Size(doc_set); ++i) {
String *content_string = (String*)VA_Fetch(doc_set, i);
Doc *doc = Doc_new(NULL, 0);
- Doc_Store(doc, plain_cb, (Obj*)content_string);
- Doc_Store(doc, fancy_cb, (Obj*)content_string);
+ Doc_Store(doc, plain_str, (Obj*)content_string);
+ Doc_Store(doc, fancy_str, (Obj*)content_string);
Indexer_Add_Doc(indexer, doc, 1.0);
DECREF(doc);
}
@@ -104,8 +104,8 @@ build_index() {
// Clean up.
DECREF(doc_set);
DECREF(indexer);
- DECREF(fancy_cb);
- DECREF(plain_cb);
+ DECREF(fancy_str);
+ DECREF(plain_str);
DECREF(schema);
DECREF(fancy);
DECREF(fancy_analyzer);
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index 19f11ca..3961a5e 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -41,34 +41,34 @@
#include "Lucy/Search/SortRule.h"
#include "Lucy/Store/RAMFolder.h"
-static String *air_cb;
-static String *airplane_cb;
-static String *bike_cb;
-static String *car_cb;
-static String *carrot_cb;
-static String *cat_cb;
-static String *float32_cb;
-static String *float64_cb;
-static String *food_cb;
-static String *home_cb;
-static String *int32_cb;
-static String *int64_cb;
-static String *land_cb;
-static String *name_cb;
-static String *nope_cb;
-static String *num_cb;
-static String *random_cb;
-static String *sloth_cb;
-static String *speed_cb;
-static String *unknown_cb;
-static String *unused_cb;
-static String *vehicle_cb;
-static String *weight_cb;
-
-static String *random_float32s_cb;
-static String *random_float64s_cb;
-static String *random_int32s_cb;
-static String *random_int64s_cb;
+static String *air_str;
+static String *airplane_str;
+static String *bike_str;
+static String *car_str;
+static String *carrot_str;
+static String *cat_str;
+static String *float32_str;
+static String *float64_str;
+static String *food_str;
+static String *home_str;
+static String *int32_str;
+static String *int64_str;
+static String *land_str;
+static String *name_str;
+static String *nope_str;
+static String *num_str;
+static String *random_str;
+static String *sloth_str;
+static String *speed_str;
+static String *unknown_str;
+static String *unused_str;
+static String *vehicle_str;
+static String *weight_str;
+
+static String *random_float32s_str;
+static String *random_float64s_str;
+static String *random_int32s_str;
+static String *random_int64s_str;
TestSortSpec*
TestSortSpec_new() {
@@ -77,66 +77,66 @@ TestSortSpec_new() {
static void
S_init_strings() {
- air_cb = Str_newf("air");
- airplane_cb = Str_newf("airplane");
- bike_cb = Str_newf("bike");
- car_cb = Str_newf("car");
- carrot_cb = Str_newf("carrot");
- cat_cb = Str_newf("cat");
- float32_cb = Str_newf("float32");
- float64_cb = Str_newf("float64");
- food_cb = Str_newf("food");
- home_cb = Str_newf("home");
- int32_cb = Str_newf("int32");
- int64_cb = Str_newf("int64");
- land_cb = Str_newf("land");
- name_cb = Str_newf("name");
- nope_cb = Str_newf("nope");
- num_cb = Str_newf("num");
- random_cb = Str_newf("random");
- sloth_cb = Str_newf("sloth");
- speed_cb = Str_newf("speed");
- unknown_cb = Str_newf("unknown");
- unused_cb = Str_newf("unused");
- vehicle_cb = Str_newf("vehicle");
- weight_cb = Str_newf("weight");
-
- random_float32s_cb = Str_newf("random_float32s");
- random_float64s_cb = Str_newf("random_float64s");
- random_int32s_cb = Str_newf("random_int32s");
- random_int64s_cb = Str_newf("random_int64s");
+ air_str = Str_newf("air");
+ airplane_str = Str_newf("airplane");
+ bike_str = Str_newf("bike");
+ car_str = Str_newf("car");
+ carrot_str = Str_newf("carrot");
+ cat_str = Str_newf("cat");
+ float32_str = Str_newf("float32");
+ float64_str = Str_newf("float64");
+ food_str = Str_newf("food");
+ home_str = Str_newf("home");
+ int32_str = Str_newf("int32");
+ int64_str = Str_newf("int64");
+ land_str = Str_newf("land");
+ name_str = Str_newf("name");
+ nope_str = Str_newf("nope");
+ num_str = Str_newf("num");
+ random_str = Str_newf("random");
+ sloth_str = Str_newf("sloth");
+ speed_str = Str_newf("speed");
+ unknown_str = Str_newf("unknown");
+ unused_str = Str_newf("unused");
+ vehicle_str = Str_newf("vehicle");
+ weight_str = Str_newf("weight");
+
+ random_float32s_str = Str_newf("random_float32s");
+ random_float64s_str = Str_newf("random_float64s");
+ random_int32s_str = Str_newf("random_int32s");
+ random_int64s_str = Str_newf("random_int64s");
}
static void
S_destroy_strings() {
- DECREF(air_cb);
- DECREF(airplane_cb);
- DECREF(bike_cb);
- DECREF(car_cb);
- DECREF(carrot_cb);
- DECREF(cat_cb);
- DECREF(float32_cb);
- DECREF(float64_cb);
- DECREF(food_cb);
- DECREF(home_cb);
- DECREF(int32_cb);
- DECREF(int64_cb);
- DECREF(land_cb);
- DECREF(name_cb);
- DECREF(nope_cb);
- DECREF(num_cb);
- DECREF(random_cb);
- DECREF(sloth_cb);
- DECREF(speed_cb);
- DECREF(unknown_cb);
- DECREF(unused_cb);
- DECREF(vehicle_cb);
- DECREF(weight_cb);
-
- DECREF(random_float32s_cb);
- DECREF(random_float64s_cb);
- DECREF(random_int32s_cb);
- DECREF(random_int64s_cb);
+ DECREF(air_str);
+ DECREF(airplane_str);
+ DECREF(bike_str);
+ DECREF(car_str);
+ DECREF(carrot_str);
+ DECREF(cat_str);
+ DECREF(float32_str);
+ DECREF(float64_str);
+ DECREF(food_str);
+ DECREF(home_str);
+ DECREF(int32_str);
+ DECREF(int64_str);
+ DECREF(land_str);
+ DECREF(name_str);
+ DECREF(nope_str);
+ DECREF(num_str);
+ DECREF(random_str);
+ DECREF(sloth_str);
+ DECREF(speed_str);
+ DECREF(unknown_str);
+ DECREF(unused_str);
+ DECREF(vehicle_str);
+ DECREF(weight_str);
+
+ DECREF(random_float32s_str);
+ DECREF(random_float64s_str);
+ DECREF(random_int32s_str);
+ DECREF(random_int64s_str);
}
TestReverseType*
@@ -192,18 +192,18 @@ S_create_schema() {
TestReverseType *reverse_type = TestReverseType_new();
- Schema_Spec_Field(schema, name_cb, (FieldType*)string_type);
- Schema_Spec_Field(schema, speed_cb, (FieldType*)int32_type);
- Schema_Spec_Field(schema, sloth_cb, (FieldType*)reverse_type);
- Schema_Spec_Field(schema, weight_cb, (FieldType*)int32_type);
- Schema_Spec_Field(schema, int32_cb, (FieldType*)int32_type);
- Schema_Spec_Field(schema, int64_cb, (FieldType*)int64_type);
- Schema_Spec_Field(schema, float32_cb, (FieldType*)float32_type);
- Schema_Spec_Field(schema, float64_cb, (FieldType*)float64_type);
- Schema_Spec_Field(schema, home_cb, (FieldType*)string_type);
- Schema_Spec_Field(schema, cat_cb, (FieldType*)string_type);
- Schema_Spec_Field(schema, unused_cb, (FieldType*)string_type);
- Schema_Spec_Field(schema, nope_cb, (FieldType*)unsortable);
+ Schema_Spec_Field(schema, name_str, (FieldType*)string_type);
+ Schema_Spec_Field(schema, speed_str, (FieldType*)int32_type);
+ Schema_Spec_Field(schema, sloth_str, (FieldType*)reverse_type);
+ Schema_Spec_Field(schema, weight_str, (FieldType*)int32_type);
+ Schema_Spec_Field(schema, int32_str, (FieldType*)int32_type);
+ Schema_Spec_Field(schema, int64_str, (FieldType*)int64_type);
+ Schema_Spec_Field(schema, float32_str, (FieldType*)float32_type);
+ Schema_Spec_Field(schema, float64_str, (FieldType*)float64_type);
+ Schema_Spec_Field(schema, home_str, (FieldType*)string_type);
+ Schema_Spec_Field(schema, cat_str, (FieldType*)string_type);
+ Schema_Spec_Field(schema, unused_str, (FieldType*)string_type);
+ Schema_Spec_Field(schema, nope_str, (FieldType*)unsortable);
DECREF(reverse_type);
DECREF(float64_type);
@@ -230,19 +230,19 @@ S_add_vehicle(Indexer *indexer, String *name, int32_t speed, int32_t sloth,
int32_t weight, String *home, String *cat) {
Doc *doc = Doc_new(NULL, 0);
- Doc_Store(doc, name_cb, (Obj*)name);
- Doc_Store(doc, home_cb, (Obj*)home);
- Doc_Store(doc, cat_cb, (Obj*)cat);
+ Doc_Store(doc, name_str, (Obj*)name);
+ Doc_Store(doc, home_str, (Obj*)home);
+ Doc_Store(doc, cat_str, (Obj*)cat);
String *string;
string = Str_newf("%i32", speed);
- Doc_Store(doc, speed_cb, (Obj*)string);
+ Doc_Store(doc, speed_str, (Obj*)string);
DECREF(string);
string = Str_newf("%i32", sloth);
- Doc_Store(doc, sloth_cb, (Obj*)string);
+ Doc_Store(doc, sloth_str, (Obj*)string);
DECREF(string);
string = Str_newf("%i32", weight);
- Doc_Store(doc, weight_cb, (Obj*)string);
+ Doc_Store(doc, weight_str, (Obj*)string);
DECREF(string);
Indexer_Add_Doc(indexer, doc, 1.0f);
@@ -254,8 +254,8 @@ static void
S_add_doc(Indexer *indexer, Obj *name_obj, String *cat, String *field_name) {
Doc *doc = Doc_new(NULL, 0);
String *name = Obj_To_String(name_obj);
- Doc_Store(doc, name_cb, (Obj*)name);
- Doc_Store(doc, cat_cb, (Obj*)cat);
+ Doc_Store(doc, name_str, (Obj*)name);
+ Doc_Store(doc, cat_str, (Obj*)cat);
if (field_name) {
Doc_Store(doc, field_name, (Obj*)name);
}
@@ -351,7 +351,7 @@ S_test_sorted_search(IndexSearcher *searcher, String *query,
ViewCharBuf *name = (ViewCharBuf*)SStr_BLANK();
HitDoc *hit_doc;
while (NULL != (hit_doc = Hits_Next(hits))) {
- HitDoc_Extract(hit_doc, name_cb, name);
+ HitDoc_Extract(hit_doc, name_str, name);
VA_Push(results, (Obj*)Str_Clone((String*)name));
DECREF(hit_doc);
}
@@ -371,7 +371,7 @@ typedef struct SortContext {
static void
S_attempt_sorted_search(void *context) {
SortContext *sort_ctx = (SortContext*)context;
- VArray *results = S_test_sorted_search(sort_ctx->searcher, vehicle_cb, 100,
+ VArray *results = S_test_sorted_search(sort_ctx->searcher, vehicle_str, 100,
sort_ctx->sort_field, false, NULL);
DECREF(results);
}
@@ -387,26 +387,26 @@ test_sort_spec(TestBatchRunner *runner) {
// First, add vehicles.
S_refresh_indexer(&indexer, schema, folder);
- S_add_vehicle(indexer, airplane_cb, 200, 200, 8000, air_cb, vehicle_cb);
- S_add_vehicle(indexer, bike_cb, 15, 15, 25, land_cb, vehicle_cb);
- S_add_vehicle(indexer, car_cb, 70, 70, 3000, land_cb, vehicle_cb);
+ S_add_vehicle(indexer, airplane_str, 200, 200, 8000, air_str, vehicle_str);
+ S_add_vehicle(indexer, bike_str, 15, 15, 25, land_str, vehicle_str);
+ S_add_vehicle(indexer, car_str, 70, 70, 3000, land_str, vehicle_str);
// Add random objects.
VArray *random_strings =
S_add_random_objects(&indexer, schema, folder, S_random_string,
- NULL, random_cb);
+ NULL, random_str);
VArray *random_int32s =
S_add_random_objects(&indexer, schema, folder, S_random_int32,
- int32_cb, random_int32s_cb);
+ int32_str, random_int32s_str);
VArray *random_int64s =
S_add_random_objects(&indexer, schema, folder, S_random_int64,
- int64_cb, random_int64s_cb);
+ int64_str, random_int64s_str);
VArray *random_float32s =
S_add_random_objects(&indexer, schema, folder, S_random_float32,
- float32_cb, random_float32s_cb);
+ float32_str, random_float32s_str);
VArray *random_float64s =
S_add_random_objects(&indexer, schema, folder, S_random_float64,
- float64_cb, random_float64s_cb);
+ float64_str, random_float64s_str);
// Add numbers to verify consistent ordering.
int32_t *nums = (int32_t*)MALLOCATE(100 * sizeof(int32_t));
@@ -427,7 +427,7 @@ test_sort_spec(TestBatchRunner *runner) {
char name_buf[3];
sprintf(name_buf, "%02d", nums[i]);
StackString *name = SSTR_WRAP_STR(name_buf, 2);
- S_add_doc(indexer, (Obj*)name, num_cb, NULL);
+ S_add_doc(indexer, (Obj*)name, num_str, NULL);
if (i % 10 == 0) {
S_refresh_indexer(&indexer, schema, folder);
}
@@ -441,12 +441,12 @@ test_sort_spec(TestBatchRunner *runner) {
IndexSearcher *searcher = IxSearcher_new((Obj*)folder);
- results = S_test_sorted_search(searcher, vehicle_cb, 100,
- name_cb, false, NULL);
+ results = S_test_sorted_search(searcher, vehicle_str, 100,
+ name_str, false, NULL);
VA_Clear(wanted);
- VA_Push(wanted, INCREF(airplane_cb));
- VA_Push(wanted, INCREF(bike_cb));
- VA_Push(wanted, INCREF(car_cb));
+ VA_Push(wanted, INCREF(airplane_str));
+ VA_Push(wanted, INCREF(bike_str));
+ VA_Push(wanted, INCREF(car_str));
TEST_TRUE(runner, VA_Equals(results, (Obj*)wanted), "sort by one criteria");
DECREF(results);
@@ -458,7 +458,7 @@ test_sort_spec(TestBatchRunner *runner) {
SortContext sort_ctx;
sort_ctx.searcher = searcher;
- sort_ctx.sort_field = nope_cb;
+ sort_ctx.sort_field = nope_str;
error = Err_trap(S_attempt_sorted_search, &sort_ctx);
TEST_TRUE(runner, error != NULL
&& Err_Is_A(error, ERR)
@@ -466,7 +466,7 @@ test_sort_spec(TestBatchRunner *runner) {
"sorting on a non-sortable field throws an error");
DECREF(error);
- sort_ctx.sort_field = unknown_cb;
+ sort_ctx.sort_field = unknown_str;
error = Err_trap(S_attempt_sorted_search, &sort_ctx);
TEST_TRUE(runner, error != NULL
&& Err_Is_A(error, ERR)
@@ -475,121 +475,121 @@ test_sort_spec(TestBatchRunner *runner) {
DECREF(error);
#endif
- results = S_test_sorted_search(searcher, vehicle_cb, 100,
- weight_cb, false, NULL);
+ results = S_test_sorted_search(searcher, vehicle_str, 100,
+ weight_str, false, NULL);
VA_Clear(wanted);
- VA_Push(wanted, INCREF(bike_cb));
- VA_Push(wanted, INCREF(car_cb));
- VA_Push(wanted, INCREF(airplane_cb));
+ VA_Push(wanted, INCREF(bike_str));
+ VA_Push(wanted, INCREF(car_str));
+ VA_Push(wanted, INCREF(airplane_str));
TEST_TRUE(runner, VA_Equals(results, (Obj*)wanted), "sort by one criteria");
DECREF(results);
- results = S_test_sorted_search(searcher, vehicle_cb, 100,
- name_cb, true, NULL);
+ results = S_test_sorted_search(searcher, vehicle_str, 100,
+ name_str, true, NULL);
VA_Clear(wanted);
- VA_Push(wanted, INCREF(car_cb));
- VA_Push(wanted, INCREF(bike_cb));
- VA_Push(wanted, INCREF(airplane_cb));
+ VA_Push(wanted, INCREF(car_str));
+ VA_Push(wanted, INCREF(bike_str));
+ VA_Push(wanted, INCREF(airplane_str));
TEST_TRUE(runner, VA_Equals(results, (Obj*)wanted), "reverse sort");
DECREF(results);
- results = S_test_sorted_search(searcher, vehicle_cb, 100,
- home_cb, false, name_cb, false, NULL);
+ results = S_test_sorted_search(searcher, vehicle_str, 100,
+ home_str, false, name_str, false, NULL);
VA_Clear(wanted);
- VA_Push(wanted, INCREF(airplane_cb));
- VA_Push(wanted, INCREF(bike_cb));
- VA_Push(wanted, INCREF(car_cb));
+ VA_Push(wanted, INCREF(airplane_str));
+ VA_Push(wanted, INCREF(bike_str));
+ VA_Push(wanted, INCREF(car_str));
TEST_TRUE(runner, VA_Equals(results, (Obj*)wanted), "multiple criteria");
DECREF(results);
- results = S_test_sorted_search(searcher, vehicle_cb, 100,
- home_cb, false, name_cb, true, NULL);
+ results = S_test_sorted_search(searcher, vehicle_str, 100,
+ home_str, false, name_str, true, NULL);
VA_Clear(wanted);
- VA_Push(wanted, INCREF(airplane_cb));
- VA_Push(wanted, INCREF(car_cb));
- VA_Push(wanted, INCREF(bike_cb));
+ VA_Push(wanted, INCREF(airplane_str));
+ VA_Push(wanted, INCREF(car_str));
+ VA_Push(wanted, INCREF(bike_str));
TEST_TRUE(runner, VA_Equals(results, (Obj*)wanted),
"multiple criteria with reverse");
DECREF(results);
- results = S_test_sorted_search(searcher, vehicle_cb, 100,
- speed_cb, true, NULL);
- results2 = S_test_sorted_search(searcher, vehicle_cb, 100,
- sloth_cb, false, NULL);
+ results = S_test_sorted_search(searcher, vehicle_str, 100,
+ speed_str, true, NULL);
+ results2 = S_test_sorted_search(searcher, vehicle_str, 100,
+ sloth_str, false, NULL);
TEST_TRUE(runner, VA_Equals(results, (Obj*)results2),
"FieldType_Compare_Values");
DECREF(results2);
DECREF(results);
- results = S_test_sorted_search(searcher, random_cb, 100,
- name_cb, false, NULL);
+ results = S_test_sorted_search(searcher, random_str, 100,
+ name_str, false, NULL);
TEST_TRUE(runner, VA_Equals(results, (Obj*)random_strings),
"random strings");
DECREF(results);
- results = S_test_sorted_search(searcher, random_int32s_cb, 100,
- int32_cb, false, NULL);
+ results = S_test_sorted_search(searcher, random_int32s_str, 100,
+ int32_str, false, NULL);
TEST_TRUE(runner, VA_Equals(results, (Obj*)random_int32s),
"int32");
DECREF(results);
- results = S_test_sorted_search(searcher, random_int64s_cb, 100,
- int64_cb, false, NULL);
+ results = S_test_sorted_search(searcher, random_int64s_str, 100,
+ int64_str, false, NULL);
TEST_TRUE(runner, VA_Equals(results, (Obj*)random_int64s),
"int64");
DECREF(results);
- results = S_test_sorted_search(searcher, random_float32s_cb, 100,
- float32_cb, false, NULL);
+ results = S_test_sorted_search(searcher, random_float32s_str, 100,
+ float32_str, false, NULL);
TEST_TRUE(runner, VA_Equals(results, (Obj*)random_float32s),
"float32");
DECREF(results);
- results = S_test_sorted_search(searcher, random_float64s_cb, 100,
- float64_cb, false, NULL);
+ results = S_test_sorted_search(searcher, random_float64s_str, 100,
+ float64_str, false, NULL);
TEST_TRUE(runner, VA_Equals(results, (Obj*)random_float64s),
"float64");
DECREF(results);
- String *bbbcca_cb = Str_newf("bike bike bike car car airplane");
- results = S_test_sorted_search(searcher, bbbcca_cb, 100,
- unused_cb, false, NULL);
+ String *bbbcca_str = Str_newf("bike bike bike car car airplane");
+ results = S_test_sorted_search(searcher, bbbcca_str, 100,
+ unused_str, false, NULL);
VA_Clear(wanted);
- VA_Push(wanted, INCREF(airplane_cb));
- VA_Push(wanted, INCREF(bike_cb));
- VA_Push(wanted, INCREF(car_cb));
+ VA_Push(wanted, INCREF(airplane_str));
+ VA_Push(wanted, INCREF(bike_str));
+ VA_Push(wanted, INCREF(car_str));
TEST_TRUE(runner, VA_Equals(results, (Obj*)wanted),
"sorting on field with no values sorts by doc id");
DECREF(results);
- DECREF(bbbcca_cb);
+ DECREF(bbbcca_str);
- String *nn_cb = Str_newf("99");
- String *nn_or_car_cb = Str_newf("99 OR car");
- results = S_test_sorted_search(searcher, nn_or_car_cb, 10,
- speed_cb, false, NULL);
+ String *nn_str = Str_newf("99");
+ String *nn_or_car_str = Str_newf("99 OR car");
+ results = S_test_sorted_search(searcher, nn_or_car_str, 10,
+ speed_str, false, NULL);
VA_Clear(wanted);
- VA_Push(wanted, INCREF(car_cb));
- VA_Push(wanted, INCREF(nn_cb));
+ VA_Push(wanted, INCREF(car_str));
+ VA_Push(wanted, INCREF(nn_str));
TEST_TRUE(runner, VA_Equals(results, (Obj*)wanted),
"doc with NULL value sorts last");
DECREF(results);
- DECREF(nn_cb);
- DECREF(nn_or_car_cb);
+ DECREF(nn_str);
+ DECREF(nn_or_car_str);
- results = S_test_sorted_search(searcher, num_cb, 10,
- name_cb, false, NULL);
- results2 = S_test_sorted_search(searcher, num_cb, 30,
- name_cb, false, NULL);
+ results = S_test_sorted_search(searcher, num_str, 10,
+ name_str, false, NULL);
+ results2 = S_test_sorted_search(searcher, num_str, 30,
+ name_str, false, NULL);
VA_Resize(results2, 10);
TEST_TRUE(runner, VA_Equals(results, (Obj*)results2),
"same order regardless of queue size");
DECREF(results2);
DECREF(results);
- results = S_test_sorted_search(searcher, num_cb, 10,
- name_cb, true, NULL);
- results2 = S_test_sorted_search(searcher, num_cb, 30,
- name_cb, true, NULL);
+ results = S_test_sorted_search(searcher, num_str, 10,
+ name_str, true, NULL);
+ results2 = S_test_sorted_search(searcher, num_str, 30,
+ name_str, true, NULL);
VA_Resize(results2, 10);
TEST_TRUE(runner, VA_Equals(results, (Obj*)results2),
"same order regardless of queue size (reverse sort)");
@@ -600,17 +600,17 @@ test_sort_spec(TestBatchRunner *runner) {
// Add another seg to index.
indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
- S_add_vehicle(indexer, carrot_cb, 0, 0, 1, land_cb, food_cb);
+ S_add_vehicle(indexer, carrot_str, 0, 0, 1, land_str, food_str);
Indexer_Commit(indexer);
DECREF(indexer);
searcher = IxSearcher_new((Obj*)folder);
- results = S_test_sorted_search(searcher, vehicle_cb, 100,
- name_cb, false, NULL);
+ results = S_test_sorted_search(searcher, vehicle_str, 100,
+ name_str, false, NULL);
VA_Clear(wanted);
- VA_Push(wanted, INCREF(airplane_cb));
- VA_Push(wanted, INCREF(bike_cb));
- VA_Push(wanted, INCREF(car_cb));
+ VA_Push(wanted, INCREF(airplane_str));
+ VA_Push(wanted, INCREF(bike_str));
+ VA_Push(wanted, INCREF(car_str));
TEST_TRUE(runner, VA_Equals(results, (Obj*)wanted), "Multi-segment sort");
DECREF(results);
DECREF(searcher);
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/core/Lucy/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c
index 199387f..6da1d7f 100644
--- a/core/Lucy/Test/TestUtils.c
+++ b/core/Lucy/Test/TestUtils.c
@@ -43,13 +43,13 @@ VArray*
TestUtils_doc_set() {
VArray *docs = VA_new(10);
- VA_Push(docs, (Obj*)TestUtils_get_cb("x"));
- VA_Push(docs, (Obj*)TestUtils_get_cb("y"));
- VA_Push(docs, (Obj*)TestUtils_get_cb("z"));
- VA_Push(docs, (Obj*)TestUtils_get_cb("x a"));
- VA_Push(docs, (Obj*)TestUtils_get_cb("x a b"));
- VA_Push(docs, (Obj*)TestUtils_get_cb("x a b c"));
- VA_Push(docs, (Obj*)TestUtils_get_cb("x foo a b c d"));
+ VA_Push(docs, (Obj*)TestUtils_get_str("x"));
+ VA_Push(docs, (Obj*)TestUtils_get_str("y"));
+ VA_Push(docs, (Obj*)TestUtils_get_str("z"));
+ VA_Push(docs, (Obj*)TestUtils_get_str("x a"));
+ VA_Push(docs, (Obj*)TestUtils_get_str("x a b"));
+ VA_Push(docs, (Obj*)TestUtils_get_str("x a b c"));
+ VA_Push(docs, (Obj*)TestUtils_get_str("x foo a b c d"));
return docs;
}
@@ -76,14 +76,14 @@ TestUtils_make_poly_query(uint32_t boolop, ...) {
TermQuery*
TestUtils_make_term_query(const char *field, const char *term) {
- String *field_cb = (String*)SSTR_WRAP_STR(field, strlen(field));
- String *term_cb = (String*)SSTR_WRAP_STR(term, strlen(term));
- return TermQuery_new((String*)field_cb, (Obj*)term_cb);
+ String *field_str = (String*)SSTR_WRAP_STR(field, strlen(field));
+ String *term_str = (String*)SSTR_WRAP_STR(term, strlen(term));
+ return TermQuery_new((String*)field_str, (Obj*)term_str);
}
PhraseQuery*
TestUtils_make_phrase_query(const char *field, ...) {
- String *field_cb = (String*)SSTR_WRAP_STR(field, strlen(field));
+ String *field_str = (String*)SSTR_WRAP_STR(field, strlen(field));
va_list args;
VArray *terms = VA_new(0);
PhraseQuery *query;
@@ -91,22 +91,22 @@ TestUtils_make_phrase_query(const char *field, ...) {
va_start(args, field);
while (NULL != (term_str = va_arg(args, char*))) {
- VA_Push(terms, (Obj*)TestUtils_get_cb(term_str));
+ VA_Push(terms, (Obj*)TestUtils_get_str(term_str));
}
va_end(args);
- query = PhraseQuery_new(field_cb, terms);
+ query = PhraseQuery_new(field_str, terms);
DECREF(terms);
return query;
}
LeafQuery*
TestUtils_make_leaf_query(const char *field, const char *term) {
- String *term_cb = (String*)SSTR_WRAP_STR(term, strlen(term));
- String *field_cb = field
+ String *term_str = (String*)SSTR_WRAP_STR(term, strlen(term));
+ String *field_str = field
? (String*)SSTR_WRAP_STR(field, strlen(field))
: NULL;
- return LeafQuery_new(field_cb, term_cb);
+ return LeafQuery_new(field_str, term_str);
}
NOTQuery*
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/core/Lucy/Test/Util/TestFreezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestFreezer.c b/core/Lucy/Test/Util/TestFreezer.c
index 0aab163..5b44e17 100644
--- a/core/Lucy/Test/Util/TestFreezer.c
+++ b/core/Lucy/Test/Util/TestFreezer.c
@@ -78,7 +78,7 @@ test_bytebuf(TestBatchRunner *runner) {
static void
test_string(TestBatchRunner *runner) {
- String *wanted = TestUtils_get_cb("foo");
+ String *wanted = TestUtils_get_str("foo");
String *got = (String*)S_freeze_thaw((Obj*)wanted);
TEST_TRUE(runner, got && Str_Equals(wanted, (Obj*)got),
"Round trip through FREEZE/THAW");
@@ -91,10 +91,10 @@ test_hash(TestBatchRunner *runner) {
Hash *wanted = Hash_new(0);
for (uint32_t i = 0; i < 10; i++) {
- String *cb = TestUtils_random_string(rand() % 1200);
+ String *str = TestUtils_random_string(rand() % 1200);
Integer32 *num = Int32_new(i);
- Hash_Store(wanted, (Obj*)cb, (Obj*)num);
- Hash_Store(wanted, (Obj*)num, (Obj*)cb);
+ Hash_Store(wanted, (Obj*)str, (Obj*)num);
+ Hash_Store(wanted, (Obj*)num, (Obj*)str);
}
{
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/perl/buildlib/Lucy/Build/Binding/Util.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Util.pm b/perl/buildlib/Lucy/Build/Binding/Util.pm
index e525dda..5b1532e 100644
--- a/perl/buildlib/Lucy/Build/Binding/Util.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Util.pm
@@ -214,7 +214,7 @@ latest_snapshot(folder)
CODE:
{
cfish_String *latest = lucy_IxFileNames_latest_snapshot(folder);
- RETVAL = XSBind_cb_to_sv(latest);
+ RETVAL = XSBind_str_to_sv(latest);
CFISH_DECREF(latest);
}
OUTPUT: RETVAL
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/perl/xs/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c
index 56fd3be..cba3ab0 100644
--- a/perl/xs/Lucy/Analysis/RegexTokenizer.c
+++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c
@@ -73,7 +73,7 @@ S_compile_token_re(const cfish_String *pattern) {
SAVETMPS;
EXTEND(SP, 1);
PUSHMARK(SP);
- XPUSHs(XSBind_cb_to_sv(pattern));
+ XPUSHs(XSBind_str_to_sv(pattern));
PUTBACK;
call_pv("Lucy::Analysis::RegexTokenizer::_compile_token_re", G_SCALAR);
SPAGAIN;
http://git-wip-us.apache.org/repos/asf/lucy/blob/976a687f/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index 4dedc88..74243ec 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -60,7 +60,7 @@ LUCY_Doc_Store_IMP(lucy_Doc *self, const cfish_String *field, cfish_Obj *value)
SV *val_sv = value == NULL
? newSV(0)
: CFISH_Obj_Is_A(value, CFISH_STRING)
- ? XSBind_cb_to_sv((cfish_String*)value)
+ ? XSBind_str_to_sv((cfish_String*)value)
: (SV*)CFISH_Obj_To_Host(value);
SvUTF8_on(key_sv);
(void)hv_store_ent((HV*)ivars->fields, key_sv, val_sv, 0);
[lucy-commits] [2/3] git commit: refs/heads/cfish-string-prep1 - Replace 'charbuf'
with 'string' in symbol names
Posted by nw...@apache.org.
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" );