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/10/11 15:31:39 UTC
[lucy-commits] [01/50] [abbrv] git commit: refs/heads/master - Eliminate Obj_Mimic
in SortFieldWriter
Updated Branches:
refs/heads/master ad1a85f92 -> 668e82a94
Eliminate Obj_Mimic in SortFieldWriter
This is probably wrong but it doesn't break any tests.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7f999655
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7f999655
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7f999655
Branch: refs/heads/master
Commit: 7f999655dc3ce201badadfb9a06f684cb45b023a
Parents: 195985e
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Sep 10 01:54:24 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:13 2013 +0200
----------------------------------------------------------------------
core/Lucy/Index/SortFieldWriter.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/7f999655/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index b251123..5e4f173 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -552,7 +552,7 @@ S_write_files(SortFieldWriter *self, OutStream *ord_out, OutStream *ix_out,
ords[0] = 0;
// Build array of ords, write non-NULL sorted values.
- Obj *val = Obj_Clone(elem->value);
+ Obj *val = elem->value;
Obj *last_val_address = elem->value;
S_write_val(elem->value, prim_id, ix_out, dat_out, dat_start);
while (NULL != (elem = (SFWriterElem*)SortFieldWriter_Fetch(self))) {
@@ -562,13 +562,12 @@ S_write_files(SortFieldWriter *self, OutStream *ord_out, OutStream *ix_out,
if (comparison != 0) {
ord++;
S_write_val(elem->value, prim_id, ix_out, dat_out, dat_start);
- Obj_Mimic(val, elem->value);
+ val = elem->value;
}
last_val_address = elem->value;
}
ords[elem->doc_id] = ord;
}
- DECREF(val);
// If there are NULL values, write one now and record the NULL ord.
if (has_nulls) {
[lucy-commits] [40/50] [abbrv] git commit: refs/heads/master - Remove useless
function S_grow in CharBuf
Posted by nw...@apache.org.
Remove useless function S_grow in CharBuf
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/256d32c0
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/256d32c0
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/256d32c0
Branch: refs/heads/master
Commit: 256d32c0ec7e0ac85d6f27cea25a78b06b17a841
Parents: f079ab9
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 18:23:26 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:20 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/CharBuf.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/256d32c0/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 893d0f5..6eb9c2e 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -116,13 +116,6 @@ CB_Destroy_IMP(CharBuf *self) {
SUPER_DESTROY(self, CHARBUF);
}
-static void
-S_grow(CharBuf *self, size_t size) {
- if (size >= self->cap) {
- CB_Grow(self, size);
- }
-}
-
char*
CB_Grow_IMP(CharBuf *self, size_t size) {
if (size >= self->cap) {
@@ -315,7 +308,7 @@ void
CB_Cat_Char_IMP(CharBuf *self, int32_t code_point) {
const size_t MAX_UTF8_BYTES = 4;
if (self->size + MAX_UTF8_BYTES >= self->cap) {
- S_grow(self, Memory_oversize(self->size + MAX_UTF8_BYTES,
+ CB_Grow(self, Memory_oversize(self->size + MAX_UTF8_BYTES,
sizeof(char)));
}
char *end = self->ptr + self->size;
@@ -334,7 +327,7 @@ CB_Mimic_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
}
- if (size >= self->cap) { S_grow(self, size); }
+ if (size >= self->cap) { CB_Grow(self, size); }
memmove(self->ptr, ptr, size);
self->size = size;
self->ptr[size] = '\0';
@@ -344,14 +337,14 @@ void
CB_Mimic_IMP(CharBuf *self, Obj *other) {
if (Obj_Is_A(other, CHARBUF)) {
CharBuf *twin = (CharBuf*)other;
- if (twin->size >= self->cap) { S_grow(self, twin->size); }
+ if (twin->size >= self->cap) { CB_Grow(self, twin->size); }
memmove(self->ptr, twin->ptr, twin->size);
self->size = twin->size;
self->ptr[twin->size] = '\0';
}
else if (Obj_Is_A(other, STRING)) {
String *twin = (String*)other;
- if (twin->size >= self->cap) { S_grow(self, twin->size); }
+ if (twin->size >= self->cap) { CB_Grow(self, twin->size); }
memmove(self->ptr, twin->ptr, twin->size);
self->size = twin->size;
self->ptr[twin->size] = '\0';
@@ -374,7 +367,7 @@ CB_Cat_Trusted_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
const size_t new_size = self->size + size;
if (new_size >= self->cap) {
size_t amount = Memory_oversize(new_size, sizeof(char));
- S_grow(self, amount);
+ CB_Grow(self, amount);
}
memcpy((self->ptr + self->size), ptr, size);
self->size = new_size;
@@ -386,7 +379,7 @@ CB_Cat_IMP(CharBuf *self, String *string) {
const size_t new_size = self->size + string->size;
if (new_size >= self->cap) {
size_t amount = Memory_oversize(new_size, sizeof(char));
- S_grow(self, amount);
+ CB_Grow(self, amount);
}
memcpy((self->ptr + self->size), string->ptr, string->size);
self->size = new_size;
[lucy-commits] [32/50] [abbrv] git commit: refs/heads/master - Rename SSTR_WRAP_STR
to SSTR_WRAP_UTF8
Posted by nw...@apache.org.
Rename SSTR_WRAP_STR to SSTR_WRAP_UTF8
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/87746f2f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/87746f2f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/87746f2f
Branch: refs/heads/master
Commit: 87746f2fb1b2225f7ccb5837ac97c308bbac5fb0
Parents: 84ce63e
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 16:14:42 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:18 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Index/DocReader.c | 2 +-
clownfish/compiler/src/CFCPerlTypeMap.c | 2 +-
clownfish/compiler/src/CFCRuby.c | 2 +-
clownfish/runtime/core/Clownfish/Hash.c | 6 +-
clownfish/runtime/core/Clownfish/String.cfh | 6 +-
.../runtime/core/Clownfish/Test/TestHash.c | 12 ++--
clownfish/runtime/core/Clownfish/Test/TestObj.c | 2 +-
.../runtime/core/Clownfish/Test/TestVArray.c | 2 +-
clownfish/runtime/core/Clownfish/VTable.c | 2 +-
.../perl/buildlib/Clownfish/Build/Binding.pm | 2 +-
clownfish/runtime/perl/xs/XSBind.c | 2 +-
core/Lucy/Index/FilePurger.c | 2 +-
core/Lucy/Index/IndexManager.c | 12 ++--
core/Lucy/Index/PolyReader.c | 2 +-
core/Lucy/Index/Segment.c | 2 +-
core/Lucy/Plan/Schema.c | 2 +-
core/Lucy/Store/CompoundFileReader.c | 8 +--
core/Lucy/Store/CompoundFileWriter.c | 12 ++--
core/Lucy/Store/FSFolder.c | 2 +-
core/Lucy/Store/Lock.c | 2 +-
core/Lucy/Store/SharedLock.c | 4 +-
core/Lucy/Test/Analysis/TestNormalizer.c | 4 +-
core/Lucy/Test/Analysis/TestPolyAnalyzer.c | 6 +-
core/Lucy/Test/Analysis/TestRegexTokenizer.c | 4 +-
core/Lucy/Test/Analysis/TestSnowballStemmer.c | 4 +-
core/Lucy/Test/Analysis/TestStandardTokenizer.c | 2 +-
core/Lucy/Test/Highlight/TestHighlighter.c | 60 ++++++++++----------
core/Lucy/Test/Index/TestSegment.c | 10 ++--
core/Lucy/Test/Index/TestSnapshot.c | 12 ++--
core/Lucy/Test/Plan/TestFieldType.c | 6 +-
core/Lucy/Test/Plan/TestFullTextType.c | 4 +-
core/Lucy/Test/Search/TestQueryParserLogic.c | 4 +-
core/Lucy/Test/Search/TestSortSpec.c | 2 +-
core/Lucy/Test/Store/TestFSDirHandle.c | 8 +--
core/Lucy/Test/Store/TestFSFileHandle.c | 8 +--
core/Lucy/Test/Store/TestFSFolder.c | 18 +++---
core/Lucy/Test/Store/TestFileHandle.c | 4 +-
core/Lucy/Test/Store/TestInStream.c | 4 +-
core/Lucy/Test/Store/TestRAMDirHandle.c | 6 +-
core/Lucy/Test/TestSchema.c | 4 +-
core/Lucy/Test/TestUtils.c | 16 +++---
core/Lucy/Test/Util/TestIndexFileNames.c | 4 +-
core/Lucy/Test/Util/TestJson.c | 8 +--
core/Lucy/Util/Json.c | 2 +-
perl/buildlib/Lucy/Build/Binding/Misc.pm | 2 +-
perl/xs/Lucy/Index/DocReader.c | 2 +-
perl/xs/Lucy/Index/Inverter.c | 2 +-
47 files changed, 147 insertions(+), 147 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index 31a1077..ebd213c 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -67,7 +67,7 @@ DefDocReader_Fetch_Doc_IMP(DefaultDocReader *self, int32_t doc_id) {
// Find the Field's FieldType.
StackString *field_name_zcb
- = SSTR_WRAP_STR(field_name, field_name_len);
+ = SSTR_WRAP_UTF8(field_name, field_name_len);
type = Schema_Fetch_Type(schema, (String*)field_name_zcb);
// Read the field value.
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/clownfish/compiler/src/CFCPerlTypeMap.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlTypeMap.c b/clownfish/compiler/src/CFCPerlTypeMap.c
index f568e15..6ce222f 100644
--- a/clownfish/compiler/src/CFCPerlTypeMap.c
+++ b/clownfish/compiler/src/CFCPerlTypeMap.c
@@ -234,7 +234,7 @@ static const char typemap_input[] =
" $var = (sizeof(UV) == 8) ? ($type)SvUV($arg) : ($type)SvNV($arg);\n"
"\n"
"CONST_CHARBUF\n"
- " $var = (const cfish_String*)CFISH_SSTR_WRAP_STR(SvPVutf8_nolen($arg), SvCUR($arg));\n"
+ " $var = (const cfish_String*)CFISH_SSTR_WRAP_UTF8(SvPVutf8_nolen($arg), SvCUR($arg));\n"
"\n";
static const char typemap_output[] =
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/clownfish/compiler/src/CFCRuby.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCRuby.c b/clownfish/compiler/src/CFCRuby.c
index b225fd9..b69b9d2 100644
--- a/clownfish/compiler/src/CFCRuby.c
+++ b/clownfish/compiler/src/CFCRuby.c
@@ -205,7 +205,7 @@ S_write_boot_c(CFCRuby *self) {
"%s() {\n"
" %sbootstrap_parcel();\n"
"\n"
- " cfish_StackString *alias = CFISH_SSTR_WRAP_STR(\"\", 0);\n"
+ " cfish_StackString *alias = CFISH_SSTR_WRAP_UTF8(\"\", 0);\n"
"}\n"
"\n"
"%s\n"
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/clownfish/runtime/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.c b/clownfish/runtime/core/Clownfish/Hash.c
index 02e9794..fd78864 100644
--- a/clownfish/runtime/core/Clownfish/Hash.c
+++ b/clownfish/runtime/core/Clownfish/Hash.c
@@ -160,7 +160,7 @@ Hash_Store_IMP(Hash *self, Obj *key, Obj *value) {
void
Hash_Store_Utf8_IMP(Hash *self, const char *key, size_t key_len, Obj *value) {
- StackString *key_buf = SSTR_WRAP_STR((char*)key, key_len);
+ StackString *key_buf = SSTR_WRAP_UTF8((char*)key, key_len);
Hash_do_store(self, (Obj*)key_buf, value,
SStr_Hash_Sum(key_buf), false);
}
@@ -174,7 +174,7 @@ Hash_Make_Key_IMP(Hash *self, Obj *key, int32_t hash_sum) {
Obj*
Hash_Fetch_Utf8_IMP(Hash *self, const char *key, size_t key_len) {
- StackString *key_buf = SSTR_WRAP_STR(key, key_len);
+ StackString *key_buf = SSTR_WRAP_UTF8(key, key_len);
return Hash_Fetch_IMP(self, (Obj*)key_buf);
}
@@ -226,7 +226,7 @@ Hash_Delete_IMP(Hash *self, const Obj *key) {
Obj*
Hash_Delete_Utf8_IMP(Hash *self, const char *key, size_t key_len) {
- StackString *key_buf = SSTR_WRAP_STR(key, key_len);
+ StackString *key_buf = SSTR_WRAP_UTF8(key, key_len);
return Hash_Delete_IMP(self, (Obj*)key_buf);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index c4ea6d5..b66bbf5 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -433,7 +433,7 @@ __C__
#define CFISH_SSTR_WRAP(source) \
cfish_SStr_wrap(cfish_alloca(cfish_SStr_size()), source)
-#define CFISH_SSTR_WRAP_STR(ptr, size) \
+#define CFISH_SSTR_WRAP_UTF8(ptr, size) \
cfish_SStr_wrap_str(cfish_alloca(cfish_SStr_size()), ptr, size)
#define CFISH_STRITER_DONE -1
@@ -441,8 +441,8 @@ __C__
#ifdef CFISH_USE_SHORT_NAMES
#define SSTR_BLANK CFISH_SSTR_BLANK
#define SSTR_WRAP CFISH_SSTR_WRAP
- #define SSTR_WRAP_STR CFISH_SSTR_WRAP_STR
- #define STRITER_DONE CFISH_STRITER_DONE
+ #define SSTR_WRAP_UTF8 CFISH_SSTR_WRAP_UTF8
+ #define STRITER_DONE CFISH_STRITER_DONE
#endif
__END_C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/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 cb93b2e..e5000c9 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestHash.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestHash.c
@@ -40,7 +40,7 @@ static void
test_Equals(TestBatchRunner *runner) {
Hash *hash = Hash_new(0);
Hash *other = Hash_new(0);
- StackString *stuff = SSTR_WRAP_STR("stuff", 5);
+ StackString *stuff = SSTR_WRAP_UTF8("stuff", 5);
TEST_TRUE(runner, Hash_Equals(hash, (Obj*)other),
"Empty hashes are equal");
@@ -68,9 +68,9 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
const uint32_t starting_cap = Hash_Get_Capacity(hash);
VArray *expected = VA_new(100);
VArray *got = VA_new(100);
- StackString *twenty = SSTR_WRAP_STR("20", 2);
- StackString *forty = SSTR_WRAP_STR("40", 2);
- StackString *foo = SSTR_WRAP_STR("foo", 3);
+ StackString *twenty = SSTR_WRAP_UTF8("20", 2);
+ StackString *forty = SSTR_WRAP_UTF8("40", 2);
+ StackString *foo = SSTR_WRAP_UTF8("foo", 3);
for (int32_t i = 0; i < 100; i++) {
String *str = Str_newf("%i32", i);
@@ -168,8 +168,8 @@ test_Keys_Values_Iter(TestBatchRunner *runner) {
TEST_TRUE(runner, VA_Equals(values, (Obj*)expected), "Values from Iter");
{
- StackString *forty = SSTR_WRAP_STR("40", 2);
- StackString *nope = SSTR_WRAP_STR("nope", 4);
+ StackString *forty = SSTR_WRAP_UTF8("40", 2);
+ StackString *nope = SSTR_WRAP_UTF8("nope", 4);
Obj *key = Hash_Find_Key(hash, (Obj*)forty, SStr_Hash_Sum(forty));
TEST_TRUE(runner, Obj_Equals(key, (Obj*)forty), "Find_Key");
key = Hash_Find_Key(hash, (Obj*)nope, SStr_Hash_Sum(nope)),
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/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 4466ef0..63e2bae 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestObj.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestObj.c
@@ -37,7 +37,7 @@ TestObj_new() {
static Obj*
S_new_testobj() {
- StackString *klass = SSTR_WRAP_STR("TestObj", 7);
+ StackString *klass = SSTR_WRAP_UTF8("TestObj", 7);
Obj *obj;
VTable *vtable = VTable_fetch_vtable((String*)klass);
if (!vtable) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/clownfish/runtime/core/Clownfish/Test/TestVArray.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestVArray.c b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
index 4aa9ccd..06c1590 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestVArray.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
@@ -41,7 +41,7 @@ static void
test_Equals(TestBatchRunner *runner) {
VArray *array = VA_new(0);
VArray *other = VA_new(0);
- StackString *stuff = SSTR_WRAP_STR("stuff", 5);
+ StackString *stuff = SSTR_WRAP_UTF8("stuff", 5);
TEST_TRUE(runner, VA_Equals(array, (Obj*)other),
"Empty arrays are equal");
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/clownfish/runtime/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VTable.c b/clownfish/runtime/core/Clownfish/VTable.c
index 6596018..71c6800 100644
--- a/clownfish/runtime/core/Clownfish/VTable.c
+++ b/clownfish/runtime/core/Clownfish/VTable.c
@@ -367,7 +367,7 @@ VTable_add_alias_to_registry(VTable *vtable, const char *alias_ptr,
if (VTable_registry == NULL) {
VTable_init_registry();
}
- StackString *alias = SSTR_WRAP_STR(alias_ptr, alias_len);
+ StackString *alias = SSTR_WRAP_UTF8(alias_ptr, alias_len);
if (LFReg_Fetch(VTable_registry, (Obj*)alias)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/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 7743525..494febe 100644
--- a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -577,7 +577,7 @@ CODE:
CFISH_UNUSED_VAR(unused_sv);
STRLEN size;
char *ptr = SvPVutf8(class_name_sv, size);
- cfish_StackString *class_name = CFISH_SSTR_WRAP_STR(ptr, size);
+ cfish_StackString *class_name = CFISH_SSTR_WRAP_UTF8(ptr, size);
cfish_VTable *vtable
= cfish_VTable_fetch_vtable((cfish_String*)class_name);
RETVAL = vtable ? (SV*)CFISH_VTable_To_Host(vtable) : &PL_sv_undef;
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 755667a..d3a8e84 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -64,7 +64,7 @@ XSBind_new_blank_obj(SV *either_sv) {
// Use the supplied class name string to find a VTable.
STRLEN len;
char *ptr = SvPVutf8(either_sv, len);
- cfish_StackString *klass = CFISH_SSTR_WRAP_STR(ptr, len);
+ cfish_StackString *klass = CFISH_SSTR_WRAP_UTF8(ptr, len);
vtable = cfish_VTable_singleton((cfish_String*)klass, NULL);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Index/FilePurger.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/FilePurger.c b/core/Lucy/Index/FilePurger.c
index d61482e..bdb0999 100644
--- a/core/Lucy/Index/FilePurger.c
+++ b/core/Lucy/Index/FilePurger.c
@@ -155,7 +155,7 @@ S_zap_dead_merge(FilePurger *self, Hash *candidates) {
if (cutoff) {
String *cutoff_seg = Seg_num_to_name(Obj_To_I64(cutoff));
if (Folder_Exists(ivars->folder, cutoff_seg)) {
- StackString *merge_json = SSTR_WRAP_STR("merge.json", 10);
+ StackString *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
DirHandle *dh = Folder_Open_Dir(ivars->folder, cutoff_seg);
if (!dh) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Index/IndexManager.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/IndexManager.c b/core/Lucy/Index/IndexManager.c
index b22e993..3a6442e 100644
--- a/core/Lucy/Index/IndexManager.c
+++ b/core/Lucy/Index/IndexManager.c
@@ -233,7 +233,7 @@ S_obtain_lock_factory(IndexManager *self) {
Lock*
IxManager_Make_Write_Lock_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- StackString *write_lock_name = SSTR_WRAP_STR("write", 5);
+ StackString *write_lock_name = SSTR_WRAP_UTF8("write", 5);
LockFactory *lock_factory = S_obtain_lock_factory(self);
return LockFact_Make_Lock(lock_factory, (String*)write_lock_name,
ivars->write_lock_timeout,
@@ -243,7 +243,7 @@ IxManager_Make_Write_Lock_IMP(IndexManager *self) {
Lock*
IxManager_Make_Deletion_Lock_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- StackString *lock_name = SSTR_WRAP_STR("deletion", 8);
+ StackString *lock_name = SSTR_WRAP_UTF8("deletion", 8);
LockFactory *lock_factory = S_obtain_lock_factory(self);
return LockFact_Make_Lock(lock_factory, (String*)lock_name,
ivars->deletion_lock_timeout,
@@ -253,7 +253,7 @@ IxManager_Make_Deletion_Lock_IMP(IndexManager *self) {
Lock*
IxManager_Make_Merge_Lock_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- StackString *merge_lock_name = SSTR_WRAP_STR("merge", 5);
+ StackString *merge_lock_name = SSTR_WRAP_UTF8("merge", 5);
LockFactory *lock_factory = S_obtain_lock_factory(self);
return LockFact_Make_Lock(lock_factory, (String*)merge_lock_name,
ivars->merge_lock_timeout,
@@ -263,7 +263,7 @@ IxManager_Make_Merge_Lock_IMP(IndexManager *self) {
void
IxManager_Write_Merge_Data_IMP(IndexManager *self, int64_t cutoff) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- StackString *merge_json = SSTR_WRAP_STR("merge.json", 10);
+ StackString *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
Hash *data = Hash_new(1);
bool success;
Hash_Store_Utf8(data, "cutoff", 6, (Obj*)Str_newf("%i64", cutoff));
@@ -277,7 +277,7 @@ IxManager_Write_Merge_Data_IMP(IndexManager *self, int64_t cutoff) {
Hash*
IxManager_Read_Merge_Data_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- StackString *merge_json = SSTR_WRAP_STR("merge.json", 10);
+ StackString *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
if (Folder_Exists(ivars->folder, (String*)merge_json)) {
Hash *stuff
= (Hash*)Json_slurp_json(ivars->folder, (String*)merge_json);
@@ -297,7 +297,7 @@ IxManager_Read_Merge_Data_IMP(IndexManager *self) {
bool
IxManager_Remove_Merge_Data_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- StackString *merge_json = SSTR_WRAP_STR("merge.json", 10);
+ StackString *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
return Folder_Delete(ivars->folder, (String*)merge_json) != 0;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Index/PolyReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyReader.c b/core/Lucy/Index/PolyReader.c
index 1dbc0b5..267a3e9 100644
--- a/core/Lucy/Index/PolyReader.c
+++ b/core/Lucy/Index/PolyReader.c
@@ -381,7 +381,7 @@ PolyReader_do_open(PolyReader *self, Obj *index, Snapshot *snapshot,
// Testing only.
if (PolyReader_race_condition_debug1) {
- StackString *temp = SSTR_WRAP_STR("temp", 4);
+ StackString *temp = SSTR_WRAP_UTF8("temp", 4);
if (Folder_Exists(folder, (String*)temp)) {
bool success = Folder_Rename(folder, (String*)temp,
PolyReader_race_condition_debug1);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Index/Segment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c
index 50b4e8a..511b15a 100644
--- a/core/Lucy/Index/Segment.c
+++ b/core/Lucy/Index/Segment.c
@@ -211,7 +211,7 @@ Seg_Store_Metadata_IMP(Segment *self, const String *key, Obj *value) {
void
Seg_Store_Metadata_Utf8_IMP(Segment *self, const char *key, size_t key_len,
Obj *value) {
- StackString *k = SSTR_WRAP_STR((char*)key, key_len);
+ StackString *k = SSTR_WRAP_UTF8((char*)key, key_len);
Seg_Store_Metadata(self, (String*)k, value);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Plan/Schema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.c b/core/Lucy/Plan/Schema.c
index 098a698..070d6ce 100644
--- a/core/Lucy/Plan/Schema.c
+++ b/core/Lucy/Plan/Schema.c
@@ -420,7 +420,7 @@ Schema_Eat_IMP(Schema *self, Schema *other) {
void
Schema_Write_IMP(Schema *self, Folder *folder, const String *filename) {
Hash *dump = Schema_Dump(self);
- StackString *schema_temp = SSTR_WRAP_STR("schema.temp", 11);
+ StackString *schema_temp = SSTR_WRAP_UTF8("schema.temp", 11);
bool success;
Folder_Delete(folder, (String*)schema_temp); // Just in case.
Json_spew_json((Obj*)dump, folder, (String*)schema_temp);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Store/CompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c
index 86307c3..79ca64a 100644
--- a/core/Lucy/Store/CompoundFileReader.c
+++ b/core/Lucy/Store/CompoundFileReader.c
@@ -36,7 +36,7 @@ CFReader_open(Folder *folder) {
CompoundFileReader*
CFReader_do_open(CompoundFileReader *self, Folder *folder) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
- String *cfmeta_file = (String*)SSTR_WRAP_STR("cfmeta.json", 11);
+ String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
Hash *metadata = (Hash*)Json_slurp_json((Folder*)folder, cfmeta_file);
Err *error = NULL;
@@ -73,7 +73,7 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
}
// Open an instream which we'll clone over and over.
- String *cf_file = (String*)SSTR_WRAP_STR("cf.dat", 6);
+ String *cf_file = (String*)SSTR_WRAP_UTF8("cf.dat", 6);
ivars->instream = Folder_Open_In(folder, cf_file);
if (!ivars->instream) {
ERR_ADD_FRAME(Err_get_error());
@@ -167,11 +167,11 @@ CFReader_Local_Delete_IMP(CompoundFileReader *self, const String *name) {
// Once the number of virtual files falls to 0, remove the compound
// files.
if (Hash_Get_Size(ivars->records) == 0) {
- String *cf_file = (String*)SSTR_WRAP_STR("cf.dat", 6);
+ String *cf_file = (String*)SSTR_WRAP_UTF8("cf.dat", 6);
if (!Folder_Delete(ivars->real_folder, cf_file)) {
return false;
}
- String *cfmeta_file = (String*)SSTR_WRAP_STR("cfmeta.json", 11);
+ String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
if (!Folder_Delete(ivars->real_folder, cfmeta_file)) {
return false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Store/CompoundFileWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileWriter.c b/core/Lucy/Store/CompoundFileWriter.c
index 82e4178..d1f2938 100644
--- a/core/Lucy/Store/CompoundFileWriter.c
+++ b/core/Lucy/Store/CompoundFileWriter.c
@@ -59,7 +59,7 @@ CFWriter_Destroy_IMP(CompoundFileWriter *self) {
void
CFWriter_Consolidate_IMP(CompoundFileWriter *self) {
CompoundFileWriterIVARS *const ivars = CFWriter_IVARS(self);
- String *cfmeta_file = (String*)SSTR_WRAP_STR("cfmeta.json", 11);
+ String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
if (Folder_Exists(ivars->folder, cfmeta_file)) {
THROW(ERR, "Merge already performed for %o",
Folder_Get_Path(ivars->folder));
@@ -75,8 +75,8 @@ S_clean_up_old_temp_files(CompoundFileWriter *self,
CompoundFileWriterIVARS *ivars) {
UNUSED_VAR(self);
Folder *folder = ivars->folder;
- String *cfmeta_temp = (String*)SSTR_WRAP_STR("cfmeta.json.temp", 16);
- String *cf_file = (String*)SSTR_WRAP_STR("cf.dat", 6);
+ String *cfmeta_temp = (String*)SSTR_WRAP_UTF8("cfmeta.json.temp", 16);
+ String *cf_file = (String*)SSTR_WRAP_UTF8("cf.dat", 6);
if (Folder_Exists(folder, cf_file)) {
if (!Folder_Delete(folder, cf_file)) {
@@ -98,7 +98,7 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
Hash *sub_files = Hash_new(0);
VArray *files = Folder_List(folder, NULL);
VArray *merged = VA_new(VA_Get_Size(files));
- String *cf_file = (String*)SSTR_WRAP_STR("cf.dat", 6);
+ String *cf_file = (String*)SSTR_WRAP_UTF8("cf.dat", 6);
OutStream *outstream = Folder_Open_Out(folder, (String*)cf_file);
bool rename_success;
@@ -143,8 +143,8 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
}
// Write metadata to cfmeta file.
- String *cfmeta_temp = (String*)SSTR_WRAP_STR("cfmeta.json.temp", 16);
- String *cfmeta_file = (String*)SSTR_WRAP_STR("cfmeta.json", 11);
+ String *cfmeta_temp = (String*)SSTR_WRAP_UTF8("cfmeta.json.temp", 16);
+ String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
Json_spew_json((Obj*)metadata, (Folder*)ivars->folder, cfmeta_temp);
rename_success = Folder_Rename(ivars->folder, cfmeta_temp, cfmeta_file);
if (!rename_success) { RETHROW(INCREF(Err_get_error())); }
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index 1550d73..b37fe6b 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -253,7 +253,7 @@ FSFolder_Local_Find_Folder_IMP(FSFolder *self, const String *name) {
}
// Try to open a CompoundFileReader. On failure, just use the
// existing folder.
- String *cfmeta_file = (String*)SSTR_WRAP_STR("cfmeta.json", 11);
+ String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
if (Folder_Local_Exists(subfolder, cfmeta_file)) {
CompoundFileReader *cf_reader = CFReader_open(subfolder);
if (cf_reader) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index 907b16b..e95fa5f 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -148,7 +148,7 @@ LFLock_Request_IMP(LockFileLock *self) {
}
// Create the "locks" subdirectory if necessary.
- String *lock_dir_name = (String*)SSTR_WRAP_STR("locks", 5);
+ String *lock_dir_name = (String*)SSTR_WRAP_UTF8("locks", 5);
if (!Folder_Exists(ivars->folder, lock_dir_name)) {
if (!Folder_MkDir(ivars->folder, lock_dir_name)) {
Err *mkdir_err = (Err*)CERTIFY(Err_get_error(), ERR);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Store/SharedLock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.c b/core/Lucy/Store/SharedLock.c
index f89f6f0..1707254 100644
--- a/core/Lucy/Store/SharedLock.c
+++ b/core/Lucy/Store/SharedLock.c
@@ -99,7 +99,7 @@ void
ShLock_Clear_Stale_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- String *lock_dir_name = (String*)SSTR_WRAP_STR("locks", 5);
+ String *lock_dir_name = (String*)SSTR_WRAP_UTF8("locks", 5);
if (!Folder_Find_Folder(ivars->folder, lock_dir_name)) {
return;
}
@@ -127,7 +127,7 @@ bool
ShLock_Is_Locked_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- String *lock_dir_name = (String*)SSTR_WRAP_STR("locks", 5);
+ String *lock_dir_name = (String*)SSTR_WRAP_UTF8("locks", 5);
if (!Folder_Find_Folder(ivars->folder, lock_dir_name)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Analysis/TestNormalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestNormalizer.c b/core/Lucy/Test/Analysis/TestNormalizer.c
index 9bea51c..578f2c3 100644
--- a/core/Lucy/Test/Analysis/TestNormalizer.c
+++ b/core/Lucy/Test/Analysis/TestNormalizer.c
@@ -38,8 +38,8 @@ static void
test_Dump_Load_and_Equals(TestBatchRunner *runner) {
Normalizer *normalizer[4];
- String *NFC = (String*)SSTR_WRAP_STR("NFC", 3);
- String *NFKC = (String*)SSTR_WRAP_STR("NFKC", 4);
+ String *NFC = (String*)SSTR_WRAP_UTF8("NFC", 3);
+ String *NFKC = (String*)SSTR_WRAP_UTF8("NFKC", 4);
normalizer[0] = Normalizer_new(NFKC, true, false);
normalizer[1] = Normalizer_new(NFC, true, false);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestPolyAnalyzer.c b/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
index 79f3b66..2602c80 100644
--- a/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
+++ b/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
@@ -43,8 +43,8 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
return;
}
- String *EN = (String*)SSTR_WRAP_STR("en", 2);
- String *ES = (String*)SSTR_WRAP_STR("es", 2);
+ String *EN = (String*)SSTR_WRAP_UTF8("en", 2);
+ String *ES = (String*)SSTR_WRAP_UTF8("es", 2);
PolyAnalyzer *analyzer = PolyAnalyzer_new(EN, NULL);
PolyAnalyzer *other = PolyAnalyzer_new(ES, NULL);
Obj *dump = (Obj*)PolyAnalyzer_Dump(analyzer);
@@ -70,7 +70,7 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_analysis(TestBatchRunner *runner) {
- String *EN = (String*)SSTR_WRAP_STR("en", 2);
+ String *EN = (String*)SSTR_WRAP_UTF8("en", 2);
String *source_text = Str_newf("Eats, shoots and leaves.");
Normalizer *normalizer = Normalizer_new(NULL, true, false);
StandardTokenizer *tokenizer = StandardTokenizer_new();
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Analysis/TestRegexTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestRegexTokenizer.c b/core/Lucy/Test/Analysis/TestRegexTokenizer.c
index b0e41b0..84a333f 100644
--- a/core/Lucy/Test/Analysis/TestRegexTokenizer.c
+++ b/core/Lucy/Test/Analysis/TestRegexTokenizer.c
@@ -38,8 +38,8 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
return;
}
- StackString *word_char_pattern = SSTR_WRAP_STR("\\w+", 3);
- StackString *whitespace_pattern = SSTR_WRAP_STR("\\S+", 3);
+ StackString *word_char_pattern = SSTR_WRAP_UTF8("\\w+", 3);
+ StackString *whitespace_pattern = SSTR_WRAP_UTF8("\\S+", 3);
RegexTokenizer *word_char_tokenizer
= RegexTokenizer_new((String*)word_char_pattern);
RegexTokenizer *whitespace_tokenizer
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Analysis/TestSnowballStemmer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestSnowballStemmer.c b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
index 3e6a44d..7848ce2 100644
--- a/core/Lucy/Test/Analysis/TestSnowballStemmer.c
+++ b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
@@ -33,8 +33,8 @@ TestSnowStemmer_new() {
static void
test_Dump_Load_and_Equals(TestBatchRunner *runner) {
- String *EN = (String*)SSTR_WRAP_STR("en", 2);
- String *ES = (String*)SSTR_WRAP_STR("es", 2);
+ String *EN = (String*)SSTR_WRAP_UTF8("en", 2);
+ String *ES = (String*)SSTR_WRAP_UTF8("es", 2);
SnowballStemmer *stemmer = SnowStemmer_new(EN);
SnowballStemmer *other = SnowStemmer_new(ES);
Obj *dump = (Obj*)SnowStemmer_Dump(stemmer);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Analysis/TestStandardTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestStandardTokenizer.c b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
index ab5f36e..8a0ae3f 100644
--- a/core/Lucy/Test/Analysis/TestStandardTokenizer.c
+++ b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
@@ -51,7 +51,7 @@ static void
test_tokenizer(TestBatchRunner *runner) {
StandardTokenizer *tokenizer = StandardTokenizer_new();
- StackString *word = SSTR_WRAP_STR(
+ StackString *word = SSTR_WRAP_UTF8(
" ."
"tha\xCC\x82t's"
":"
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Highlight/TestHighlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Highlight/TestHighlighter.c b/core/Lucy/Test/Highlight/TestHighlighter.c
index 706cd2a..8520c07 100644
--- a/core/Lucy/Test/Highlight/TestHighlighter.c
+++ b/core/Lucy/Test/Highlight/TestHighlighter.c
@@ -59,12 +59,12 @@ TestHighlighter_new() {
static void
test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- String *content = (String*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_UTF8("content", 7);
Highlighter *highlighter = Highlighter_new(searcher, query, content, 6);
int32_t top;
String *raw_excerpt;
- String *field_val = (String *)SSTR_WRAP_STR("Ook. Urk. Ick. ", 18);
+ String *field_val = (String *)SSTR_WRAP_UTF8("Ook. Urk. Ick. ", 18);
VArray *spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(0, 18, 1.0f));
HeatMap *heat_map = HeatMap_new(spans, 133);
@@ -95,7 +95,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(raw_excerpt);
DECREF(heat_map);
- field_val = (String *)SSTR_WRAP_STR("Ook urk ick i.", 14);
+ field_val = (String *)SSTR_WRAP_UTF8("Ook urk ick i.", 14);
spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(12, 1, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -111,7 +111,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(heat_map);
DECREF(raw_excerpt);
- field_val = (String *)SSTR_WRAP_STR("Urk. Iz no good.", 17);
+ field_val = (String *)SSTR_WRAP_UTF8("Urk. Iz no good.", 17);
spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(6, 2, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -129,7 +129,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
// Words longer than excerpt len
- field_val = (String *)SSTR_WRAP_STR("abc/def/ghi/jkl/mno", 19);
+ field_val = (String *)SSTR_WRAP_UTF8("abc/def/ghi/jkl/mno", 19);
spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(0, 3, 1.0f));
@@ -160,13 +160,13 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
static void
test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- String *content = (String*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_UTF8("content", 7);
Highlighter *highlighter = Highlighter_new(searcher, query, content, 3);
String *highlighted;
VArray *spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(2, 1, 0.0f));
- String *raw_excerpt = (String *)SSTR_WRAP_STR("a b c", 5);
+ String *raw_excerpt = (String *)SSTR_WRAP_UTF8("a b c", 5);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
@@ -178,7 +178,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
spans = VA_new(2);
VA_Push(spans, (Obj*)Span_new(0, 1, 1.0f));
VA_Push(spans, (Obj*)Span_new(10, 10, 1.0f));
- raw_excerpt = (String *)SSTR_WRAP_STR(PHI, 2);
+ raw_excerpt = (String *)SSTR_WRAP_UTF8(PHI, 2);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
@@ -189,7 +189,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
spans = VA_new(1);
VA_Push(spans, (Obj*)Span_new(3, 1, 1.0f));
- raw_excerpt = (String *)SSTR_WRAP_STR(PHI " " PHI " " PHI, 8);
+ raw_excerpt = (String *)SSTR_WRAP_UTF8(PHI " " PHI " " PHI, 8);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 1);
TEST_TRUE(runner,
@@ -204,7 +204,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
VA_Push(spans, (Obj*)Span_new(2, 4, 1.0f));
VA_Push(spans, (Obj*)Span_new(8, 9, 1.0f));
VA_Push(spans, (Obj*)Span_new(8, 4, 1.0f));
- raw_excerpt = (String *)SSTR_WRAP_STR(PHI " Oook. Urk. Ick. " PHI, 21);
+ raw_excerpt = (String *)SSTR_WRAP_UTF8(PHI " Oook. Urk. Ick. " PHI, 21);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
@@ -221,7 +221,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
static void
test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
Hits *hits) {
- String *content = (String*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_UTF8("content", 7);
Highlighter *highlighter = Highlighter_new(searcher, query, content, 200);
HitDoc *hit = Hits_Next(hits);
@@ -233,9 +233,9 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
"highlighter tagged phrase and single term");
DECREF(excerpt);
- String *pre_tag = (String*)SSTR_WRAP_STR("\x1B[1m", 4);
+ String *pre_tag = (String*)SSTR_WRAP_UTF8("\x1B[1m", 4);
Highlighter_Set_Pre_Tag(highlighter, pre_tag);
- String *post_tag = (String*)SSTR_WRAP_STR("\x1B[0m", 4);
+ String *post_tag = (String*)SSTR_WRAP_UTF8("\x1B[0m", 4);
Highlighter_Set_Post_Tag(highlighter, post_tag);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
@@ -255,7 +255,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
DECREF(hit);
DECREF(highlighter);
- query = (Obj*)SSTR_WRAP_STR("x \"x y z\" AND b", 15);
+ query = (Obj*)SSTR_WRAP_UTF8("x \"x y z\" AND b", 15);
hits = Searcher_Hits(searcher, query, 0, 10, NULL);
highlighter = Highlighter_new(searcher, query, content, 200);
hit = Hits_Next(hits);
@@ -270,7 +270,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
DECREF(highlighter);
DECREF(hits);
- query = (Obj*)SSTR_WRAP_STR("blind", 5);
+ query = (Obj*)SSTR_WRAP_UTF8("blind", 5);
hits = Searcher_Hits(searcher, query, 0, 10, NULL);
highlighter = Highlighter_new(searcher, query, content, 200);
hit = Hits_Next(hits);
@@ -283,7 +283,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
DECREF(highlighter);
DECREF(hits);
- query = (Obj*)SSTR_WRAP_STR("why", 3);
+ query = (Obj*)SSTR_WRAP_UTF8("why", 3);
hits = Searcher_Hits(searcher, query, 0, 10, NULL);
highlighter = Highlighter_new(searcher, query, content, 200);
hit = Hits_Next(hits);
@@ -296,7 +296,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
DECREF(highlighter);
DECREF(hits);
- Obj *term = (Obj*)SSTR_WRAP_STR("x", 1);
+ Obj *term = (Obj*)SSTR_WRAP_UTF8("x", 1);
query = (Obj*)TermQuery_new(content, term);
hits = Searcher_Hits(searcher, query, 0, 10, NULL);
hit = Hits_Next(hits);
@@ -307,7 +307,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
"specify field highlights correct field...");
DECREF(excerpt);
DECREF(highlighter);
- String *alt = (String*)SSTR_WRAP_STR("alt", 3);
+ String *alt = (String*)SSTR_WRAP_UTF8("alt", 3);
highlighter = Highlighter_new(searcher, query, alt, 200);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
@@ -329,9 +329,9 @@ test_highlighting(TestBatchRunner *runner) {
FullTextType *dunked_type = FullTextType_new((Analyzer*)tokenizer);
FullTextType_Set_Highlightable(dunked_type, true);
FullTextType_Set_Boost(dunked_type, 0.1f);
- String *content = (String*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_UTF8("content", 7);
Schema_Spec_Field(schema, content, (FieldType*)plain_type);
- String *alt = (String*)SSTR_WRAP_STR("alt", 3);
+ String *alt = (String*)SSTR_WRAP_UTF8("alt", 3);
Schema_Spec_Field(schema, alt, (FieldType*)dunked_type);
DECREF(plain_type);
DECREF(dunked_type);
@@ -341,21 +341,21 @@ test_highlighting(TestBatchRunner *runner) {
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
Doc *doc = Doc_new(NULL, 0);
- String *string = (String *)SSTR_WRAP_STR(TEST_STRING, TEST_STRING_LEN);
+ String *string = (String *)SSTR_WRAP_UTF8(TEST_STRING, TEST_STRING_LEN);
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
doc = Doc_new(NULL, 0);
- string = (String *)SSTR_WRAP_STR("\"I see,\" said the blind man.", 28);
+ string = (String *)SSTR_WRAP_UTF8("\"I see,\" said the blind man.", 28);
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
doc = Doc_new(NULL, 0);
- string = (String *)SSTR_WRAP_STR("x but not why or 2ee", 20);
+ string = (String *)SSTR_WRAP_UTF8("x but not why or 2ee", 20);
Doc_Store(doc, content, (Obj*)string);
- string = (String *)SSTR_WRAP_STR(TEST_STRING
+ string = (String *)SSTR_WRAP_UTF8(TEST_STRING
" and extra stuff so it scores lower",
TEST_STRING_LEN + 35);
Doc_Store(doc, alt, (Obj*)string);
@@ -366,7 +366,7 @@ test_highlighting(TestBatchRunner *runner) {
DECREF(indexer);
Searcher *searcher = (Searcher*)IxSearcher_new((Obj*)folder);
- Obj *query = (Obj*)SSTR_WRAP_STR("\"x y z\" AND " PHI, 14);
+ Obj *query = (Obj*)SSTR_WRAP_UTF8("\"x y z\" AND " PHI, 14);
Hits *hits = Searcher_Hits(searcher, query, 0, 10, NULL);
test_Raw_Excerpt(runner, searcher, query);
@@ -385,7 +385,7 @@ test_hl_selection(TestBatchRunner *runner) {
StandardTokenizer *tokenizer = StandardTokenizer_new();
FullTextType *plain_type = FullTextType_new((Analyzer*)tokenizer);
FullTextType_Set_Highlightable(plain_type, true);
- String *content = (String*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_UTF8("content", 7);
Schema_Spec_Field(schema, content, (FieldType*)plain_type);
DECREF(plain_type);
DECREF(tokenizer);
@@ -408,7 +408,7 @@ test_hl_selection(TestBatchRunner *runner) {
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. "
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. ";
Doc *doc = Doc_new(NULL, 0);
- String *string = (String *)SSTR_WRAP_STR(test_string, strlen(test_string));
+ String *string = (String *)SSTR_WRAP_UTF8(test_string, strlen(test_string));
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
@@ -417,13 +417,13 @@ test_hl_selection(TestBatchRunner *runner) {
DECREF(indexer);
Searcher *searcher = (Searcher*)IxSearcher_new((Obj*)folder);
- Obj *query = (Obj*)SSTR_WRAP_STR("NNN MMM", 7);
+ Obj *query = (Obj*)SSTR_WRAP_UTF8("NNN MMM", 7);
Highlighter *highlighter = Highlighter_new(searcher, query, content, 200);
Hits *hits = Searcher_Hits(searcher, query, 0, 10, NULL);
HitDoc *hit = Hits_Next(hits);
String *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
- String *mmm = (String*)SSTR_WRAP_STR("MMM", 3);
- String *nnn = (String*)SSTR_WRAP_STR("NNN", 3);
+ String *mmm = (String*)SSTR_WRAP_UTF8("MMM", 3);
+ String *nnn = (String*)SSTR_WRAP_UTF8("NNN", 3);
TEST_TRUE(runner, Str_Find(excerpt, mmm) >= 0 || Str_Find(excerpt, nnn) >= 0,
"Sentence boundary algo doesn't chop terms");
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Index/TestSegment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSegment.c b/core/Lucy/Test/Index/TestSegment.c
index e0e9b6b..17b2d67 100644
--- a/core/Lucy/Test/Index/TestSegment.c
+++ b/core/Lucy/Test/Index/TestSegment.c
@@ -32,9 +32,9 @@ TestSeg_new() {
static void
test_fields(TestBatchRunner *runner) {
Segment *segment = Seg_new(1);
- StackString *foo = SSTR_WRAP_STR("foo", 3);
- StackString *bar = SSTR_WRAP_STR("bar", 3);
- StackString *baz = SSTR_WRAP_STR("baz", 3);
+ StackString *foo = SSTR_WRAP_UTF8("foo", 3);
+ StackString *bar = SSTR_WRAP_UTF8("bar", 3);
+ StackString *baz = SSTR_WRAP_UTF8("baz", 3);
int32_t field_num;
field_num = Seg_Add_Field(segment, (String*)foo);
@@ -126,8 +126,8 @@ test_Write_File_and_Read_File(TestBatchRunner *runner) {
Segment *segment = Seg_new(100);
Segment *got = Seg_new(100);
String *meta;
- String *flotsam = (String*)SSTR_WRAP_STR("flotsam", 7);
- String *jetsam = (String*)SSTR_WRAP_STR("jetsam", 6);
+ String *flotsam = (String*)SSTR_WRAP_UTF8("flotsam", 7);
+ String *jetsam = (String*)SSTR_WRAP_UTF8("jetsam", 6);
Seg_Set_Count(segment, 111);
Seg_Store_Metadata_Utf8(segment, "foo", 3, (Obj*)Str_newf("bar"));
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Index/TestSnapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSnapshot.c b/core/Lucy/Test/Index/TestSnapshot.c
index 1367d87..4d98f56 100644
--- a/core/Lucy/Test/Index/TestSnapshot.c
+++ b/core/Lucy/Test/Index/TestSnapshot.c
@@ -31,8 +31,8 @@ TestSnapshot_new() {
static void
test_Add_and_Delete(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
- String *foo = (String*)SSTR_WRAP_STR("foo", 3);
- String *bar = (String*)SSTR_WRAP_STR("bar", 3);
+ String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
+ String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
Snapshot_Add_Entry(snapshot, foo);
Snapshot_Add_Entry(snapshot, foo); // redundant
@@ -55,8 +55,8 @@ static void
test_path_handling(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- String *snap = (String*)SSTR_WRAP_STR("snap", 4);
- String *crackle = (String*)SSTR_WRAP_STR("crackle", 7);
+ String *snap = (String*)SSTR_WRAP_UTF8("snap", 4);
+ String *crackle = (String*)SSTR_WRAP_UTF8("crackle", 7);
Snapshot_Write_File(snapshot, folder, snap);
TEST_TRUE(runner, Str_Equals(snap, (Obj*)Snapshot_Get_Path(snapshot)),
@@ -79,8 +79,8 @@ static void
test_Read_File_and_Write_File(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- String *snap = (String*)SSTR_WRAP_STR("snap", 4);
- String *foo = (String*)SSTR_WRAP_STR("foo", 3);
+ String *snap = (String*)SSTR_WRAP_UTF8("snap", 4);
+ String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
Snapshot_Add_Entry(snapshot, foo);
Snapshot_Write_File(snapshot, folder, snap);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Plan/TestFieldType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFieldType.c b/core/Lucy/Test/Plan/TestFieldType.c
index 2288a3b..6a72ca7 100644
--- a/core/Lucy/Test/Plan/TestFieldType.c
+++ b/core/Lucy/Test/Plan/TestFieldType.c
@@ -37,7 +37,7 @@ DummyFieldType_new() {
static FieldType*
S_alt_field_type() {
- StackString *name = SSTR_WRAP_STR("DummyFieldType2", 15);
+ StackString *name = SSTR_WRAP_UTF8("DummyFieldType2", 15);
VTable *vtable = VTable_singleton((String*)name, DUMMYFIELDTYPE);
FieldType *self = (FieldType*)VTable_Make_Obj(vtable);
return FType_init(self);
@@ -84,8 +84,8 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_Compare_Values(TestBatchRunner *runner) {
FieldType *type = (FieldType*)DummyFieldType_new();
- StackString *a = SSTR_WRAP_STR("a", 1);
- StackString *b = SSTR_WRAP_STR("b", 1);
+ StackString *a = SSTR_WRAP_UTF8("a", 1);
+ StackString *b = SSTR_WRAP_UTF8("b", 1);
TEST_TRUE(runner,
FType_Compare_Values(type, (Obj*)a, (Obj*)b) < 0,
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Plan/TestFullTextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFullTextType.c b/core/Lucy/Test/Plan/TestFullTextType.c
index 243dd69..06f11e8 100644
--- a/core/Lucy/Test/Plan/TestFullTextType.c
+++ b/core/Lucy/Test/Plan/TestFullTextType.c
@@ -88,8 +88,8 @@ static void
test_Compare_Values(TestBatchRunner *runner) {
StandardTokenizer *tokenizer = StandardTokenizer_new();
FullTextType *type = FullTextType_new((Analyzer*)tokenizer);
- StackString *a = SSTR_WRAP_STR("a", 1);
- StackString *b = SSTR_WRAP_STR("b", 1);
+ StackString *a = SSTR_WRAP_UTF8("a", 1);
+ StackString *b = SSTR_WRAP_UTF8("b", 1);
TEST_TRUE(runner,
FullTextType_Compare_Values(type, (Obj*)a, (Obj*)b) < 0,
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Search/TestQueryParserLogic.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserLogic.c b/core/Lucy/Test/Search/TestQueryParserLogic.c
index 902c257..9eb89e9 100644
--- a/core/Lucy/Test/Search/TestQueryParserLogic.c
+++ b/core/Lucy/Test/Search/TestQueryParserLogic.c
@@ -864,7 +864,7 @@ S_create_index() {
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
uint32_t i, max;
- String *field = (String*)SSTR_WRAP_STR("content", 7);
+ String *field = (String*)SSTR_WRAP_UTF8("content", 7);
for (i = 0, max = VA_Get_Size(doc_set); i < max; i++) {
Doc *doc = Doc_new(NULL, 0);
Doc_Store(doc, field, VA_Fetch(doc_set, i));
@@ -890,7 +890,7 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
IndexSearcher *searcher = IxSearcher_new((Obj*)folder);
QueryParser *or_parser = QParser_new(IxSearcher_Get_Schema(searcher),
NULL, NULL, NULL);
- StackString *AND = SSTR_WRAP_STR("AND", 3);
+ StackString *AND = SSTR_WRAP_UTF8("AND", 3);
QueryParser *and_parser = QParser_new(IxSearcher_Get_Schema(searcher),
NULL, (String*)AND, NULL);
QParser_Set_Heed_Colons(or_parser, true);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index 81effa3..5a08230 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -429,7 +429,7 @@ test_sort_spec(TestBatchRunner *runner) {
for (int i = 0; i < 100; ++i) {
char name_buf[3];
sprintf(name_buf, "%02d", nums[i]);
- StackString *name = SSTR_WRAP_STR(name_buf, 2);
+ StackString *name = SSTR_WRAP_UTF8(name_buf, 2);
S_add_doc(indexer, (Obj*)name, num_str, NULL);
if (i % 10 == 0) {
S_refresh_indexer(&indexer, schema, folder);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Store/TestFSDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSDirHandle.c b/core/Lucy/Test/Store/TestFSDirHandle.c
index c6020bb..4a6cdfc 100644
--- a/core/Lucy/Test/Store/TestFSDirHandle.c
+++ b/core/Lucy/Test/Store/TestFSDirHandle.c
@@ -41,10 +41,10 @@ TestFSDH_new() {
static void
test_all(TestBatchRunner *runner) {
- String *foo = (String*)SSTR_WRAP_STR("foo", 3);
- String *boffo = (String*)SSTR_WRAP_STR("boffo", 5);
- String *foo_boffo = (String*)SSTR_WRAP_STR("foo/boffo", 9);
- String *test_dir = (String*)SSTR_WRAP_STR("_fsdir_test", 11);
+ String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
+ String *boffo = (String*)SSTR_WRAP_UTF8("boffo", 5);
+ String *foo_boffo = (String*)SSTR_WRAP_UTF8("foo/boffo", 9);
+ String *test_dir = (String*)SSTR_WRAP_UTF8("_fsdir_test", 11);
FSFolder *folder = FSFolder_new(test_dir);
bool saw_foo = false;
bool saw_boffo = false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Store/TestFSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFileHandle.c b/core/Lucy/Test/Store/TestFSFileHandle.c
index f1f78fb..5fba321 100644
--- a/core/Lucy/Test/Store/TestFSFileHandle.c
+++ b/core/Lucy/Test/Store/TestFSFileHandle.c
@@ -42,7 +42,7 @@ static void
test_open(TestBatchRunner *runner) {
FSFileHandle *fh;
- String *test_filename = (String*)SSTR_WRAP_STR("_fstest", 7);
+ String *test_filename = (String*)SSTR_WRAP_UTF8("_fstest", 7);
remove(Str_Get_Ptr8(test_filename));
@@ -108,7 +108,7 @@ test_Read_Write(TestBatchRunner *runner) {
const char *bar = "bar";
char buffer[12];
char *buf = buffer;
- String *test_filename = (String*)SSTR_WRAP_STR("_fstest", 7);
+ String *test_filename = (String*)SSTR_WRAP_UTF8("_fstest", 7);
remove(Str_Get_Ptr8(test_filename));
fh = FSFH_open(test_filename,
@@ -162,7 +162,7 @@ test_Read_Write(TestBatchRunner *runner) {
static void
test_Close(TestBatchRunner *runner) {
- String *test_filename = (String*)SSTR_WRAP_STR("_fstest", 7);
+ String *test_filename = (String*)SSTR_WRAP_UTF8("_fstest", 7);
FSFileHandle *fh;
remove(Str_Get_Ptr8(test_filename));
@@ -200,7 +200,7 @@ test_Close(TestBatchRunner *runner) {
static void
test_Window(TestBatchRunner *runner) {
- String *test_filename = (String*)SSTR_WRAP_STR("_fstest", 7);
+ String *test_filename = (String*)SSTR_WRAP_UTF8("_fstest", 7);
FSFileHandle *fh;
FileWindow *window = FileWindow_new();
FileWindowIVARS *const window_ivars = FileWindow_IVARS(window);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Store/TestFSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFolder.c b/core/Lucy/Test/Store/TestFSFolder.c
index 689bfa0..d661549 100644
--- a/core/Lucy/Test/Store/TestFSFolder.c
+++ b/core/Lucy/Test/Store/TestFSFolder.c
@@ -57,7 +57,7 @@ TestFSFolder_new() {
static Folder*
S_set_up() {
rmdir("_fstest");
- String *test_dir = (String*)SSTR_WRAP_STR("_fstest", 7);
+ String *test_dir = (String*)SSTR_WRAP_UTF8("_fstest", 7);
FSFolder *folder = FSFolder_new(test_dir);
FSFolder_Initialize(folder);
if (!FSFolder_Check(folder)) {
@@ -79,7 +79,7 @@ S_tear_down() {
static void
test_Initialize_and_Check(TestBatchRunner *runner) {
rmdir("_fstest");
- String *test_dir = (String*)SSTR_WRAP_STR("_fstest", 7);
+ String *test_dir = (String*)SSTR_WRAP_UTF8("_fstest", 7);
FSFolder *folder = FSFolder_new(test_dir);
TEST_FALSE(runner, FSFolder_Check(folder),
"Check() returns false when folder dir doesn't exist");
@@ -95,9 +95,9 @@ static void
test_protect_symlinks(TestBatchRunner *runner) {
#ifdef ENABLE_SYMLINK_TESTS
FSFolder *folder = (FSFolder*)S_set_up();
- String *foo = (String*)SSTR_WRAP_STR("foo", 3);
- String *bar = (String*)SSTR_WRAP_STR("bar", 3);
- String *foo_boffo = (String*)SSTR_WRAP_STR("foo/boffo", 9);
+ String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
+ String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
+ String *foo_boffo = (String*)SSTR_WRAP_UTF8("foo/boffo", 9);
FSFolder_MkDir(folder, foo);
FSFolder_MkDir(folder, bar);
@@ -152,14 +152,14 @@ void
test_disallow_updir(TestBatchRunner *runner) {
FSFolder *outer_folder = (FSFolder*)S_set_up();
- String *foo = (String*)SSTR_WRAP_STR("foo", 3);
- String *bar = (String*)SSTR_WRAP_STR("bar", 3);
+ String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
+ String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
FSFolder_MkDir(outer_folder, foo);
FSFolder_MkDir(outer_folder, bar);
- String *inner_path = (String*)SSTR_WRAP_STR("_fstest/foo", 11);
+ String *inner_path = (String*)SSTR_WRAP_UTF8("_fstest/foo", 11);
FSFolder *foo_folder = FSFolder_new(inner_path);
- String *up_bar = (String*)SSTR_WRAP_STR("../bar", 6);
+ String *up_bar = (String*)SSTR_WRAP_UTF8("../bar", 6);
TEST_FALSE(runner, FSFolder_Exists(foo_folder, up_bar),
"up-dirs are inaccessible.");
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Store/TestFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFileHandle.c b/core/Lucy/Test/Store/TestFileHandle.c
index 4942d35..d624ff5 100644
--- a/core/Lucy/Test/Store/TestFileHandle.c
+++ b/core/Lucy/Test/Store/TestFileHandle.c
@@ -38,7 +38,7 @@ S_no_op_method(const void *vself) {
static FileHandle*
S_new_filehandle() {
- StackString *klass = SSTR_WRAP_STR("TestFileHandle", 14);
+ StackString *klass = SSTR_WRAP_UTF8("TestFileHandle", 14);
FileHandle *fh;
VTable *vtable = VTable_fetch_vtable((String*)klass);
if (!vtable) {
@@ -54,7 +54,7 @@ TestFH_Run_IMP(TestFileHandle *self, TestBatchRunner *runner) {
TestBatchRunner_Plan(runner, (TestBatch*)self, 2);
FileHandle *fh = S_new_filehandle();
- StackString *foo = SSTR_WRAP_STR("foo", 3);
+ StackString *foo = SSTR_WRAP_UTF8("foo", 3);
TEST_TRUE(runner, Str_Equals_Utf8(FH_Get_Path(fh), "", 0), "Get_Path");
FH_Set_Path(fh, (String*)foo);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Store/TestInStream.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestInStream.c b/core/Lucy/Test/Store/TestInStream.c
index 1b7a941..471e472 100644
--- a/core/Lucy/Test/Store/TestInStream.c
+++ b/core/Lucy/Test/Store/TestInStream.c
@@ -96,8 +96,8 @@ test_refill(TestBatchRunner *runner) {
static void
test_Clone_and_Reopen(TestBatchRunner *runner) {
- StackString *foo = SSTR_WRAP_STR("foo", 3);
- StackString *bar = SSTR_WRAP_STR("bar", 3);
+ StackString *foo = SSTR_WRAP_UTF8("foo", 3);
+ StackString *bar = SSTR_WRAP_UTF8("bar", 3);
RAMFile *file = RAMFile_new(NULL, false);
OutStream *outstream = OutStream_open((Obj*)file);
RAMFileHandle *fh;
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Store/TestRAMDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestRAMDirHandle.c b/core/Lucy/Test/Store/TestRAMDirHandle.c
index d584630..ad6f92a 100644
--- a/core/Lucy/Test/Store/TestRAMDirHandle.c
+++ b/core/Lucy/Test/Store/TestRAMDirHandle.c
@@ -33,9 +33,9 @@ TestRAMDH_new() {
static void
test_all(TestBatchRunner *runner) {
RAMFolder *folder = RAMFolder_new(NULL);
- String *foo = (String*)SSTR_WRAP_STR("foo", 3);
- String *boffo = (String*)SSTR_WRAP_STR("boffo", 5);
- String *foo_boffo = (String*)SSTR_WRAP_STR("foo/boffo", 9);
+ String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
+ String *boffo = (String*)SSTR_WRAP_UTF8("boffo", 5);
+ String *foo_boffo = (String*)SSTR_WRAP_UTF8("foo/boffo", 9);
bool saw_foo = false;
bool saw_boffo = false;
bool foo_was_dir = false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/TestSchema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestSchema.c b/core/Lucy/Test/TestSchema.c
index ec40329..7983c9b 100644
--- a/core/Lucy/Test/TestSchema.c
+++ b/core/Lucy/Test/TestSchema.c
@@ -42,7 +42,7 @@ TestSchema_init(TestSchema *self, bool use_alt_arch) {
Schema_init((Schema*)self);
FullTextType_Set_Highlightable(type, true);
- String *content = (String*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_UTF8("content", 7);
TestSchema_Spec_Field(self, content, (FieldType*)type);
DECREF(type);
DECREF(tokenizer);
@@ -70,7 +70,7 @@ test_Equals(TestBatchRunner *runner) {
TestSchema *schema = TestSchema_new(false);
TestSchema *arch_differs = TestSchema_new(true);
TestSchema *spec_differs = TestSchema_new(false);
- String *content = (String*)SSTR_WRAP_STR("content", 7);
+ String *content = (String*)SSTR_WRAP_UTF8("content", 7);
FullTextType *type = (FullTextType*)TestSchema_Fetch_Type(spec_differs,
content);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c
index 38576a6..a6bf118 100644
--- a/core/Lucy/Test/TestUtils.c
+++ b/core/Lucy/Test/TestUtils.c
@@ -76,14 +76,14 @@ TestUtils_make_poly_query(uint32_t boolop, ...) {
TermQuery*
TestUtils_make_term_query(const char *field, const char *term) {
- String *field_str = (String*)SSTR_WRAP_STR(field, strlen(field));
- String *term_str = (String*)SSTR_WRAP_STR(term, strlen(term));
+ String *field_str = (String*)SSTR_WRAP_UTF8(field, strlen(field));
+ String *term_str = (String*)SSTR_WRAP_UTF8(term, strlen(term));
return TermQuery_new((String*)field_str, (Obj*)term_str);
}
PhraseQuery*
TestUtils_make_phrase_query(const char *field, ...) {
- String *field_str = (String*)SSTR_WRAP_STR(field, strlen(field));
+ String *field_str = (String*)SSTR_WRAP_UTF8(field, strlen(field));
va_list args;
VArray *terms = VA_new(0);
PhraseQuery *query;
@@ -102,9 +102,9 @@ TestUtils_make_phrase_query(const char *field, ...) {
LeafQuery*
TestUtils_make_leaf_query(const char *field, const char *term) {
- String *term_str = (String*)SSTR_WRAP_STR(term, strlen(term));
+ String *term_str = (String*)SSTR_WRAP_UTF8(term, strlen(term));
String *field_str = field
- ? (String*)SSTR_WRAP_STR(field, strlen(field))
+ ? (String*)SSTR_WRAP_UTF8(field, strlen(field))
: NULL;
return LeafQuery_new(field_str, term_str);
}
@@ -120,9 +120,9 @@ RangeQuery*
TestUtils_make_range_query(const char *field, const char *lower_term,
const char *upper_term, bool include_lower,
bool include_upper) {
- String *f = (String*)SSTR_WRAP_STR(field, strlen(field));
- String *lterm = (String*)SSTR_WRAP_STR(lower_term, strlen(lower_term));
- String *uterm = (String*)SSTR_WRAP_STR(upper_term, strlen(upper_term));
+ String *f = (String*)SSTR_WRAP_UTF8(field, strlen(field));
+ String *lterm = (String*)SSTR_WRAP_UTF8(lower_term, strlen(lower_term));
+ String *uterm = (String*)SSTR_WRAP_UTF8(upper_term, strlen(upper_term));
return RangeQuery_new(f, (Obj*)lterm, (Obj*)uterm, include_lower,
include_upper);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Util/TestIndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestIndexFileNames.c b/core/Lucy/Test/Util/TestIndexFileNames.c
index c5b2a18..5e51db8 100644
--- a/core/Lucy/Test/Util/TestIndexFileNames.c
+++ b/core/Lucy/Test/Util/TestIndexFileNames.c
@@ -30,7 +30,7 @@ TestIxFileNames_new() {
static void
S_test_local_part(TestBatchRunner *runner, const char *source,
const char *wanted, const char *test_name) {
- StackString *source_str = SSTR_WRAP_STR(source, strlen(source));
+ StackString *source_str = SSTR_WRAP_UTF8(source, strlen(source));
String *got = IxFileNames_local_part((String*)source_str);
TEST_TRUE(runner, Str_Equals_Utf8(got, wanted, strlen(wanted)), test_name);
DECREF(got);
@@ -51,7 +51,7 @@ test_local_part(TestBatchRunner *runner) {
static void
S_test_extract_gen(TestBatchRunner *runner, const char *name, uint64_t gen,
const char *test_name) {
- StackString *source = SSTR_WRAP_STR(name, strlen(name));
+ StackString *source = SSTR_WRAP_UTF8(name, strlen(name));
TEST_TRUE(runner, IxFileNames_extract_gen((String*)source) == gen,
test_name);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Test/Util/TestJson.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestJson.c b/core/Lucy/Test/Util/TestJson.c
index 2fa7e32..367b0e3 100644
--- a/core/Lucy/Test/Util/TestJson.c
+++ b/core/Lucy/Test/Util/TestJson.c
@@ -201,7 +201,7 @@ test_spew_and_slurp(TestBatchRunner *runner) {
Obj *dump = S_make_dump();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- String *foo = (String*)SSTR_WRAP_STR("foo", 3);
+ String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
bool result = Json_spew_json(dump, folder, foo);
TEST_TRUE(runner, result, "spew_json returns true on success");
TEST_TRUE(runner, Folder_Exists(folder, foo),
@@ -219,14 +219,14 @@ test_spew_and_slurp(TestBatchRunner *runner) {
"Failed spew_json sets Err_error");
Err_set_error(NULL);
- String *bar = (String*)SSTR_WRAP_STR("bar", 3);
+ String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
got = Json_slurp_json(folder, bar);
TEST_TRUE(runner, got == NULL,
"slurp_json returns NULL when file doesn't exist");
TEST_TRUE(runner, Err_get_error() != NULL,
"Failed slurp_json sets Err_error");
- String *boffo = (String*)SSTR_WRAP_STR("boffo", 5);
+ String *boffo = (String*)SSTR_WRAP_UTF8("boffo", 5);
FileHandle *fh
= Folder_Open_FileHandle(folder, boffo, FH_CREATE | FH_WRITE_ONLY);
@@ -247,7 +247,7 @@ test_spew_and_slurp(TestBatchRunner *runner) {
static void
S_verify_bad_syntax(TestBatchRunner *runner, const char *bad, const char *mess) {
- StackString *has_errors = SSTR_WRAP_STR(bad, strlen(bad));
+ StackString *has_errors = SSTR_WRAP_UTF8(bad, strlen(bad));
Err_set_error(NULL);
Obj *not_json = Json_from_json((String*)has_errors);
TEST_TRUE(runner, not_json == NULL, "from_json returns NULL: %s", mess);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index cdb01fb..c96a69d 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -687,7 +687,7 @@ S_set_error(CharBuf *buf, const char *json, const char *limit, int line,
const char *end = StrHelp_back_utf8_char(json + 32, json);
len = end - json;
}
- StackString *snippet = SSTR_WRAP_STR(json, len);
+ StackString *snippet = SSTR_WRAP_UTF8(json, len);
S_append_json_string((String*)snippet, buf);
String *mess = CB_Yield_String(buf);
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/perl/buildlib/Lucy/Build/Binding/Misc.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm
index 6f082bc..09dc616 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -141,7 +141,7 @@ PPCODE:
{
char *class_name = HvNAME(SvSTASH(SvRV(blank_obj)));
cfish_StackString *klass
- = CFISH_SSTR_WRAP_STR(class_name, strlen(class_name));
+ = CFISH_SSTR_WRAP_UTF8(class_name, strlen(class_name));
cfish_VTable *vtable
= (cfish_VTable*)cfish_VTable_singleton((cfish_String*)klass, NULL);
STRLEN len;
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/perl/xs/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/DocReader.c b/perl/xs/Lucy/Index/DocReader.c
index 15eafe1..29a0359 100644
--- a/perl/xs/Lucy/Index/DocReader.c
+++ b/perl/xs/Lucy/Index/DocReader.c
@@ -62,7 +62,7 @@ LUCY_DefDocReader_Fetch_Doc_IMP(lucy_DefaultDocReader *self, int32_t doc_id) {
// Find the Field's FieldType.
cfish_StackString *field_name_zcb
- = CFISH_SSTR_WRAP_STR(field_name_ptr, field_name_len);
+ = CFISH_SSTR_WRAP_UTF8(field_name_ptr, field_name_len);
type = LUCY_Schema_Fetch_Type(schema, (cfish_String*)field_name_zcb);
// Read the field value.
http://git-wip-us.apache.org/repos/asf/lucy/blob/87746f2f/perl/xs/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c
index 23eb9ab..4c3cd4e 100644
--- a/perl/xs/Lucy/Index/Inverter.c
+++ b/perl/xs/Lucy/Index/Inverter.c
@@ -50,7 +50,7 @@ S_fetch_entry(lucy_Inverter *self, HE *hash_entry) {
}
}
- cfish_StackString *field = CFISH_SSTR_WRAP_STR(key, key_len);
+ cfish_StackString *field = CFISH_SSTR_WRAP_UTF8(key, key_len);
int32_t field_num
= LUCY_Seg_Field_Num(ivars->segment, (cfish_String*)field);
if (!field_num) {
[lucy-commits] [22/50] [abbrv] git commit: refs/heads/master - Rework string
constructors
Posted by nw...@apache.org.
Rework string constructors
* Add 'origin' instance variable to String to distinguish normal
strings, substrings, and wrapped strings.
* Add Str_new_wrap_* constructors to replace ViewCharBuf.
* Rename Str_new_steal_* constructors.
* Remove SStr_new constructor
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/180fccdf
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/180fccdf
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/180fccdf
Branch: refs/heads/master
Commit: 180fccdfc58bd49a6ea9465c3c269114269d30f3
Parents: 34feddd
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 14 20:16:38 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:17 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Index/DocReader.c | 3 +-
clownfish/runtime/core/Clownfish/CharBuf.c | 2 +-
clownfish/runtime/core/Clownfish/Num.c | 1 -
clownfish/runtime/core/Clownfish/String.c | 144 +++++++++----------
clownfish/runtime/core/Clownfish/String.cfh | 53 +++----
.../perl/buildlib/Clownfish/Build/Binding.pm | 17 ---
clownfish/runtime/perl/lib/Clownfish.pm | 8 --
clownfish/runtime/perl/xs/XSBind.c | 1 -
core/Lucy/Analysis/SnowballStopFilter.c | 2 +-
core/Lucy/Index/SortCache/TextSortCache.c | 2 +-
core/Lucy/Util/Freezer.c | 4 +-
core/Lucy/Util/Json.c | 2 +-
example-lang/src/Lucy/Document/Doc.c | 3 +-
perl/xs/Lucy/Document/Doc.c | 2 +-
perl/xs/Lucy/Index/Inverter.c | 2 +-
ruby/src/Lucy/Document/Doc.c | 3 +-
16 files changed, 110 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index 7904c45..31a1077 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -77,8 +77,7 @@ DefDocReader_Fetch_Doc_IMP(DefaultDocReader *self, int32_t doc_id) {
char *buf = (char*)MALLOCATE(value_len + 1);
InStream_Read_Bytes(dat_in, buf, value_len);
buf[value_len] = '\0';
- value
- = (Obj*)Str_new_steal_from_trusted_str(buf, value_len);
+ value = (Obj*)Str_new_steal_utf8(buf, value_len);
break;
}
case FType_BLOB: {
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 7b407ad..bfbae45 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -304,7 +304,7 @@ CB_To_String_IMP(CharBuf *self) {
String*
CB_Yield_String_IMP(CharBuf *self) {
String *retval
- = Str_new_steal_from_trusted_str(self->ptr, self->size);
+ = Str_new_steal_trusted_utf8(self->ptr, self->size);
self->ptr = NULL;
self->size = 0;
self->cap = 0;
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/clownfish/runtime/core/Clownfish/Num.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Num.c b/clownfish/runtime/core/Clownfish/Num.c
index 728c618..f18bf76 100644
--- a/clownfish/runtime/core/Clownfish/Num.c
+++ b/clownfish/runtime/core/Clownfish/Num.c
@@ -22,7 +22,6 @@
#define C_CFISH_FLOAT32
#define C_CFISH_FLOAT64
#define C_CFISH_BOOLNUM
-#define C_CFISH_VIEWCHARBUF
#define CFISH_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 96cf22f..c917a79 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -15,7 +15,6 @@
*/
#define C_CFISH_STRING
-#define C_CFISH_VIEWCHARBUF
#define C_CFISH_STACKSTRING
#define C_CFISH_STRINGITERATOR
#define C_CFISH_STACKSTRINGITERATOR
@@ -53,18 +52,18 @@ S_die_invalid_utf8(const char *text, size_t size, const char *file, int line,
const char *func);
String*
-Str_new_from_utf8(const char *ptr, size_t size) {
- if (!StrHelp_utf8_valid(ptr, size)) {
- DIE_INVALID_UTF8(ptr, size);
+Str_new_from_utf8(const char *utf8, size_t size) {
+ if (!StrHelp_utf8_valid(utf8, size)) {
+ DIE_INVALID_UTF8(utf8, size);
}
String *self = (String*)VTable_Make_Obj(STRING);
- return Str_init_from_trusted_utf8(self, ptr, size);
+ return Str_init_from_trusted_utf8(self, utf8, size);
}
String*
-Str_new_from_trusted_utf8(const char *ptr, size_t size) {
+Str_new_from_trusted_utf8(const char *utf8, size_t size) {
String *self = (String*)VTable_Make_Obj(STRING);
- return Str_init_from_trusted_utf8(self, ptr, size);
+ return Str_init_from_trusted_utf8(self, utf8, size);
}
String*
@@ -77,31 +76,57 @@ Str_init_from_trusted_utf8(String *self, const char *utf8, size_t size) {
ptr[size] = '\0'; // Null terminate.
// Assign.
- self->ptr = ptr;
- self->size = size;
+ self->ptr = ptr;
+ self->size = size;
+ self->origin = self;
return self;
}
String*
-Str_new_steal_from_trusted_str(const char *ptr, size_t size) {
+Str_new_steal_utf8(const char *utf8, size_t size) {
+ if (!StrHelp_utf8_valid(utf8, size)) {
+ DIE_INVALID_UTF8(utf8, size);
+ }
+ String *self = (String*)VTable_Make_Obj(STRING);
+ return Str_init_steal_trusted_utf8(self, utf8, size);
+}
+
+String*
+Str_new_steal_trusted_utf8(const char *utf8, size_t size) {
String *self = (String*)VTable_Make_Obj(STRING);
- return Str_init_steal_trusted_str(self, ptr, size);
+ return Str_init_steal_trusted_utf8(self, utf8, size);
}
String*
-Str_init_steal_trusted_str(String *self, const char *ptr, size_t size) {
- self->ptr = ptr;
- self->size = size;
+Str_init_steal_trusted_utf8(String *self, const char *utf8, size_t size) {
+ self->ptr = utf8;
+ self->size = size;
+ self->origin = self;
return self;
}
String*
-Str_new_steal_str(const char *ptr, size_t size) {
- if (!StrHelp_utf8_valid(ptr, size)) {
- DIE_INVALID_UTF8(ptr, size);
+Str_new_wrap_utf8(const char *utf8, size_t size) {
+ if (!StrHelp_utf8_valid(utf8, size)) {
+ DIE_INVALID_UTF8(utf8, size);
}
- return Str_new_steal_from_trusted_str(ptr, size);
+ String *self = (String*)VTable_Make_Obj(STRING);
+ return Str_init_wrap_trusted_utf8(self, utf8, size);
+}
+
+String*
+Str_new_wrap_trusted_utf8(const char *utf8, size_t size) {
+ String *self = (String*)VTable_Make_Obj(STRING);
+ return Str_init_wrap_trusted_utf8(self, utf8, size);
+}
+
+String*
+Str_init_wrap_trusted_utf8(String *self, const char *ptr, size_t size) {
+ self->ptr = ptr;
+ self->size = size;
+ self->origin = NULL;
+ return self;
}
String*
@@ -112,8 +137,9 @@ Str_new_from_char(uint32_t code_point) {
ptr[size] = '\0';
String *self = (String*)VTable_Make_Obj(STRING);
- self->ptr = ptr;
- self->size = size;
+ self->ptr = ptr;
+ self->size = size;
+ self->origin = self;
return self;
}
@@ -129,9 +155,23 @@ Str_newf(const char *pattern, ...) {
return self;
}
+static String*
+S_new_substring(String *origin, size_t byte_offset, size_t size) {
+ String *self = (String*)VTable_Make_Obj(STRING);
+ self->ptr = origin->ptr + byte_offset;
+ self->size = size;
+ self->origin = (String*)INCREF(origin);
+ return self;
+}
+
void
Str_Destroy_IMP(String *self) {
- FREEMEM((char*)self->ptr);
+ if (self->origin == self) {
+ FREEMEM((char*)self->ptr);
+ }
+ else {
+ DECREF(self->origin);
+ }
SUPER_DESTROY(self, STRING);
}
@@ -275,7 +315,7 @@ Str_Cat_Trusted_Utf8_IMP(String *self, const char* ptr, size_t size) {
memcpy(result_ptr + self->size, ptr, size);
result_ptr[result_size] = '\0';
String *result = (String*)VTable_Make_Obj(STRING);
- return Str_init_steal_trusted_str(result, result_ptr, result_size);
+ return Str_init_steal_trusted_utf8(result, result_ptr, result_size);
}
bool
@@ -411,13 +451,12 @@ Str_SubString_IMP(String *self, size_t offset, size_t len) {
StackStringIterator *iter = STR_STACKTOP(self);
SStrIter_Advance(iter, offset);
- int start_offset = iter->byte_offset;
- const char *sub_start = self->ptr + start_offset;
+ size_t start_offset = iter->byte_offset;
SStrIter_Advance(iter, len);
- size_t byte_len = iter->byte_offset - start_offset;
+ size_t size = iter->byte_offset - start_offset;
- return Str_new_from_trusted_utf8(sub_start, byte_len);
+ return S_new_substring(self, start_offset, size);
}
int
@@ -480,46 +519,6 @@ Str_StackTail_IMP(String *self, void *allocation) {
/*****************************************************************/
-ViewCharBuf*
-ViewCB_new_from_utf8(const char *utf8, size_t size) {
- if (!StrHelp_utf8_valid(utf8, size)) {
- DIE_INVALID_UTF8(utf8, size);
- }
- return ViewCB_new_from_trusted_utf8(utf8, size);
-}
-
-ViewCharBuf*
-ViewCB_new_from_trusted_utf8(const char *utf8, size_t size) {
- ViewCharBuf *self = (ViewCharBuf*)VTable_Make_Obj(VIEWCHARBUF);
- return ViewCB_init(self, utf8, size);
-}
-
-ViewCharBuf*
-ViewCB_init(ViewCharBuf *self, const char *utf8, size_t size) {
- self->ptr = utf8;
- self->size = size;
- return self;
-}
-
-void
-ViewCB_Destroy_IMP(ViewCharBuf *self) {
- // Note that we do not free self->ptr, and that we invoke the
- // SUPER_DESTROY with STRING instead of VIEWCHARBUF.
- SUPER_DESTROY(self, STRING);
-}
-
-/*****************************************************************/
-
-StackString*
-SStr_new(void *allocation) {
- static char empty_string[] = "";
- StackString *self
- = (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
- self->size = 0;
- self->ptr = empty_string;
- return self;
-}
-
StackString*
SStr_new_from_str(void *allocation, size_t alloc_size, String *string) {
size_t size = string->size;
@@ -533,8 +532,9 @@ SStr_new_from_str(void *allocation, size_t alloc_size, String *string) {
ptr[size] = '\0';
StackString *self = (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
- self->ptr = ptr;
- self->size = size;
+ self->ptr = ptr;
+ self->size = size;
+ self->origin = NULL;
return self;
}
@@ -542,8 +542,9 @@ StackString*
SStr_wrap_str(void *allocation, const char *ptr, size_t size) {
StackString *self
= (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
- self->size = size;
- self->ptr = ptr;
+ self->size = size;
+ self->ptr = ptr;
+ self->origin = NULL;
return self;
}
@@ -607,8 +608,7 @@ StrIter_substring(StringIterator *top, StringIterator *tail) {
}
}
- return Str_new_from_trusted_utf8(string->ptr + top_offset,
- tail_offset - top_offset);
+ return S_new_substring(string, top_offset, tail_offset - top_offset);
}
StringIterator*
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index f64b73a..a1a0378 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -25,6 +25,7 @@ class Clownfish::String cnick Str
const char *ptr;
size_t size;
+ String *origin;
/** Return a new String which holds a copy of the passed-in string.
* Check for UTF-8 validity.
@@ -48,19 +49,39 @@ class Clownfish::String cnick Str
* passed-in string. Check validity of supplied UTF-8.
*/
inert incremented String*
- new_steal_str(const char *ptr, size_t size);
+ new_steal_utf8(const char *utf8, size_t size);
/** Return a pointer to a new String which assumes ownership of the
* passed-in string. Do not check validity of supplied UTF-8.
*/
inert incremented String*
- new_steal_from_trusted_str(const char *ptr, size_t size);
+ new_steal_trusted_utf8(const char *utf8, size_t size);
/** Initialize the String using the passed-in string. Do not check
* validity of supplied UTF-8.
*/
public inert String*
- init_steal_trusted_str(String *self, const char *ptr, size_t size);
+ init_steal_trusted_utf8(String *self, const char *utf8, size_t size);
+
+ /** Return a pointer to a new String which wraps an external buffer
+ * containing UTF-8. The buffer must stay unchanged for the lifetime
+ * of the String. Check validity of supplied UTF-8.
+ */
+ inert incremented String*
+ new_wrap_utf8(const char *utf8, size_t size);
+
+ /** Return a pointer to a new String which wraps an external buffer
+ * containing UTF-8. The buffer must stay unchanged for the lifetime
+ * of the String. Do not check validity of supplied UTF-8.
+ */
+ inert incremented String*
+ new_wrap_trusted_utf8(const char *utf8, size_t size);
+
+ /** Initialize the String which wraps an external buffer containing
+ * UTF-8. Do not check validity of supplied UTF-8.
+ */
+ public inert String*
+ init_wrap_trusted_utf8(String *self, const char *utf8, size_t size);
/** Return a String which holds a single character.
*/
@@ -256,29 +277,8 @@ class Clownfish::String cnick Str
StackTail(String *self, void *allocation);
}
-class Clownfish::ViewCharBuf cnick ViewCB
- inherits Clownfish::String {
-
- inert incremented ViewCharBuf*
- new_from_utf8(const char *utf8, size_t size);
-
- inert incremented ViewCharBuf*
- new_from_trusted_utf8(const char *utf8, size_t size);
-
- inert ViewCharBuf*
- init(ViewCharBuf *self, const char *utf8, size_t size);
-
- public void
- Destroy(ViewCharBuf *self);
-}
-
class Clownfish::StackString cnick SStr
- inherits Clownfish::ViewCharBuf {
-
- /** Return a StackString with a blank string.
- */
- inert incremented StackString*
- new(void *allocation);
+ inherits Clownfish::String {
/**
* @param allocation A single block of memory which will be used for both
@@ -424,7 +424,8 @@ class Clownfish::StackStringIterator cnick SStrIter
__C__
-#define CFISH_SSTR_BLANK() cfish_SStr_new(cfish_alloca(cfish_SStr_size()))
+#define CFISH_SSTR_BLANK() \
+ cfish_SStr_wrap_str(cfish_alloca(cfish_SStr_size()), "", 0)
#define CFISH_SSTR_WRAP(source) \
cfish_SStr_wrap(cfish_alloca(cfish_SStr_size()), source)
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/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 2d7ef0e..7743525 100644
--- a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -176,23 +176,6 @@ to_perl(self)
CODE:
RETVAL = XSBind_str_to_sv(self);
OUTPUT: RETVAL
-
-MODULE = Clownfish PACKAGE = Clownfish::ViewCharBuf
-
-SV*
-_new(unused, sv)
- SV *unused;
- SV *sv;
-CODE:
-{
- STRLEN size;
- char *ptr = SvPVutf8(sv, size);
- cfish_ViewCharBuf *self
- = cfish_ViewCB_new_from_trusted_utf8(ptr, size);
- CFISH_UNUSED_VAR(unused);
- RETVAL = CFISH_OBJ_TO_SV_NOINC(self);
-}
-OUTPUT: RETVAL
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/clownfish/runtime/perl/lib/Clownfish.pm
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/lib/Clownfish.pm b/clownfish/runtime/perl/lib/Clownfish.pm
index 7a4f961..d683245 100644
--- a/clownfish/runtime/perl/lib/Clownfish.pm
+++ b/clownfish/runtime/perl/lib/Clownfish.pm
@@ -162,14 +162,6 @@ sub error {$Clownfish::Err::error}
}
{
- package Clownfish::ViewCharBuf;
- our $VERSION = '0.003000';
- $VERSION = eval $VERSION;
- use Carp;
- sub new { confess "ViewCharBuf has no public constructor." }
-}
-
-{
package Clownfish::StackString;
our $VERSION = '0.003000';
$VERSION = eval $VERSION;
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index ea7700d..755667a 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -96,7 +96,6 @@ XSBind_maybe_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable, void *allocation) {
}
else if (allocation &&
(vtable == CFISH_STACKSTRING
- || vtable == CFISH_VIEWCHARBUF
|| vtable == CFISH_STRING
|| vtable == CFISH_OBJ)
) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/core/Lucy/Analysis/SnowballStopFilter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.c b/core/Lucy/Analysis/SnowballStopFilter.c
index 4aa9d16..f4c995e 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.c
+++ b/core/Lucy/Analysis/SnowballStopFilter.c
@@ -144,7 +144,7 @@ SnowStop_gen_stoplist(const String *language) {
NoCloneHash *stoplist = NoCloneHash_new(num_stopwords);
for (uint32_t i = 0; words[i] != NULL; i++) {
char *word = (char*)words[i];
- ViewCharBuf *stop = ViewCB_new_from_trusted_utf8(word, strlen(word));
+ String *stop = Str_new_wrap_trusted_utf8(word, strlen(word));
NoCloneHash_Store(stoplist, (Obj*)stop, (Obj*)Str_newf(""));
DECREF(stop);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/core/Lucy/Index/SortCache/TextSortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/TextSortCache.c b/core/Lucy/Index/SortCache/TextSortCache.c
index afd5b50..ad533a4 100644
--- a/core/Lucy/Index/SortCache/TextSortCache.c
+++ b/core/Lucy/Index/SortCache/TextSortCache.c
@@ -115,7 +115,7 @@ TextSortCache_Value_IMP(TextSortCache *self, int32_t ord) {
InStream_Seek(ivars->dat_in, offset);
InStream_Read_Bytes(ivars->dat_in, ptr, len);
ptr[len] = '\0';
- return (Obj*)Str_new_steal_str(ptr, len);
+ return (Obj*)Str_new_steal_utf8(ptr, len);
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/core/Lucy/Util/Freezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c
index 5452728..ea22431 100644
--- a/core/Lucy/Util/Freezer.c
+++ b/core/Lucy/Util/Freezer.c
@@ -222,7 +222,7 @@ Freezer_deserialize_string(String *string, InStream *instream) {
if (!StrHelp_utf8_valid(buf, size)) {
THROW(ERR, "Attempt to deserialize invalid UTF-8");
}
- return Str_init_steal_trusted_str(string, buf, size);
+ return Str_init_steal_trusted_utf8(string, buf, size);
}
String*
@@ -338,7 +338,7 @@ Freezer_deserialize_hash(Hash *hash, InStream *instream) {
char *key_buf = (char*)MALLOCATE(len + 1);
InStream_Read_Bytes(instream, key_buf, len);
key_buf[len] = '\0';
- String *key = Str_new_steal_from_trusted_str(key_buf, len);
+ String *key = Str_new_steal_utf8(key_buf, len);
Hash_Store(hash, (Obj*)key, THAW(instream));
DECREF(key);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index 5fedf1e..c877b74 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -654,7 +654,7 @@ S_unescape_text(const char *top, const char *end) {
Err_set_error(Err_new(mess));
return NULL;
}
- return Str_new_steal_from_trusted_str(target_buf, target_size);
+ return Str_new_steal_trusted_utf8(target_buf, target_size);
}
static CFISH_INLINE bool
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/example-lang/src/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/example-lang/src/Lucy/Document/Doc.c b/example-lang/src/Lucy/Document/Doc.c
index db1d8f7..1ec532d 100644
--- a/example-lang/src/Lucy/Document/Doc.c
+++ b/example-lang/src/Lucy/Document/Doc.c
@@ -55,8 +55,7 @@ lucy_Doc_deserialize(lucy_Doc *self, lucy_InStream *instream) {
}
lucy_Obj*
-lucy_Doc_extract(lucy_Doc *self, lucy_CharBuf *field,
- lucy_ViewCharBuf *target) {
+lucy_Doc_extract(lucy_Doc *self, lucy_CharBuf *field) {
THROW(LUCY_ERR, "TODO");
UNREACHABLE_RETURN(lucy_Obj*);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index f31eca3..f74ed22 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -158,7 +158,7 @@ LUCY_Doc_Extract_IMP(lucy_Doc *self, cfish_String *field) {
else {
STRLEN size;
char *ptr = SvPVutf8(sv, size);
- retval = (cfish_Obj*)cfish_ViewCB_new_from_trusted_utf8(ptr, size);
+ retval = (cfish_Obj*)cfish_Str_new_wrap_trusted_utf8(ptr, size);
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/perl/xs/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c
index 1d120b1..23eb9ab 100644
--- a/perl/xs/Lucy/Index/Inverter.c
+++ b/perl/xs/Lucy/Index/Inverter.c
@@ -101,7 +101,7 @@ LUCY_Inverter_Invert_Doc_IMP(lucy_Inverter *self, lucy_Doc *doc) {
char *val_ptr = SvPVutf8(value_sv, val_len);
CFISH_DECREF(entry_ivars->value);
entry_ivars->value
- = (cfish_Obj*)cfish_ViewCB_new_from_trusted_utf8(
+ = (cfish_Obj*)cfish_Str_new_wrap_trusted_utf8(
val_ptr, val_len);
break;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/180fccdf/ruby/src/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/ruby/src/Lucy/Document/Doc.c b/ruby/src/Lucy/Document/Doc.c
index db1d8f7..1ec532d 100644
--- a/ruby/src/Lucy/Document/Doc.c
+++ b/ruby/src/Lucy/Document/Doc.c
@@ -55,8 +55,7 @@ lucy_Doc_deserialize(lucy_Doc *self, lucy_InStream *instream) {
}
lucy_Obj*
-lucy_Doc_extract(lucy_Doc *self, lucy_CharBuf *field,
- lucy_ViewCharBuf *target) {
+lucy_Doc_extract(lucy_Doc *self, lucy_CharBuf *field) {
THROW(LUCY_ERR, "TODO");
UNREACHABLE_RETURN(lucy_Obj*);
}
[lucy-commits] [13/50] [abbrv] git commit: refs/heads/master - Introduce Str_To_Utf8
Posted by nw...@apache.org.
Introduce Str_To_Utf8
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/c3b1106d
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/c3b1106d
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/c3b1106d
Branch: refs/heads/master
Commit: c3b1106de563a27fbf648e090b71f94c6ed6ecba
Parents: c3ccd8c
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 14 16:45:35 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:16 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 9 ++++++---
clownfish/runtime/core/Clownfish/String.cfh | 8 ++++----
clownfish/runtime/core/Clownfish/Test/TestString.c | 15 ++++++++++++++-
3 files changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3b1106d/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index d68aacf..0fb4c5f 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -237,9 +237,12 @@ Str_To_F64_IMP(String *self) {
return value;
}
-String*
-Str_To_CB8_IMP(String *self) {
- return Str_new_from_trusted_utf8(self->ptr, self->size);
+char*
+Str_To_Utf8_IMP(String *self) {
+ char *buf = (char*)MALLOCATE(self->size + 1);
+ memcpy(buf, self->ptr, self->size);
+ buf[self->size] = '\0'; // NULL-terminate.
+ return buf;
}
String*
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3b1106d/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index 22138db..41ca029 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -173,11 +173,11 @@ class Clownfish::String cnick Str
uint8_t*
Get_Ptr8(String *self);
- /** Return a fresh copy of the string data in a String with an internal
- * encoding of UTF-8.
+ /** Return a NULL-terminated copy of the string data in UTF-8 encoding.
+ * The buffer must be freed by the caller.
*/
- String*
- To_CB8(String *self);
+ char*
+ To_Utf8(String *self);
public incremented String*
Clone(String *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3b1106d/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 2b7e911..851ff81 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestString.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestString.c
@@ -31,8 +31,10 @@
#include "Clownfish/Test.h"
#include "Clownfish/TestHarness/TestBatchRunner.h"
#include "Clownfish/TestHarness/TestUtils.h"
+#include "Clownfish/Util/Memory.h"
#include "Clownfish/VTable.h"
+#define SMILEY "\xE2\x98\xBA"
static char smiley[] = { (char)0xE2, (char)0x98, (char)0xBA, 0 };
static uint32_t smiley_len = 3;
static uint32_t smiley_cp = 0x263A;
@@ -263,6 +265,16 @@ test_To_I64(TestBatchRunner *runner) {
}
static void
+test_To_Utf8(TestBatchRunner *runner) {
+ String *string = Str_newf("a%s%sb%sc", smiley, smiley, smiley);
+ char *buf = Str_To_Utf8(string);
+ TEST_TRUE(runner, strcmp(buf, "a" SMILEY SMILEY "b" SMILEY "c") == 0,
+ "To_Utf8");
+ FREEMEM(buf);
+ DECREF(string);
+}
+
+static void
test_Length(TestBatchRunner *runner) {
String *string = Str_newf("a%s%sb%sc", smiley, smiley, smiley);
TEST_INT_EQ(runner, Str_Length(string), 6, "Length");
@@ -495,7 +507,7 @@ test_iterator_substring(TestBatchRunner *runner) {
void
TestStr_Run_IMP(TestString *self, TestBatchRunner *runner) {
- TestBatchRunner_Plan(runner, (TestBatch*)self, 100);
+ TestBatchRunner_Plan(runner, (TestBatch*)self, 101);
test_Cat(runner);
test_Clone(runner);
test_Code_Point_At_and_From(runner);
@@ -504,6 +516,7 @@ TestStr_Run_IMP(TestString *self, TestBatchRunner *runner) {
test_Trim(runner);
test_To_F64(runner);
test_To_I64(runner);
+ test_To_Utf8(runner);
test_Length(runner);
test_Compare_To(runner);
test_Swap_Chars(runner);
[lucy-commits] [07/50] [abbrv] git commit: refs/heads/master - Remove Str_new and
Str_init
Posted by nw...@apache.org.
Remove Str_new and Str_init
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/38d5f9d1
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/38d5f9d1
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/38d5f9d1
Branch: refs/heads/master
Commit: 38d5f9d1cca80a960459f64bee4c7bc37e38d4f1
Parents: cd89712
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Sep 10 02:54:08 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:14 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/c/src/Clownfish/Err.c | 5 +----
clownfish/runtime/core/Clownfish/String.c | 20 --------------------
clownfish/runtime/core/Clownfish/String.cfh | 6 ------
clownfish/runtime/core/Clownfish/Test/TestObj.c | 2 +-
clownfish/runtime/perl/xs/XSBind.c | 5 +----
core/Lucy/Highlight/Highlighter.c | 4 ++--
core/Lucy/Plan/BlobType.c | 6 ------
core/Lucy/Plan/BlobType.cfh | 3 ---
core/Lucy/Plan/TextType.c | 6 ------
core/Lucy/Plan/TextType.cfh | 3 ---
core/Lucy/Store/FileHandle.c | 2 +-
core/Lucy/Store/Folder.c | 2 +-
12 files changed, 7 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/clownfish/runtime/c/src/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/Err.c b/clownfish/runtime/c/src/Clownfish/Err.c
index cba995a..ae13494 100644
--- a/clownfish/runtime/c/src/Clownfish/Err.c
+++ b/clownfish/runtime/c/src/Clownfish/Err.c
@@ -72,10 +72,7 @@ Err_To_Host_IMP(Err *self) {
void
Err_throw_mess(VTable *vtable, String *message) {
- Err *err = (Err*)VTable_Make_Obj(vtable);
- Err_init(err, Str_new(0));
- Err_Cat_Mess(err, message);
- DECREF(message);
+ Err *err = Err_new(message);
Err_do_throw(err);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 6e74a4e..33074de 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -53,26 +53,6 @@ S_die_invalid_utf8(const char *text, size_t size, const char *file, int line,
const char *func);
String*
-Str_new(size_t size) {
- String *self = (String*)VTable_Make_Obj(STRING);
- return Str_init(self, size);
-}
-
-String*
-Str_init(String *self, size_t size) {
- // Derive.
- self->ptr = (char*)MALLOCATE(size + 1);
-
- // Init.
- *self->ptr = '\0'; // Empty string.
-
- // Assign.
- self->size = 0;
-
- return self;
-}
-
-String*
Str_new_from_utf8(const char *ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index 8f666ac..d54f473 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -26,12 +26,6 @@ class Clownfish::String cnick Str
char *ptr;
size_t size;
- inert incremented String*
- new(size_t size);
-
- inert String*
- init(String *self, size_t size);
-
/** Return a new String which holds a copy of the passed-in string.
* Check for UTF-8 validity.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/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 7e06955..c848b7d 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestObj.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestObj.c
@@ -98,7 +98,7 @@ test_Hash_Sum(TestBatchRunner *runner) {
static void
test_Is_A(TestBatchRunner *runner) {
- String *string = Str_new(0);
+ String *string = Str_new_from_trusted_utf8("", 0);
VTable *str_vtable = Str_Get_VTable(string);
String *klass = Str_Get_Class_Name(string);
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 2cfaaade..b466cf6 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -853,10 +853,7 @@ CFISH_Err_To_Host_IMP(cfish_Err *self) {
void
cfish_Err_throw_mess(cfish_VTable *vtable, cfish_String *message) {
- cfish_Err *err = (cfish_Err*)CFISH_VTable_Make_Obj(vtable);
- cfish_Err_init(err, cfish_Str_new(0));
- CFISH_Err_Cat_Mess(err, message);
- CFISH_DECREF(message);
+ cfish_Err *err = cfish_Err_new(message);
cfish_Err_do_throw(err);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index 31759da..35585a1 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -160,7 +160,7 @@ Highlighter_Create_Excerpt_IMP(Highlighter *self, HitDoc *hit_doc) {
}
else if (!Str_Get_Size(field_val)) {
// Empty string yields empty string.
- retval = Str_new(0);
+ retval = Str_new_from_trusted_utf8("", 0);
}
else {
DocVector *doc_vec
@@ -431,7 +431,7 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, const String *field_val,
String *raw_excerpt;
if (!excerpt_len) {
- raw_excerpt = Str_new(0);
+ raw_excerpt = Str_new_from_trusted_utf8("", 0);
}
else {
String *substring = StrIter_substring(top, tail);
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/core/Lucy/Plan/BlobType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/BlobType.c b/core/Lucy/Plan/BlobType.c
index 878ef31..90ccc4f 100644
--- a/core/Lucy/Plan/BlobType.c
+++ b/core/Lucy/Plan/BlobType.c
@@ -45,12 +45,6 @@ BlobType_Set_Sortable_IMP(BlobType *self, bool sortable) {
if (sortable) { THROW(ERR, "BlobType fields can't be sortable"); }
}
-ViewByteBuf*
-BlobType_Make_Blank_IMP(BlobType *self) {
- UNUSED_VAR(self);
- return ViewBB_new(NULL, 0);
-}
-
int8_t
BlobType_Primitive_ID_IMP(BlobType *self) {
UNUSED_VAR(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/core/Lucy/Plan/BlobType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/BlobType.cfh b/core/Lucy/Plan/BlobType.cfh
index 3679ddc..35db51c 100644
--- a/core/Lucy/Plan/BlobType.cfh
+++ b/core/Lucy/Plan/BlobType.cfh
@@ -42,9 +42,6 @@ public class Lucy::Plan::BlobType inherits Lucy::Plan::FieldType {
public void
Set_Sortable(BlobType *self, bool sortable);
- incremented ViewByteBuf*
- Make_Blank(BlobType *self);
-
int8_t
Primitive_ID(BlobType *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/core/Lucy/Plan/TextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.c b/core/Lucy/Plan/TextType.c
index d4b6ae8..f9e6fcc 100644
--- a/core/Lucy/Plan/TextType.c
+++ b/core/Lucy/Plan/TextType.c
@@ -24,12 +24,6 @@
#include "Clownfish/CharBuf.h"
#include "Clownfish/Util/StringHelper.h"
-String*
-TextType_Make_Blank_IMP(TextType *self) {
- UNUSED_VAR(self);
- return Str_new(0);
-}
-
TermStepper*
TextType_Make_Term_Stepper_IMP(TextType *self) {
UNUSED_VAR(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/core/Lucy/Plan/TextType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.cfh b/core/Lucy/Plan/TextType.cfh
index 654a06a..33b70ec 100644
--- a/core/Lucy/Plan/TextType.cfh
+++ b/core/Lucy/Plan/TextType.cfh
@@ -17,9 +17,6 @@
parcel Lucy;
class Lucy::Plan::TextType inherits Lucy::Plan::FieldType {
- incremented String*
- Make_Blank(TextType *self);
-
incremented TermStepper*
Make_Term_Stepper(TextType *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/core/Lucy/Store/FileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FileHandle.c b/core/Lucy/Store/FileHandle.c
index 27e2bb6..afb8035 100644
--- a/core/Lucy/Store/FileHandle.c
+++ b/core/Lucy/Store/FileHandle.c
@@ -24,7 +24,7 @@ int32_t FH_object_count = 0;
FileHandle*
FH_do_open(FileHandle *self, const String *path, uint32_t flags) {
FileHandleIVARS *const ivars = FH_IVARS(self);
- ivars->path = path ? Str_Clone(path) : Str_new(0);
+ ivars->path = path ? Str_Clone(path) : Str_new_from_trusted_utf8("", 0);
ivars->flags = flags;
// Track number of live FileHandles released into the wild.
http://git-wip-us.apache.org/repos/asf/lucy/blob/38d5f9d1/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index 371dcc6..c002e9d 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -354,7 +354,7 @@ Folder_List_R_IMP(Folder *self, const String *path) {
Folder *local_folder = Folder_Find_Folder(self, path);
VArray *list = VA_new(0);
if (local_folder) {
- String *dir = Str_new(20);
+ String *dir = Str_new_from_trusted_utf8("", 0);
S_add_to_file_list(local_folder, list, dir, path);
DECREF(dir);
}
[lucy-commits] [27/50] [abbrv] git commit: refs/heads/master - Call malloc directly
in Str_To_Utf8
Posted by nw...@apache.org.
Call malloc directly in Str_To_Utf8
This avoids surprises if MALLOCATE is ever changed.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/6bc95d59
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/6bc95d59
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/6bc95d59
Branch: refs/heads/master
Commit: 6bc95d59221b0fe4070bc39bef8aeccc514d695b
Parents: ee295df
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Sep 19 12:12:32 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:18 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/6bc95d59/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index e9b0936..8747ab3 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -297,7 +297,7 @@ Str_To_F64_IMP(String *self) {
char*
Str_To_Utf8_IMP(String *self) {
- char *buf = (char*)MALLOCATE(self->size + 1);
+ char *buf = (char*)malloc(self->size + 1);
memcpy(buf, self->ptr, self->size);
buf[self->size] = '\0'; // NULL-terminate.
return buf;
[lucy-commits] [19/50] [abbrv] git commit: refs/heads/master - Rework cloning of
Strings
Posted by nw...@apache.org.
Rework cloning of Strings
Now that strings are immutable, Clone and To_String can simply increase
the refcount and return 'self'. Only wrapped strings have to be copied.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/0b4bf991
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/0b4bf991
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/0b4bf991
Branch: refs/heads/master
Commit: 0b4bf991aabecd9886ccb1f54d8637670d92b826
Parents: 7ba4174
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 14 21:08:56 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:17 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 18 ++++++++++++++++--
clownfish/runtime/core/Clownfish/String.cfh | 3 +++
clownfish/runtime/core/Clownfish/Test/TestHash.c | 7 ++++---
.../runtime/core/Clownfish/Test/TestVArray.c | 2 +-
4 files changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/0b4bf991/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index c917a79..e9b0936 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -164,6 +164,20 @@ S_new_substring(String *origin, size_t byte_offset, size_t size) {
return self;
}
+Obj*
+Str_Inc_RefCount_IMP(String *self) {
+ if (self->origin == NULL) {
+ // Copy wrapped strings when the refcount is increased.
+ String *copy = (String*)VTable_Make_Obj(STRING);
+ return (Obj*)Str_init_from_trusted_utf8(copy, self->ptr, self->size);
+ }
+ else {
+ Str_Inc_RefCount_t super_incref
+ = SUPER_METHOD_PTR(STRING, CFISH_Str_Inc_RefCount);
+ return super_incref(self);
+ }
+}
+
void
Str_Destroy_IMP(String *self) {
if (self->origin == self) {
@@ -202,7 +216,7 @@ S_die_invalid_utf8(const char *text, size_t size, const char *file, int line,
String*
Str_To_String_IMP(String *self) {
- return Str_new_from_trusted_utf8(self->ptr, self->size);
+ return (String*)INCREF(self);
}
String*
@@ -291,7 +305,7 @@ Str_To_Utf8_IMP(String *self) {
String*
Str_Clone_IMP(String *self) {
- return Str_new_from_trusted_utf8(self->ptr, self->size);
+ return (String*)INCREF(self);
}
String*
http://git-wip-us.apache.org/repos/asf/lucy/blob/0b4bf991/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index a1a0378..e060aa5 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -203,6 +203,9 @@ class Clownfish::String cnick Str
public incremented String*
Clone(String *self);
+ incremented Obj*
+ Inc_RefCount(String *self);
+
public void
Destroy(String *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0b4bf991/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 ca35f1a..cb93b2e 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestHash.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestHash.c
@@ -97,7 +97,8 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
TEST_TRUE(runner, Hash_Fetch(hash, (Obj*)foo) == NULL,
"Fetch against non-existent key returns NULL");
- Hash_Store(hash, (Obj*)forty, INCREF(foo));
+ Obj *stored_foo = INCREF(foo);
+ Hash_Store(hash, (Obj*)forty, stored_foo);
TEST_TRUE(runner, SStr_Equals(foo, Hash_Fetch(hash, (Obj*)forty)),
"Hash_Store replaces existing value");
TEST_FALSE(runner, Hash_Equals(hash, (Obj*)dupe),
@@ -105,9 +106,9 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
TEST_INT_EQ(runner, Hash_Get_Size(hash), 100,
"size unaffected after value replaced");
- TEST_TRUE(runner, Hash_Delete(hash, (Obj*)forty) == (Obj*)foo,
+ TEST_TRUE(runner, Hash_Delete(hash, (Obj*)forty) == stored_foo,
"Delete returns value");
- DECREF(foo);
+ DECREF(stored_foo);
TEST_INT_EQ(runner, Hash_Get_Size(hash), 99,
"size decremented by successful Delete");
TEST_TRUE(runner, Hash_Delete(hash, (Obj*)forty) == NULL,
http://git-wip-us.apache.org/repos/asf/lucy/blob/0b4bf991/clownfish/runtime/core/Clownfish/Test/TestVArray.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestVArray.c b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
index 1abb89e..4aa9ccd 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestVArray.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
@@ -278,7 +278,7 @@ test_Clone_and_Shallow_Copy(TestBatchRunner *runner) {
uint32_t i;
for (i = 0; i < 10; i++) {
- VA_Push(array, (Obj*)Str_newf("%u32", i));
+ VA_Push(array, (Obj*)Int32_new(i));
}
twin = VA_Shallow_Copy(array);
TEST_TRUE(runner, VA_Equals(array, (Obj*)twin), "Shallow_Copy");
[lucy-commits] [49/50] [abbrv] git commit: refs/heads/master - Fix a couple of
warnings
Posted by nw...@apache.org.
Fix a couple of warnings
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/a249e554
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/a249e554
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/a249e554
Branch: refs/heads/master
Commit: a249e55486ffeecc87805546e557a509fc709b04
Parents: 05e2bae
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 19:22:24 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/c/src/Clownfish/Err.c | 1 +
clownfish/runtime/core/Clownfish/String.c | 1 +
clownfish/runtime/core/Clownfish/Test/TestString.c | 5 ++---
clownfish/runtime/perl/xs/XSBind.c | 1 +
core/Lucy/Highlight/Highlighter.c | 2 +-
core/Lucy/Test/TestUtils.c | 2 +-
6 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/a249e554/clownfish/runtime/c/src/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/Err.c b/clownfish/runtime/c/src/Clownfish/Err.c
index b360d5a..112a9b1 100644
--- a/clownfish/runtime/c/src/Clownfish/Err.c
+++ b/clownfish/runtime/c/src/Clownfish/Err.c
@@ -75,6 +75,7 @@ Err_To_Host_IMP(Err *self) {
void
Err_throw_mess(VTable *vtable, String *message) {
+ UNUSED_VAR(vtable);
Err *err = Err_new(message);
Err_do_throw(err);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a249e554/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index f8337d7..ee5b283 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -914,6 +914,7 @@ SStrIter_new(void *allocation, String *string, size_t byte_offset) {
void
SStrIter_Destroy_IMP(StackStringIterator *self) {
+ UNUSED_VAR(self);
THROW(ERR, "Can't destroy a StackStringIterator");
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a249e554/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 a59ff4c..634154a 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestString.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestString.c
@@ -59,7 +59,6 @@ S_smiley_with_whitespace(int *num_spaces_ptr) {
0x202F, 0x205F, 0x3000
};
int num_spaces = sizeof(spaces) / sizeof(uint32_t);
- String *got;
CharBuf *buf = CB_new(0);
for (int i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
@@ -330,7 +329,7 @@ test_iterator(TestBatchRunner *runner) {
= sizeof(code_points) / sizeof(code_points[0]);
CharBuf *buf = CB_new(0);
- for (int i = 0; i < num_code_points; ++i) {
+ for (size_t i = 0; i < num_code_points; ++i) {
CB_Cat_Char(buf, code_points[i]);
}
String *string = CB_To_String(buf);
@@ -360,7 +359,7 @@ test_iterator(TestBatchRunner *runner) {
{
StringIterator *iter = Str_Top(string);
- for (int i = 0; i < num_code_points; ++i) {
+ for (size_t i = 0; i < num_code_points; ++i) {
TEST_TRUE(runner, StrIter_Has_Next(iter), "Has_Next %d", i);
int32_t code_point = StrIter_Next(iter);
TEST_INT_EQ(runner, code_point, code_points[i], "Next %d", i);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a249e554/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 47d5e90..4a231cf 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -854,6 +854,7 @@ CFISH_Err_To_Host_IMP(cfish_Err *self) {
void
cfish_Err_throw_mess(cfish_VTable *vtable, cfish_String *message) {
+ CHY_UNUSED_VAR(vtable);
cfish_Err *err = cfish_Err_new(message);
cfish_Err_do_throw(err);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a249e554/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index 2353b11..9e1eb7e 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -382,7 +382,7 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, String *field_val,
int32_t start;
uint32_t max_skip;
- if (best_location <= ivars->slop) {
+ if ((uint32_t)best_location <= ivars->slop) {
// If the beginning of the string falls within the window centered
// around the hottest point in the field, start the fragment at the
// beginning.
http://git-wip-us.apache.org/repos/asf/lucy/blob/a249e554/core/Lucy/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c
index a6bf118..c106d76 100644
--- a/core/Lucy/Test/TestUtils.c
+++ b/core/Lucy/Test/TestUtils.c
@@ -170,7 +170,7 @@ FSFolder*
TestUtils_modules_folder() {
static const char *const paths[] = { "modules", "../modules" };
- for (int i = 0; i < sizeof(paths) / sizeof(char*); i++) {
+ for (size_t i = 0; i < sizeof(paths) / sizeof(char*); i++) {
String *path = Str_newf(paths[i]);
FSFolder *modules_folder = FSFolder_new(path);
DECREF(path);
[lucy-commits] [04/50] [abbrv] git commit: refs/heads/master - Remove Assign methods
from ViewCharBuf
Posted by nw...@apache.org.
Remove Assign methods from ViewCharBuf
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/d7a385b3
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/d7a385b3
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/d7a385b3
Branch: refs/heads/master
Commit: d7a385b330d3811f4a4f800e9cb0debb43fd479d
Parents: 062c39b
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Sep 8 12:22:26 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:13 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 21 ---------------------
clownfish/runtime/core/Clownfish/String.cfh | 9 ---------
2 files changed, 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/d7a385b3/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 319f54d..d5b5832 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -592,27 +592,6 @@ ViewCB_Destroy_IMP(ViewCharBuf *self) {
SUPER_DESTROY(self, STRING);
}
-void
-ViewCB_Assign_IMP(ViewCharBuf *self, const String *other) {
- self->ptr = other->ptr;
- self->size = other->size;
-}
-
-void
-ViewCB_Assign_Str_IMP(ViewCharBuf *self, const char *utf8, size_t size) {
- if (!StrHelp_utf8_valid(utf8, size)) {
- DIE_INVALID_UTF8(utf8, size);
- }
- self->ptr = (char*)utf8;
- self->size = size;
-}
-
-void
-ViewCB_Assign_Trusted_Str_IMP(ViewCharBuf *self, const char *utf8, size_t size) {
- self->ptr = (char*)utf8;
- self->size = size;
-}
-
char*
ViewCB_Grow_IMP(ViewCharBuf *self, size_t size) {
UNUSED_VAR(size);
http://git-wip-us.apache.org/repos/asf/lucy/blob/d7a385b3/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index bce0b36..ecd7bfb 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -295,15 +295,6 @@ class Clownfish::ViewCharBuf cnick ViewCB
inert ViewCharBuf*
init(ViewCharBuf *self, const char *utf8, size_t size);
- void
- Assign(ViewCharBuf *self, const String *other);
-
- void
- Assign_Str(ViewCharBuf *self, const char *utf8, size_t size);
-
- void
- Assign_Trusted_Str(ViewCharBuf *self, const char *utf8, size_t size);
-
/** Throws an error. */
char*
Grow(ViewCharBuf *self, size_t size);
[lucy-commits] [08/50] [abbrv] git commit: refs/heads/master - Remove unused
S_die_invalid_pattern from String.c
Posted by nw...@apache.org.
Remove unused S_die_invalid_pattern from String.c
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/cd89712d
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/cd89712d
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/cd89712d
Branch: refs/heads/master
Commit: cd89712d5d89f4f2c7e4ececbb42b0a14456868c
Parents: 7c42ec4
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Sep 10 02:40:16 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:14 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 13 -------------
1 file changed, 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/cd89712d/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index ecc5989..6e74a4e 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -52,10 +52,6 @@ static void
S_die_invalid_utf8(const char *text, size_t size, const char *file, int line,
const char *func);
-// Helper function for throwing invalid pattern error.
-static void
-S_die_invalid_pattern(const char *pattern);
-
String*
Str_new(size_t size) {
String *self = (String*)VTable_Make_Obj(STRING);
@@ -180,15 +176,6 @@ S_die_invalid_utf8(const char *text, size_t size, const char *file, int line,
Err_throw_at(ERR, file, line, func, "Invalid UTF-8");
}
-static void
-S_die_invalid_pattern(const char *pattern) {
- size_t pattern_len = strlen(pattern);
- fprintf(stderr, "Invalid pattern, aborting: '");
- fwrite(pattern, sizeof(char), pattern_len, stderr);
- fprintf(stderr, "'\n");
- THROW(ERR, "Invalid pattern.");
-}
-
String*
Str_To_String_IMP(String *self) {
return Str_new_from_trusted_utf8(self->ptr, self->size);
[lucy-commits] [10/50] [abbrv] git commit: refs/heads/master - Optimize Str_compare
Posted by nw...@apache.org.
Optimize Str_compare
UTF-8 strings can be (naively) compared using memcmp.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/b0ddea3f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/b0ddea3f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/b0ddea3f
Branch: refs/heads/master
Commit: b0ddea3f35a6ff896f6a146a17bd2e4ee2e540ce
Parents: 38d5f9d
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Sep 10 03:19:37 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:15 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 31 ++++++++++++--------------
1 file changed, 14 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/b0ddea3f/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 33074de..ef98320 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -425,26 +425,23 @@ int
Str_compare(const void *va, const void *vb) {
const String *a = *(const String**)va;
const String *b = *(const String**)vb;
+ size_t min_size;
+ int tie;
- StackStringIterator *iter_a = STR_STACKTOP(a);
- StackStringIterator *iter_b = STR_STACKTOP(b);
-
- while (true) {
- uint32_t code_point_a = SStrIter_Next(iter_a);
- uint32_t code_point_b = SStrIter_Next(iter_b);
-
- if (code_point_a == STRITER_DONE) {
- return code_point_b == STRITER_DONE ? 0 : -1;
- }
- if (code_point_b == STRITER_DONE) {
- return 1;
- }
- if (code_point_a != code_point_b) {
- return code_point_a < code_point_b ? -1 : 1;
- }
+ if (a->size <= b->size) {
+ min_size = a->size;
+ tie = a->size < b->size ? -1 : 0;
+ }
+ else {
+ min_size = b->size;
+ tie = 1;
}
- UNREACHABLE_RETURN(int);
+ int comparison = memcmp(a->ptr, b->ptr, min_size);
+ if (comparison < 0) { return -1; }
+ if (comparison > 0) { return 1; }
+
+ return tie;
}
bool
[lucy-commits] [34/50] [abbrv] git commit: refs/heads/master - Rename a couple of
variables referring to ZombieCharBufs
Posted by nw...@apache.org.
Rename a couple of variables referring to ZombieCharBufs
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/be4e63b3
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/be4e63b3
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/be4e63b3
Branch: refs/heads/master
Commit: be4e63b3eebb1e9806ae835448ecd9077e655b39
Parents: 87746f2
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 16:19:38 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:19 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Index/DocReader.c | 4 ++--
clownfish/compiler/src/CFCPerlSub.c | 8 ++++----
perl/xs/Lucy/Index/DocReader.c | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/be4e63b3/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index ebd213c..a887fea 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -66,9 +66,9 @@ DefDocReader_Fetch_Doc_IMP(DefaultDocReader *self, int32_t doc_id) {
InStream_Read_Bytes(dat_in, field_name, field_name_len);
// Find the Field's FieldType.
- StackString *field_name_zcb
+ StackString *field_name_str
= SSTR_WRAP_UTF8(field_name, field_name_len);
- type = Schema_Fetch_Type(schema, (String*)field_name_zcb);
+ type = Schema_Fetch_Type(schema, (String*)field_name_str);
// Read the field value.
switch (FType_Primitive_ID(type) & FType_PRIMITIVE_ID_MASK) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/be4e63b3/clownfish/compiler/src/CFCPerlSub.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlSub.c b/clownfish/compiler/src/CFCPerlSub.c
index c71e990..5d8d1f2 100644
--- a/clownfish/compiler/src/CFCPerlSub.c
+++ b/clownfish/compiler/src/CFCPerlSub.c
@@ -152,12 +152,12 @@ S_allot_params_arg(CFCType *type, const char *label, int required) {
) {
use_sv_buffer = true;
}
- const char *zcb_allocation = use_sv_buffer
- ? "alloca(cfish_SStr_size())"
- : "NULL";
+ const char *allocation = use_sv_buffer
+ ? "alloca(cfish_SStr_size())"
+ : "NULL";
const char pattern[] = "ALLOT_OBJ(&%s, \"%s\", %u, %s, %s, %s)";
char *arg = CFCUtil_sprintf(pattern, label, label, label_len,
- req_string, vtable_var, zcb_allocation);
+ req_string, vtable_var, allocation);
return arg;
}
else if (CFCType_is_primitive(type)) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/be4e63b3/perl/xs/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/DocReader.c b/perl/xs/Lucy/Index/DocReader.c
index 29a0359..90a929e 100644
--- a/perl/xs/Lucy/Index/DocReader.c
+++ b/perl/xs/Lucy/Index/DocReader.c
@@ -61,9 +61,9 @@ LUCY_DefDocReader_Fetch_Doc_IMP(lucy_DefaultDocReader *self, int32_t doc_id) {
*SvEND(field_name_sv) = '\0';
// Find the Field's FieldType.
- cfish_StackString *field_name_zcb
+ cfish_StackString *field_name_str
= CFISH_SSTR_WRAP_UTF8(field_name_ptr, field_name_len);
- type = LUCY_Schema_Fetch_Type(schema, (cfish_String*)field_name_zcb);
+ type = LUCY_Schema_Fetch_Type(schema, (cfish_String*)field_name_str);
// Read the field value.
switch (LUCY_FType_Primitive_ID(type) & lucy_FType_PRIMITIVE_ID_MASK) {
[lucy-commits] [43/50] [abbrv] git commit: refs/heads/master - Convert 'const
ByteBuf' to 'ByteBuf'
Posted by nw...@apache.org.
Convert 'const ByteBuf' to 'ByteBuf'
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/94697de5
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/94697de5
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/94697de5
Branch: refs/heads/master
Commit: 94697de53a9d80825ae18aeff1fe7a2beb6badff
Parents: f3e6ed6
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 30 23:12:56 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/ByteBuf.c | 8 ++++----
clownfish/runtime/core/Clownfish/ByteBuf.cfh | 4 ++--
clownfish/runtime/perl/xs/XSBind.c | 2 +-
clownfish/runtime/perl/xs/XSBind.h | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/94697de5/clownfish/runtime/core/Clownfish/ByteBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/ByteBuf.c b/clownfish/runtime/core/Clownfish/ByteBuf.c
index ceb97ee..c267d28 100644
--- a/clownfish/runtime/core/Clownfish/ByteBuf.c
+++ b/clownfish/runtime/core/Clownfish/ByteBuf.c
@@ -172,7 +172,7 @@ BB_Cat_Bytes_IMP(ByteBuf *self, const void *bytes, size_t size) {
}
void
-BB_Cat_IMP(ByteBuf *self, const ByteBuf *other) {
+BB_Cat_IMP(ByteBuf *self, ByteBuf *other) {
SI_cat_bytes(self, other->buf, other->size);
}
@@ -198,8 +198,8 @@ BB_Grow_IMP(ByteBuf *self, size_t size) {
int
BB_compare(const void *va, const void *vb) {
- const ByteBuf *a = *(const ByteBuf**)va;
- const ByteBuf *b = *(const ByteBuf**)vb;
+ ByteBuf *a = *(ByteBuf**)va;
+ ByteBuf *b = *(ByteBuf**)vb;
const size_t size = a->size < b->size ? a->size : b->size;
int32_t comparison = memcmp(a->buf, b->buf, size);
@@ -246,7 +246,7 @@ ViewBB_Assign_Bytes_IMP(ViewByteBuf *self, char*buf, size_t size) {
}
void
-ViewBB_Assign_IMP(ViewByteBuf *self, const ByteBuf *other) {
+ViewBB_Assign_IMP(ViewByteBuf *self, ByteBuf *other) {
self->buf = other->buf;
self->size = other->size;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/94697de5/clownfish/runtime/core/Clownfish/ByteBuf.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/ByteBuf.cfh b/clownfish/runtime/core/Clownfish/ByteBuf.cfh
index 388e854..60b258c 100644
--- a/clownfish/runtime/core/Clownfish/ByteBuf.cfh
+++ b/clownfish/runtime/core/Clownfish/ByteBuf.cfh
@@ -96,7 +96,7 @@ class Clownfish::ByteBuf cnick BB inherits Clownfish::Obj {
* original ByteBuf. Allocate more memory as needed.
*/
void
- Cat(ByteBuf *self, const ByteBuf *other);
+ Cat(ByteBuf *self, ByteBuf *other);
/** Assign more memory to the ByteBuf, if it doesn't already have enough
* room to hold <code>size</code> bytes. Cannot shrink the allocation.
@@ -150,7 +150,7 @@ class Clownfish::ViewByteBuf cnick ViewBB
/** Assign buf and size members from the passed-in ByteBuf.
*/
void
- Assign(ViewByteBuf *self, const ByteBuf *other);
+ Assign(ViewByteBuf *self, ByteBuf *other);
public void
Destroy(ViewByteBuf *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/94697de5/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 4a231cf..4c7a275 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -218,7 +218,7 @@ XSBind_perl_to_cfish(SV *sv) {
}
SV*
-XSBind_bb_to_sv(const cfish_ByteBuf *bb) {
+XSBind_bb_to_sv(cfish_ByteBuf *bb) {
return bb
? newSVpvn(CFISH_BB_Get_Buf(bb), CFISH_BB_Get_Size(bb))
: newSV(0);
http://git-wip-us.apache.org/repos/asf/lucy/blob/94697de5/clownfish/runtime/perl/xs/XSBind.h
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.h b/clownfish/runtime/perl/xs/XSBind.h
index 01c6d6c..e37058c 100644
--- a/clownfish/runtime/perl/xs/XSBind.h
+++ b/clownfish/runtime/perl/xs/XSBind.h
@@ -128,7 +128,7 @@ cfish_XSBind_perl_to_cfish(SV *sv);
/** Convert a ByteBuf into a new string SV.
*/
CFISH_VISIBLE SV*
-cfish_XSBind_bb_to_sv(const cfish_ByteBuf *bb);
+cfish_XSBind_bb_to_sv(cfish_ByteBuf *bb);
/** Convert a String into a new UTF-8 string SV.
*/
[lucy-commits] [38/50] [abbrv] git commit: refs/heads/master - Convert "const
String" to "String"
Posted by nw...@apache.org.
Convert "const String" to "String"
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f079ab91
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f079ab91
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f079ab91
Branch: refs/heads/master
Commit: f079ab9112e445ff352fd785640358a4d360a796
Parents: 5fcb13d
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 17:18:57 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:19 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Analysis/RegexTokenizer.c | 4 +-
c/src/Lucy/Document/Doc.c | 2 +-
clownfish/compiler/src/CFCPerlTypeMap.c | 6 +--
clownfish/runtime/c/src/Clownfish/VTable.c | 4 +-
clownfish/runtime/core/Clownfish/CharBuf.c | 2 +-
clownfish/runtime/core/Clownfish/CharBuf.cfh | 2 +-
clownfish/runtime/core/Clownfish/Err.c | 2 +-
clownfish/runtime/core/Clownfish/Err.cfh | 2 +-
clownfish/runtime/core/Clownfish/Method.c | 4 +-
clownfish/runtime/core/Clownfish/Method.cfh | 4 +-
clownfish/runtime/core/Clownfish/String.c | 14 ++---
clownfish/runtime/core/Clownfish/String.cfh | 10 ++--
clownfish/runtime/core/Clownfish/VTable.c | 4 +-
clownfish/runtime/core/Clownfish/VTable.cfh | 8 +--
.../perl/buildlib/Clownfish/Build/Binding.pm | 6 +--
clownfish/runtime/perl/xs/XSBind.c | 6 +--
clownfish/runtime/perl/xs/XSBind.h | 2 +-
clownfish/runtime/ruby/ext/Bind.c | 2 +-
clownfish/runtime/ruby/ext/Bind.h | 2 +-
core/Lucy/Analysis/EasyAnalyzer.c | 4 +-
core/Lucy/Analysis/EasyAnalyzer.cfh | 4 +-
core/Lucy/Analysis/Normalizer.c | 4 +-
core/Lucy/Analysis/Normalizer.cfh | 4 +-
core/Lucy/Analysis/PolyAnalyzer.c | 4 +-
core/Lucy/Analysis/PolyAnalyzer.cfh | 4 +-
core/Lucy/Analysis/RegexTokenizer.c | 2 +-
core/Lucy/Analysis/RegexTokenizer.cfh | 4 +-
core/Lucy/Analysis/SnowballStemmer.c | 4 +-
core/Lucy/Analysis/SnowballStemmer.cfh | 4 +-
core/Lucy/Analysis/SnowballStopFilter.c | 6 +--
core/Lucy/Analysis/SnowballStopFilter.cfh | 6 +--
core/Lucy/Document/Doc.cfh | 2 +-
core/Lucy/Highlight/Highlighter.c | 12 ++---
core/Lucy/Highlight/Highlighter.cfh | 12 ++---
core/Lucy/Index/BitVecDelDocs.c | 4 +-
core/Lucy/Index/BitVecDelDocs.cfh | 4 +-
core/Lucy/Index/DeletionsWriter.c | 4 +-
core/Lucy/Index/DeletionsWriter.cfh | 8 +--
core/Lucy/Index/DocVector.c | 12 ++---
core/Lucy/Index/DocVector.cfh | 6 +--
core/Lucy/Index/IndexManager.c | 6 +--
core/Lucy/Index/IndexManager.cfh | 6 +--
core/Lucy/Index/IndexReader.c | 4 +-
core/Lucy/Index/IndexReader.cfh | 4 +-
core/Lucy/Index/Inverter.c | 4 +-
core/Lucy/Index/Inverter.cfh | 4 +-
core/Lucy/Index/LexIndex.c | 4 +-
core/Lucy/Index/LexIndex.cfh | 4 +-
core/Lucy/Index/Lexicon.c | 2 +-
core/Lucy/Index/Lexicon.cfh | 2 +-
core/Lucy/Index/LexiconReader.c | 12 ++---
core/Lucy/Index/LexiconReader.cfh | 16 +++---
core/Lucy/Index/LexiconWriter.c | 2 +-
core/Lucy/Index/LexiconWriter.cfh | 2 +-
core/Lucy/Index/PolyLexicon.c | 4 +-
core/Lucy/Index/PolyLexicon.cfh | 4 +-
core/Lucy/Index/PolyReader.c | 4 +-
core/Lucy/Index/PostingListReader.c | 2 +-
core/Lucy/Index/PostingListReader.cfh | 4 +-
core/Lucy/Index/PostingPool.c | 4 +-
core/Lucy/Index/PostingPool.cfh | 4 +-
core/Lucy/Index/RawLexicon.c | 4 +-
core/Lucy/Index/RawLexicon.cfh | 4 +-
core/Lucy/Index/RawPostingList.c | 4 +-
core/Lucy/Index/RawPostingList.cfh | 4 +-
core/Lucy/Index/SegLexicon.c | 4 +-
core/Lucy/Index/SegLexicon.cfh | 4 +-
core/Lucy/Index/SegPostingList.c | 4 +-
core/Lucy/Index/SegPostingList.cfh | 4 +-
core/Lucy/Index/SegReader.c | 2 +-
core/Lucy/Index/SegReader.cfh | 2 +-
core/Lucy/Index/SegWriter.c | 4 +-
core/Lucy/Index/SegWriter.cfh | 4 +-
core/Lucy/Index/Segment.c | 10 ++--
core/Lucy/Index/Segment.cfh | 10 ++--
core/Lucy/Index/Snapshot.c | 10 ++--
core/Lucy/Index/Snapshot.cfh | 10 ++--
core/Lucy/Index/SortCache.c | 2 +-
core/Lucy/Index/SortCache.cfh | 2 +-
core/Lucy/Index/SortCache/NumericSortCache.c | 18 +++----
core/Lucy/Index/SortCache/NumericSortCache.cfh | 18 +++----
core/Lucy/Index/SortCache/TextSortCache.c | 4 +-
core/Lucy/Index/SortCache/TextSortCache.cfh | 4 +-
core/Lucy/Index/SortFieldWriter.c | 4 +-
core/Lucy/Index/SortFieldWriter.cfh | 4 +-
core/Lucy/Index/SortReader.c | 4 +-
core/Lucy/Index/SortReader.cfh | 4 +-
core/Lucy/Index/TermVector.c | 4 +-
core/Lucy/Index/TermVector.cfh | 4 +-
core/Lucy/Plan/Schema.c | 26 +++++-----
core/Lucy/Plan/Schema.cfh | 10 ++--
core/Lucy/Search/Compiler.c | 2 +-
core/Lucy/Search/Compiler.cfh | 2 +-
core/Lucy/Search/IndexSearcher.c | 2 +-
core/Lucy/Search/IndexSearcher.cfh | 2 +-
core/Lucy/Search/LeafQuery.c | 4 +-
core/Lucy/Search/LeafQuery.cfh | 4 +-
core/Lucy/Search/NOTQuery.c | 2 +-
core/Lucy/Search/NOTQuery.cfh | 2 +-
core/Lucy/Search/PhraseQuery.c | 6 +--
core/Lucy/Search/PhraseQuery.cfh | 6 +--
core/Lucy/Search/PolyQuery.c | 2 +-
core/Lucy/Search/PolyQuery.cfh | 2 +-
core/Lucy/Search/PolySearcher.c | 2 +-
core/Lucy/Search/PolySearcher.cfh | 2 +-
core/Lucy/Search/QueryParser.c | 14 ++---
core/Lucy/Search/QueryParser.cfh | 12 ++---
core/Lucy/Search/QueryParser/QueryLexer.c | 2 +-
core/Lucy/Search/QueryParser/QueryLexer.cfh | 2 +-
core/Lucy/Search/RangeQuery.c | 6 +--
core/Lucy/Search/RangeQuery.cfh | 4 +-
core/Lucy/Search/Searcher.cfh | 2 +-
core/Lucy/Search/SortRule.c | 4 +-
core/Lucy/Search/SortRule.cfh | 4 +-
core/Lucy/Search/TermQuery.c | 6 +--
core/Lucy/Search/TermQuery.cfh | 6 +--
core/Lucy/Store/CompoundFileReader.c | 16 +++---
core/Lucy/Store/CompoundFileReader.cfh | 16 +++---
core/Lucy/Store/DirHandle.c | 2 +-
core/Lucy/Store/DirHandle.cfh | 2 +-
core/Lucy/Store/FSDirHandle.c | 6 +--
core/Lucy/Store/FSDirHandle.cfh | 4 +-
core/Lucy/Store/FSFileHandle.c | 4 +-
core/Lucy/Store/FSFileHandle.cfh | 4 +-
core/Lucy/Store/FSFolder.c | 54 ++++++++++----------
core/Lucy/Store/FSFolder.cfh | 20 ++++----
core/Lucy/Store/FileHandle.c | 4 +-
core/Lucy/Store/FileHandle.cfh | 4 +-
core/Lucy/Store/Folder.c | 38 +++++++-------
core/Lucy/Store/Folder.cfh | 52 +++++++++----------
core/Lucy/Store/InStream.c | 2 +-
core/Lucy/Store/InStream.cfh | 2 +-
core/Lucy/Store/Lock.c | 12 ++---
core/Lucy/Store/Lock.cfh | 12 ++---
core/Lucy/Store/LockFactory.c | 8 +--
core/Lucy/Store/LockFactory.cfh | 8 +--
core/Lucy/Store/RAMFileHandle.c | 4 +-
core/Lucy/Store/RAMFileHandle.cfh | 4 +-
core/Lucy/Store/RAMFolder.c | 30 +++++------
core/Lucy/Store/RAMFolder.cfh | 20 ++++----
core/Lucy/Store/SharedLock.c | 6 +--
core/Lucy/Store/SharedLock.cfh | 6 +--
core/Lucy/Test/Store/MockFileHandle.c | 4 +-
core/Lucy/Test/Store/MockFileHandle.cfh | 4 +-
core/Lucy/Util/IndexFileNames.c | 4 +-
core/Lucy/Util/IndexFileNames.cfh | 4 +-
core/Lucy/Util/Json.c | 4 +-
core/Lucy/Util/Json.cfh | 4 +-
core/LucyX/Search/ProximityQuery.c | 6 +--
core/LucyX/Search/ProximityQuery.cfh | 6 +--
perl/buildlib/Lucy/Build/Binding/Util.pm | 2 +-
perl/xs/Lucy/Analysis/RegexTokenizer.c | 6 +--
perl/xs/Lucy/Document/Doc.c | 2 +-
153 files changed, 487 insertions(+), 491 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/c/src/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Analysis/RegexTokenizer.c b/c/src/Lucy/Analysis/RegexTokenizer.c
index 62085cb..b3d7a6a 100644
--- a/c/src/Lucy/Analysis/RegexTokenizer.c
+++ b/c/src/Lucy/Analysis/RegexTokenizer.c
@@ -44,7 +44,7 @@ RegexTokenizer_is_available(void) {
}
RegexTokenizer*
-RegexTokenizer_init(RegexTokenizer *self, const String *pattern) {
+RegexTokenizer_init(RegexTokenizer *self, String *pattern) {
Analyzer_init((Analyzer*)self);
RegexTokenizerIVARS *const ivars = RegexTokenizer_IVARS(self);
@@ -167,7 +167,7 @@ RegexTokenizer_is_available(void) {
}
RegexTokenizer*
-RegexTokenizer_init(RegexTokenizer *self, const String *pattern) {
+RegexTokenizer_init(RegexTokenizer *self, String *pattern) {
UNUSED_VAR(self);
UNUSED_VAR(pattern);
THROW(ERR,
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/c/src/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Document/Doc.c b/c/src/Lucy/Document/Doc.c
index 4aa129c..bc6c85b 100644
--- a/c/src/Lucy/Document/Doc.c
+++ b/c/src/Lucy/Document/Doc.c
@@ -61,7 +61,7 @@ Doc_Get_Size_IMP(Doc *self) {
}
void
-Doc_Store_IMP(Doc *self, const String *field, Obj *value) {
+Doc_Store_IMP(Doc *self, String *field, Obj *value) {
Hash *hash = (Hash*)Doc_IVARS(self)->fields;
Hash_Store(hash, (Obj *)field, INCREF(value));
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/compiler/src/CFCPerlTypeMap.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlTypeMap.c b/clownfish/compiler/src/CFCPerlTypeMap.c
index 32fbc53..4553a13 100644
--- a/clownfish/compiler/src/CFCPerlTypeMap.c
+++ b/clownfish/compiler/src/CFCPerlTypeMap.c
@@ -211,8 +211,7 @@ static const char typemap_start[] =
"uint16_t\tCFISH_UNSIGNED_INT\n"
"uint32_t\tCFISH_UNSIGNED_INT\n"
"uint64_t\tCFISH_BIG_UNSIGNED_INT\n"
- "\n"
- "const cfish_String*\tCONST_CHARBUF\n";
+ "\n";
static const char typemap_input[] =
@@ -232,9 +231,6 @@ static const char typemap_input[] =
"\n"
"CFISH_BIG_UNSIGNED_INT \n"
" $var = (sizeof(UV) == 8) ? ($type)SvUV($arg) : ($type)SvNV($arg);\n"
- "\n"
- "CONST_CHARBUF\n"
- " $var = (const cfish_String*)CFISH_SSTR_WRAP_UTF8(SvPVutf8_nolen($arg), SvCUR($arg));\n"
"\n";
static const char typemap_output[] =
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/c/src/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/VTable.c b/clownfish/runtime/c/src/Clownfish/VTable.c
index ac822db..5617900 100644
--- a/clownfish/runtime/c/src/Clownfish/VTable.c
+++ b/clownfish/runtime/c/src/Clownfish/VTable.c
@@ -58,13 +58,13 @@ VTable_register_with_host(VTable *singleton, VTable *parent) {
}
VArray*
-VTable_fresh_host_methods(const String *class_name) {
+VTable_fresh_host_methods(String *class_name) {
UNUSED_VAR(class_name);
return VA_new(0);
}
String*
-VTable_find_parent_class(const String *class_name) {
+VTable_find_parent_class(String *class_name) {
UNUSED_VAR(class_name);
THROW(ERR, "TODO");
UNREACHABLE_RETURN(String*);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index ea056b8..893d0f5 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -382,7 +382,7 @@ CB_Cat_Trusted_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
}
void
-CB_Cat_IMP(CharBuf *self, const String *string) {
+CB_Cat_IMP(CharBuf *self, String *string) {
const size_t new_size = self->size + string->size;
if (new_size >= self->cap) {
size_t amount = Memory_oversize(new_size, sizeof(char));
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.cfh b/clownfish/runtime/core/Clownfish/CharBuf.cfh
index 34c23c3..77a6e32 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.cfh
+++ b/clownfish/runtime/core/Clownfish/CharBuf.cfh
@@ -80,7 +80,7 @@ class Clownfish::CharBuf cnick CB
* caller.
*/
void
- Cat(CharBuf *self, const String *string);
+ Cat(CharBuf *self, String *string);
/** Concatenate formatted arguments. Similar to the printf family, but
* only accepts minimal options (just enough for decent error messages).
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Err.c b/clownfish/runtime/core/Clownfish/Err.c
index 7ae899a..742ffcc 100644
--- a/clownfish/runtime/core/Clownfish/Err.c
+++ b/clownfish/runtime/core/Clownfish/Err.c
@@ -57,7 +57,7 @@ Err_To_String_IMP(Err *self) {
}
void
-Err_Cat_Mess_IMP(Err *self, const String *mess) {
+Err_Cat_Mess_IMP(Err *self, String *mess) {
String *new_mess = Str_Cat(self->mess, mess);
DECREF(self->mess);
self->mess = new_mess;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/Err.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Err.cfh b/clownfish/runtime/core/Clownfish/Err.cfh
index 3f47e4f..348e0ed 100644
--- a/clownfish/runtime/core/Clownfish/Err.cfh
+++ b/clownfish/runtime/core/Clownfish/Err.cfh
@@ -61,7 +61,7 @@ public class Clownfish::Err inherits Clownfish::Obj {
/** Concatenate the supplied argument onto the internal "mess".
*/
public void
- Cat_Mess(Err *self, const String *mess);
+ Cat_Mess(Err *self, String *mess);
public String*
Get_Mess(Err *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/Method.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Method.c b/clownfish/runtime/core/Clownfish/Method.c
index 9f4bddd..e7a72e5 100644
--- a/clownfish/runtime/core/Clownfish/Method.c
+++ b/clownfish/runtime/core/Clownfish/Method.c
@@ -26,13 +26,13 @@
#include "Clownfish/VTable.h"
Method*
-Method_new(const String *name, cfish_method_t callback_func, size_t offset) {
+Method_new(String *name, cfish_method_t callback_func, size_t offset) {
Method *self = (Method*)VTable_Make_Obj(METHOD);
return Method_init(self, name, callback_func, offset);
}
Method*
-Method_init(Method *self, const String *name, cfish_method_t callback_func,
+Method_init(Method *self, String *name, cfish_method_t callback_func,
size_t offset) {
self->name = Str_Clone(name);
self->host_alias = NULL;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/Method.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Method.cfh b/clownfish/runtime/core/Clownfish/Method.cfh
index 521839c..4f73384 100644
--- a/clownfish/runtime/core/Clownfish/Method.cfh
+++ b/clownfish/runtime/core/Clownfish/Method.cfh
@@ -28,10 +28,10 @@ class Clownfish::Method inherits Clownfish::Obj {
bool is_excluded;
inert Method*
- new(const String *name, cfish_method_t callback_func, size_t offset);
+ new(String *name, cfish_method_t callback_func, size_t offset);
inert Method*
- init(Method *self, const String *name, cfish_method_t callback_func,
+ init(Method *self, String *name, cfish_method_t callback_func,
size_t offset);
String*
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index b2c2c97..f8337d7 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -317,7 +317,7 @@ Str_Clone_IMP(String *self) {
}
String*
-Str_Cat_IMP(String *self, const String *other) {
+Str_Cat_IMP(String *self, String *other) {
return Str_Cat_Trusted_Utf8(self, other->ptr, other->size);
}
@@ -341,7 +341,7 @@ Str_Cat_Trusted_Utf8_IMP(String *self, const char* ptr, size_t size) {
}
bool
-Str_Starts_With_IMP(String *self, const String *prefix) {
+Str_Starts_With_IMP(String *self, String *prefix) {
return Str_Starts_With_Utf8_IMP(self, prefix->ptr, prefix->size);
}
@@ -380,7 +380,7 @@ Str_Equals_Utf8_IMP(String *self, const char *ptr, size_t size) {
}
bool
-Str_Ends_With_IMP(String *self, const String *postfix) {
+Str_Ends_With_IMP(String *self, String *postfix) {
return Str_Ends_With_Utf8_IMP(self, postfix->ptr, postfix->size);
}
@@ -397,7 +397,7 @@ Str_Ends_With_Utf8_IMP(String *self, const char *postfix, size_t postfix_len) {
}
int64_t
-Str_Find_IMP(String *self, const String *substring) {
+Str_Find_IMP(String *self, String *substring) {
return Str_Find_Utf8(self, substring->ptr, substring->size);
}
@@ -483,8 +483,8 @@ Str_SubString_IMP(String *self, size_t offset, size_t len) {
int
Str_compare(const void *va, const void *vb) {
- const String *a = *(const String**)va;
- const String *b = *(const String**)vb;
+ String *a = *(String**)va;
+ String *b = *(String**)vb;
size_t min_size;
int tie;
@@ -571,7 +571,7 @@ SStr_wrap_str(void *allocation, const char *ptr, size_t size) {
}
StackString*
-SStr_wrap(void *allocation, const String *source) {
+SStr_wrap(void *allocation, String *source) {
return SStr_wrap_str(allocation, source->ptr, source->size);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index b66bbf5..4d18706 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -113,7 +113,7 @@ class Clownfish::String cnick Str
/** Return the concatenation of the String and <code>other</code>.
*/
incremented String*
- Cat(String *self, const String *other);
+ Cat(String *self, String *other);
/** Return the concatenation of the String and the passed-in raw UTF-8.
*/
@@ -147,7 +147,7 @@ class Clownfish::String cnick Str
/** Test whether the String starts with the content of another.
*/
bool
- Starts_With(String *self, const String *prefix);
+ Starts_With(String *self, String *prefix);
/** Test whether the String starts with the passed-in string.
*/
@@ -157,7 +157,7 @@ class Clownfish::String cnick Str
/** Test whether the String ends with the content of another.
*/
bool
- Ends_With(String *self, const String *postfix);
+ Ends_With(String *self, String *postfix);
/** Test whether the String ends with the passed-in string.
*/
@@ -168,7 +168,7 @@ class Clownfish::String cnick Str
* code points), or -1 if the substring does not match.
*/
int64_t
- Find(String *self, const String *substring);
+ Find(String *self, String *substring);
int64_t
Find_Utf8(String *self, const char *ptr, size_t size);
@@ -293,7 +293,7 @@ class Clownfish::StackString cnick SStr
new_from_str(void *allocation, size_t alloc_size, String *string);
inert incremented StackString*
- wrap(void *allocation, const String *source);
+ wrap(void *allocation, String *source);
inert incremented StackString*
wrap_str(void *allocation, const char *ptr, size_t size);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VTable.c b/clownfish/runtime/core/Clownfish/VTable.c
index 71c6800..fe6d718 100644
--- a/clownfish/runtime/core/Clownfish/VTable.c
+++ b/clownfish/runtime/core/Clownfish/VTable.c
@@ -248,7 +248,7 @@ VTable_init_registry() {
}
VTable*
-VTable_singleton(const String *class_name, VTable *parent) {
+VTable_singleton(String *class_name, VTable *parent) {
if (VTable_registry == NULL) {
VTable_init_registry();
}
@@ -381,7 +381,7 @@ VTable_add_alias_to_registry(VTable *vtable, const char *alias_ptr,
}
VTable*
-VTable_fetch_vtable(const String *class_name) {
+VTable_fetch_vtable(String *class_name) {
VTable *vtable = NULL;
if (VTable_registry != NULL) {
vtable = (VTable*)LFReg_Fetch(VTable_registry, (Obj*)class_name);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/core/Clownfish/VTable.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VTable.cfh b/clownfish/runtime/core/Clownfish/VTable.cfh
index 11d1669..97e5cf6 100644
--- a/clownfish/runtime/core/Clownfish/VTable.cfh
+++ b/clownfish/runtime/core/Clownfish/VTable.cfh
@@ -49,7 +49,7 @@ class Clownfish::VTable inherits Clownfish::Obj {
* result.
*/
inert VTable*
- singleton(const String *class_name, VTable *parent);
+ singleton(String *class_name, VTable *parent);
/** Register a vtable, so that it can be retrieved by class name.
*
@@ -78,18 +78,18 @@ class Clownfish::VTable inherits Clownfish::Obj {
* class is not registered.
*/
inert nullable VTable*
- fetch_vtable(const String *class_name);
+ fetch_vtable(String *class_name);
/** Given a class name, return the name of a parent class which descends
* from Clownfish::Obj, or NULL if such a class can't be found.
*/
inert nullable String*
- find_parent_class(const String *class_name);
+ find_parent_class(String *class_name);
/** List all of the methods defined directly within a host subclass.
*/
inert incremented VArray*
- fresh_host_methods(const String *class_name);
+ fresh_host_methods(String *class_name);
/** Replace a function pointer in the VTable.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/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 494febe..d61718d 100644
--- a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -248,7 +248,7 @@ MODULE = Clownfish PACKAGE = Clownfish::Hash
SV*
_fetch(self, key)
cfish_Hash *self;
- const cfish_String *key;
+ cfish_String *key;
CODE:
RETVAL = CFISH_OBJ_TO_SV(CFISH_Hash_Fetch_IMP(self, (cfish_Obj*)key));
OUTPUT: RETVAL
@@ -256,7 +256,7 @@ OUTPUT: RETVAL
void
store(self, key, value);
cfish_Hash *self;
- const cfish_String *key;
+ cfish_String *key;
cfish_Obj *value;
PPCODE:
{
@@ -454,7 +454,7 @@ MODULE = Clownfish PACKAGE = Clownfish::Obj
bool
is_a(self, class_name)
cfish_Obj *self;
- const cfish_String *class_name;
+ cfish_String *class_name;
CODE:
{
cfish_VTable *target = cfish_VTable_fetch_vtable(class_name);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index d3a8e84..47d5e90 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -225,7 +225,7 @@ XSBind_bb_to_sv(const cfish_ByteBuf *bb) {
}
SV*
-XSBind_str_to_sv(const cfish_String *str) {
+XSBind_str_to_sv(cfish_String *str) {
if (!str) {
return newSV(0);
}
@@ -715,7 +715,7 @@ cfish_VTable_register_with_host(cfish_VTable *singleton, cfish_VTable *parent) {
}
cfish_VArray*
-cfish_VTable_fresh_host_methods(const cfish_String *class_name) {
+cfish_VTable_fresh_host_methods(cfish_String *class_name) {
dSP;
ENTER;
SAVETMPS;
@@ -733,7 +733,7 @@ cfish_VTable_fresh_host_methods(const cfish_String *class_name) {
}
cfish_String*
-cfish_VTable_find_parent_class(const cfish_String *class_name) {
+cfish_VTable_find_parent_class(cfish_String *class_name) {
dSP;
ENTER;
SAVETMPS;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/perl/xs/XSBind.h
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.h b/clownfish/runtime/perl/xs/XSBind.h
index 851422b..01c6d6c 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_str_to_sv(const cfish_String *str);
+cfish_XSBind_str_to_sv(cfish_String *str);
/** Perl-specific wrapper for Err#trap. The "routine" must be either a
* subroutine reference or the name of a subroutine.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/ruby/ext/Bind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/ruby/ext/Bind.c b/clownfish/runtime/ruby/ext/Bind.c
index 9fa2fbd..e44737b 100644
--- a/clownfish/runtime/ruby/ext/Bind.c
+++ b/clownfish/runtime/ruby/ext/Bind.c
@@ -30,7 +30,7 @@ Bind_cfish_to_ruby(cfish_Obj *obj) {
}
VALUE
-Bind_str_to_ruby(const cfish_String *str) {
+Bind_str_to_ruby(cfish_String *str) {
if (!str) {
return rb_str_new2("");
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/clownfish/runtime/ruby/ext/Bind.h
----------------------------------------------------------------------
diff --git a/clownfish/runtime/ruby/ext/Bind.h b/clownfish/runtime/ruby/ext/Bind.h
index cf6a2b1..805afae 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_str_to_ruby(const cfish_String *str);
+VALUE Bind_str_to_ruby(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/f079ab91/core/Lucy/Analysis/EasyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/EasyAnalyzer.c b/core/Lucy/Analysis/EasyAnalyzer.c
index 136dca9..27413ed 100644
--- a/core/Lucy/Analysis/EasyAnalyzer.c
+++ b/core/Lucy/Analysis/EasyAnalyzer.c
@@ -24,13 +24,13 @@
#include "Lucy/Analysis/SnowballStemmer.h"
EasyAnalyzer*
-EasyAnalyzer_new(const String *language) {
+EasyAnalyzer_new(String *language) {
EasyAnalyzer *self = (EasyAnalyzer*)VTable_Make_Obj(EASYANALYZER);
return EasyAnalyzer_init(self, language);
}
EasyAnalyzer*
-EasyAnalyzer_init(EasyAnalyzer *self, const String *language) {
+EasyAnalyzer_init(EasyAnalyzer *self, String *language) {
Analyzer_init((Analyzer*)self);
EasyAnalyzerIVARS *const ivars = EasyAnalyzer_IVARS(self);
ivars->language = Str_Clone(language);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/EasyAnalyzer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/EasyAnalyzer.cfh b/core/Lucy/Analysis/EasyAnalyzer.cfh
index e56db82..905f914 100644
--- a/core/Lucy/Analysis/EasyAnalyzer.cfh
+++ b/core/Lucy/Analysis/EasyAnalyzer.cfh
@@ -49,13 +49,13 @@ public class Lucy::Analysis::EasyAnalyzer inherits Lucy::Analysis::Analyzer {
SnowballStemmer *stemmer;
inert incremented EasyAnalyzer*
- new(const String *language = NULL);
+ new(String *language = NULL);
/**
* @param language An ISO code from the list of supported languages.
*/
public inert EasyAnalyzer*
- init(EasyAnalyzer *self, const String *language = NULL);
+ init(EasyAnalyzer *self, String *language = NULL);
public incremented Inversion*
Transform(EasyAnalyzer *self, Inversion *inversion);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/Normalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Normalizer.c b/core/Lucy/Analysis/Normalizer.c
index c022f5f..945bfad 100644
--- a/core/Lucy/Analysis/Normalizer.c
+++ b/core/Lucy/Analysis/Normalizer.c
@@ -28,13 +28,13 @@
#define INITIAL_BUFSIZE 63
Normalizer*
-Normalizer_new(const String *form, bool case_fold, bool strip_accents) {
+Normalizer_new(String *form, bool case_fold, bool strip_accents) {
Normalizer *self = (Normalizer*)VTable_Make_Obj(NORMALIZER);
return Normalizer_init(self, form, case_fold, strip_accents);
}
Normalizer*
-Normalizer_init(Normalizer *self, const String *form, bool case_fold,
+Normalizer_init(Normalizer *self, String *form, bool case_fold,
bool strip_accents) {
int options = UTF8PROC_STABLE;
NormalizerIVARS *const ivars = Normalizer_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/Normalizer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Normalizer.cfh b/core/Lucy/Analysis/Normalizer.cfh
index 4787e14..f46ee63 100644
--- a/core/Lucy/Analysis/Normalizer.cfh
+++ b/core/Lucy/Analysis/Normalizer.cfh
@@ -32,7 +32,7 @@ public class Lucy::Analysis::Normalizer inherits Lucy::Analysis::Analyzer {
int options;
inert incremented Normalizer*
- new(const String *normalization_form = NULL, bool case_fold = true,
+ new(String *normalization_form = NULL, bool case_fold = true,
bool strip_accents = false);
/**
@@ -42,7 +42,7 @@ public class Lucy::Analysis::Normalizer inherits Lucy::Analysis::Analyzer {
* @param strip_accents Strip accents, default is false.
*/
public inert Normalizer*
- init(Normalizer *self, const String *normalization_form = NULL,
+ init(Normalizer *self, String *normalization_form = NULL,
bool case_fold = true, bool strip_accents = false);
public incremented Inversion*
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/PolyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/PolyAnalyzer.c b/core/Lucy/Analysis/PolyAnalyzer.c
index 92dd9bf..cdb1bff 100644
--- a/core/Lucy/Analysis/PolyAnalyzer.c
+++ b/core/Lucy/Analysis/PolyAnalyzer.c
@@ -26,13 +26,13 @@
#include "Lucy/Util/Freezer.h"
PolyAnalyzer*
-PolyAnalyzer_new(const String *language, VArray *analyzers) {
+PolyAnalyzer_new(String *language, VArray *analyzers) {
PolyAnalyzer *self = (PolyAnalyzer*)VTable_Make_Obj(POLYANALYZER);
return PolyAnalyzer_init(self, language, analyzers);
}
PolyAnalyzer*
-PolyAnalyzer_init(PolyAnalyzer *self, const String *language,
+PolyAnalyzer_init(PolyAnalyzer *self, String *language,
VArray *analyzers) {
Analyzer_init((Analyzer*)self);
PolyAnalyzerIVARS *const ivars = PolyAnalyzer_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/PolyAnalyzer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/PolyAnalyzer.cfh b/core/Lucy/Analysis/PolyAnalyzer.cfh
index 88fd693..5108259 100644
--- a/core/Lucy/Analysis/PolyAnalyzer.cfh
+++ b/core/Lucy/Analysis/PolyAnalyzer.cfh
@@ -52,7 +52,7 @@ public class Lucy::Analysis::PolyAnalyzer inherits Lucy::Analysis::Analyzer {
VArray *analyzers;
inert incremented PolyAnalyzer*
- new(const String *language = NULL, VArray *analyzers = NULL);
+ new(String *language = NULL, VArray *analyzers = NULL);
/**
* @param language An ISO code from the list of supported languages.
@@ -65,7 +65,7 @@ public class Lucy::Analysis::PolyAnalyzer inherits Lucy::Analysis::Analyzer {
* stopalize, stem.
*/
public inert PolyAnalyzer*
- init(PolyAnalyzer *self, const String *language = NULL,
+ init(PolyAnalyzer *self, String *language = NULL,
VArray *analyzers = NULL);
/** Getter for "analyzers" member.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/RegexTokenizer.c b/core/Lucy/Analysis/RegexTokenizer.c
index 07215a5..2859c9f 100644
--- a/core/Lucy/Analysis/RegexTokenizer.c
+++ b/core/Lucy/Analysis/RegexTokenizer.c
@@ -23,7 +23,7 @@
#include "Lucy/Analysis/Inversion.h"
RegexTokenizer*
-RegexTokenizer_new(const String *pattern) {
+RegexTokenizer_new(String *pattern) {
RegexTokenizer *self = (RegexTokenizer*)VTable_Make_Obj(REGEXTOKENIZER);
return RegexTokenizer_init(self, pattern);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/RegexTokenizer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/RegexTokenizer.cfh b/core/Lucy/Analysis/RegexTokenizer.cfh
index a4bde3c..66590a4 100644
--- a/core/Lucy/Analysis/RegexTokenizer.cfh
+++ b/core/Lucy/Analysis/RegexTokenizer.cfh
@@ -60,7 +60,7 @@ public class Lucy::Analysis::RegexTokenizer
is_available();
inert incremented RegexTokenizer*
- new(const String *pattern = NULL);
+ new(String *pattern = NULL);
/**
* @param pattern A string specifying a Perl-syntax regular expression
@@ -69,7 +69,7 @@ public class Lucy::Analysis::RegexTokenizer
* "it" and "O'Henry's" as well as "Henry".
*/
public inert RegexTokenizer*
- init(RegexTokenizer *self, const String *pattern = NULL);
+ init(RegexTokenizer *self, String *pattern = NULL);
public incremented Inversion*
Transform(RegexTokenizer *self, Inversion *inversion);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/SnowballStemmer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStemmer.c b/core/Lucy/Analysis/SnowballStemmer.c
index 955d2fc..2266515 100644
--- a/core/Lucy/Analysis/SnowballStemmer.c
+++ b/core/Lucy/Analysis/SnowballStemmer.c
@@ -26,13 +26,13 @@
#include "libstemmer.h"
SnowballStemmer*
-SnowStemmer_new(const String *language) {
+SnowStemmer_new(String *language) {
SnowballStemmer *self = (SnowballStemmer*)VTable_Make_Obj(SNOWBALLSTEMMER);
return SnowStemmer_init(self, language);
}
SnowballStemmer*
-SnowStemmer_init(SnowballStemmer *self, const String *language) {
+SnowStemmer_init(SnowballStemmer *self, String *language) {
char lang_buf[3];
Analyzer_init((Analyzer*)self);
SnowballStemmerIVARS *const ivars = SnowStemmer_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/SnowballStemmer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStemmer.cfh b/core/Lucy/Analysis/SnowballStemmer.cfh
index d622c83..83912da 100644
--- a/core/Lucy/Analysis/SnowballStemmer.cfh
+++ b/core/Lucy/Analysis/SnowballStemmer.cfh
@@ -32,14 +32,14 @@ public class Lucy::Analysis::SnowballStemmer cnick SnowStemmer
String *language;
inert incremented SnowballStemmer*
- new(const String *language);
+ new(String *language);
/**
* @param language A two-letter ISO code identifying a language supported
* by Snowball.
*/
public inert SnowballStemmer*
- init(SnowballStemmer *self, const String *language);
+ init(SnowballStemmer *self, String *language);
public incremented Inversion*
Transform(SnowballStemmer *self, Inversion *inversion);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/SnowballStopFilter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.c b/core/Lucy/Analysis/SnowballStopFilter.c
index f4c995e..efae12d 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.c
+++ b/core/Lucy/Analysis/SnowballStopFilter.c
@@ -25,13 +25,13 @@
#include "Lucy/Util/Freezer.h"
SnowballStopFilter*
-SnowStop_new(const String *language, Hash *stoplist) {
+SnowStop_new(String *language, Hash *stoplist) {
SnowballStopFilter *self = (SnowballStopFilter*)VTable_Make_Obj(SNOWBALLSTOPFILTER);
return SnowStop_init(self, language, stoplist);
}
SnowballStopFilter*
-SnowStop_init(SnowballStopFilter *self, const String *language,
+SnowStop_init(SnowballStopFilter *self, String *language,
Hash *stoplist) {
Analyzer_init((Analyzer*)self);
SnowballStopFilterIVARS *const ivars = SnowStop_IVARS(self);
@@ -118,7 +118,7 @@ SnowStop_Load_IMP(SnowballStopFilter *self, Obj *dump) {
}
Hash*
-SnowStop_gen_stoplist(const String *language) {
+SnowStop_gen_stoplist(String *language) {
char lang[2];
lang[0] = tolower(Str_Code_Point_At(language, 0));
lang[1] = tolower(Str_Code_Point_At(language, 1));
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Analysis/SnowballStopFilter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.cfh b/core/Lucy/Analysis/SnowballStopFilter.cfh
index df008aa..cf573bd 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.cfh
+++ b/core/Lucy/Analysis/SnowballStopFilter.cfh
@@ -74,20 +74,20 @@ public class Lucy::Analysis::SnowballStopFilter cnick SnowStop
inert const uint8_t** snow_sv;
inert incremented SnowballStopFilter*
- new(const String *language = NULL, Hash *stoplist = NULL);
+ new(String *language = NULL, Hash *stoplist = NULL);
/**
* @param stoplist A hash with stopwords as the keys.
* @param language The ISO code for a supported language.
*/
public inert SnowballStopFilter*
- init(SnowballStopFilter *self, const String *language = NULL,
+ init(SnowballStopFilter *self, String *language = NULL,
Hash *stoplist = NULL);
/** Return a Hash with the Snowball stoplist for the supplied language.
*/
inert incremented Hash*
- gen_stoplist(const String *language);
+ gen_stoplist(String *language);
public incremented Inversion*
Transform(SnowballStopFilter *self, Inversion *inversion);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Document/Doc.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Document/Doc.cfh b/core/Lucy/Document/Doc.cfh
index 973f249..003b2c3 100644
--- a/core/Lucy/Document/Doc.cfh
+++ b/core/Lucy/Document/Doc.cfh
@@ -51,7 +51,7 @@ public class Lucy::Document::Doc inherits Clownfish::Obj {
/** Store a field value in the Doc.
*/
void
- Store(Doc *self, const String *field, Obj *value);
+ Store(Doc *self, String *field, Obj *value);
/** Set the doc's field's attribute.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index c384b46..2353b11 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -45,7 +45,7 @@ static String*
S_encode_entities(String *text, CharBuf *encoded);
Highlighter*
-Highlighter_new(Searcher *searcher, Obj *query, const String *field,
+Highlighter_new(Searcher *searcher, Obj *query, String *field,
uint32_t excerpt_length) {
Highlighter *self = (Highlighter*)VTable_Make_Obj(HIGHLIGHTER);
return Highlighter_init(self, searcher, query, field, excerpt_length);
@@ -53,7 +53,7 @@ Highlighter_new(Searcher *searcher, Obj *query, const String *field,
Highlighter*
Highlighter_init(Highlighter *self, Searcher *searcher, Obj *query,
- const String *field, uint32_t excerpt_length) {
+ String *field, uint32_t excerpt_length) {
HighlighterIVARS *const ivars = Highlighter_IVARS(self);
ivars->query = Searcher_Glean_Query(searcher, query);
ivars->searcher = (Searcher*)INCREF(searcher);
@@ -86,7 +86,7 @@ Highlighter_Destroy_IMP(Highlighter *self) {
}
String*
-Highlighter_Highlight_IMP(Highlighter *self, const String *text) {
+Highlighter_Highlight_IMP(Highlighter *self, String *text) {
HighlighterIVARS *const ivars = Highlighter_IVARS(self);
size_t size = Str_Get_Size(text)
+ Str_Get_Size(ivars->pre_tag)
@@ -101,14 +101,14 @@ Highlighter_Highlight_IMP(Highlighter *self, const String *text) {
}
void
-Highlighter_Set_Pre_Tag_IMP(Highlighter *self, const String *pre_tag) {
+Highlighter_Set_Pre_Tag_IMP(Highlighter *self, String *pre_tag) {
HighlighterIVARS *const ivars = Highlighter_IVARS(self);
DECREF(ivars->pre_tag);
ivars->pre_tag = Str_Clone(pre_tag);
}
void
-Highlighter_Set_Post_Tag_IMP(Highlighter *self, const String *post_tag) {
+Highlighter_Set_Post_Tag_IMP(Highlighter *self, String *post_tag) {
HighlighterIVARS *const ivars = Highlighter_IVARS(self);
DECREF(ivars->post_tag);
ivars->post_tag = Str_Clone(post_tag);
@@ -370,7 +370,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip,
}
String*
-Highlighter_Raw_Excerpt_IMP(Highlighter *self, const String *field_val,
+Highlighter_Raw_Excerpt_IMP(Highlighter *self, String *field_val,
int32_t *start_ptr, HeatMap *heat_map) {
HighlighterIVARS *const ivars = Highlighter_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Highlight/Highlighter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.cfh b/core/Lucy/Highlight/Highlighter.cfh
index afc9a8e..432d8dc 100644
--- a/core/Lucy/Highlight/Highlighter.cfh
+++ b/core/Lucy/Highlight/Highlighter.cfh
@@ -35,7 +35,7 @@ public class Lucy::Highlight::Highlighter inherits Clownfish::Obj {
Compiler *compiler;
inert incremented Highlighter*
- new(Searcher *searcher, Obj *query, const String *field,
+ new(Searcher *searcher, Obj *query, String *field,
uint32_t excerpt_length = 200);
/**
@@ -50,7 +50,7 @@ public class Lucy::Highlight::Highlighter inherits Clownfish::Obj {
*/
public inert Highlighter*
init(Highlighter *self, Searcher *searcher, Obj *query,
- const String *field, uint32_t excerpt_length = 200);
+ String *field, uint32_t excerpt_length = 200);
/** Take a HitDoc object and return a highlighted excerpt as a string if
* the HitDoc has a value for the specified <code>field</code>.
@@ -71,17 +71,17 @@ public class Lucy::Highlight::Highlighter inherits Clownfish::Obj {
* when assembling an excerpt.
*/
public incremented String*
- Highlight(Highlighter *self, const String *text);
+ Highlight(Highlighter *self, String *text);
/** Setter. The default value is "<strong>".
*/
public void
- Set_Pre_Tag(Highlighter *self, const String *pre_tag);
+ Set_Pre_Tag(Highlighter *self, String *pre_tag);
/** Setter. The default value is "</strong>".
*/
public void
- Set_Post_Tag(Highlighter *self, const String *post_tag);
+ Set_Post_Tag(Highlighter *self, String *post_tag);
/** Accessor.
*/
@@ -127,7 +127,7 @@ public class Lucy::Highlight::Highlighter inherits Clownfish::Obj {
* (Helper function for Create_Excerpt only exposed for testing purposes.)
*/
String*
- Raw_Excerpt(Highlighter *self, const String *field_value, int32_t *top,
+ Raw_Excerpt(Highlighter *self, String *field_value, int32_t *top,
HeatMap *heat_map);
/** Take the text in raw_excerpt, add highlight tags, encode, and place
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/BitVecDelDocs.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/BitVecDelDocs.c b/core/Lucy/Index/BitVecDelDocs.c
index 45d414f..80b1343 100644
--- a/core/Lucy/Index/BitVecDelDocs.c
+++ b/core/Lucy/Index/BitVecDelDocs.c
@@ -22,14 +22,14 @@
#include "Lucy/Store/InStream.h"
BitVecDelDocs*
-BitVecDelDocs_new(Folder *folder, const String *filename) {
+BitVecDelDocs_new(Folder *folder, String *filename) {
BitVecDelDocs *self = (BitVecDelDocs*)VTable_Make_Obj(BITVECDELDOCS);
return BitVecDelDocs_init(self, folder, filename);
}
BitVecDelDocs*
BitVecDelDocs_init(BitVecDelDocs *self, Folder *folder,
- const String *filename) {
+ String *filename) {
BitVec_init((BitVector*)self, 0);
BitVecDelDocsIVARS *const ivars = BitVecDelDocs_IVARS(self);
ivars->filename = Str_Clone(filename);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/BitVecDelDocs.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/BitVecDelDocs.cfh b/core/Lucy/Index/BitVecDelDocs.cfh
index eb33b7a..0988ee0 100644
--- a/core/Lucy/Index/BitVecDelDocs.cfh
+++ b/core/Lucy/Index/BitVecDelDocs.cfh
@@ -22,10 +22,10 @@ class Lucy::Index::BitVecDelDocs inherits Lucy::Object::BitVector {
String *filename;
inert incremented BitVecDelDocs*
- new(Folder *folder, const String *filename);
+ new(Folder *folder, String *filename);
inert BitVecDelDocs*
- init(BitVecDelDocs *self, Folder *folder, const String *filename);
+ init(BitVecDelDocs *self, Folder *folder, String *filename);
public void
Destroy(BitVecDelDocs *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/DeletionsWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DeletionsWriter.c b/core/Lucy/Index/DeletionsWriter.c
index 829a04c..5d9ee5b 100644
--- a/core/Lucy/Index/DeletionsWriter.c
+++ b/core/Lucy/Index/DeletionsWriter.c
@@ -237,7 +237,7 @@ DefDelWriter_Seg_Deletions_IMP(DefaultDeletionsWriter *self,
int32_t
DefDelWriter_Seg_Del_Count_IMP(DefaultDeletionsWriter *self,
- const String *seg_name) {
+ String *seg_name) {
DefaultDeletionsWriterIVARS *const ivars = DefDelWriter_IVARS(self);
Integer32 *tick
= (Integer32*)Hash_Fetch(ivars->name_to_tick, (Obj*)seg_name);
@@ -249,7 +249,7 @@ DefDelWriter_Seg_Del_Count_IMP(DefaultDeletionsWriter *self,
void
DefDelWriter_Delete_By_Term_IMP(DefaultDeletionsWriter *self,
- const String *field, Obj *term) {
+ String *field, Obj *term) {
DefaultDeletionsWriterIVARS *const ivars = DefDelWriter_IVARS(self);
for (uint32_t i = 0, max = VA_Get_Size(ivars->seg_readers); i < max; i++) {
SegReader *seg_reader = (SegReader*)VA_Fetch(ivars->seg_readers, i);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/DeletionsWriter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DeletionsWriter.cfh b/core/Lucy/Index/DeletionsWriter.cfh
index 1e60822..755465c 100644
--- a/core/Lucy/Index/DeletionsWriter.cfh
+++ b/core/Lucy/Index/DeletionsWriter.cfh
@@ -47,7 +47,7 @@ public abstract class Lucy::Index::DeletionsWriter cnick DelWriter
* will be processed automatically (so don't pre-process it yourself).
*/
public abstract void
- Delete_By_Term(DeletionsWriter *self, const String *field, Obj *term);
+ Delete_By_Term(DeletionsWriter *self, String *field, Obj *term);
/** Delete all documents in the index that match <code>query</code>.
*
@@ -92,7 +92,7 @@ public abstract class Lucy::Index::DeletionsWriter cnick DelWriter
* @param seg_name The name of the segment.
*/
public abstract int32_t
- Seg_Del_Count(DeletionsWriter *self, const String *seg_name);
+ Seg_Del_Count(DeletionsWriter *self, String *seg_name);
}
/** Implements DeletionsWriter using BitVector files.
@@ -124,7 +124,7 @@ class Lucy::Index::DefaultDeletionsWriter cnick DefDelWriter
Segment *segment, PolyReader *polyreader);
public void
- Delete_By_Term(DefaultDeletionsWriter *self, const String *field,
+ Delete_By_Term(DefaultDeletionsWriter *self, String *field,
Obj *term);
public void
@@ -140,7 +140,7 @@ class Lucy::Index::DefaultDeletionsWriter cnick DefDelWriter
Seg_Deletions(DefaultDeletionsWriter *self, SegReader *seg_reader);
public int32_t
- Seg_Del_Count(DefaultDeletionsWriter *self, const String *seg_name);
+ Seg_Del_Count(DefaultDeletionsWriter *self, String *seg_name);
public void
Add_Segment(DefaultDeletionsWriter *self, SegReader *reader,
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/DocVector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DocVector.c b/core/Lucy/Index/DocVector.c
index 585c955..6529a3e 100644
--- a/core/Lucy/Index/DocVector.c
+++ b/core/Lucy/Index/DocVector.c
@@ -32,7 +32,7 @@ S_extract_tv_cache(ByteBuf *field_buf);
// Pull a TermVector object out from compressed positional data.
static TermVector*
-S_extract_tv_from_tv_buf(const String *field, const String *term_text,
+S_extract_tv_from_tv_buf(String *field, String *term_text,
ByteBuf *tv_buf);
DocVector*
@@ -73,14 +73,14 @@ DocVec_Destroy_IMP(DocVector *self) {
}
void
-DocVec_Add_Field_Buf_IMP(DocVector *self, const String *field,
+DocVec_Add_Field_Buf_IMP(DocVector *self, String *field,
ByteBuf *field_buf) {
DocVectorIVARS *const ivars = DocVec_IVARS(self);
Hash_Store(ivars->field_bufs, (Obj*)field, INCREF(field_buf));
}
ByteBuf*
-DocVec_Field_Buf_IMP(DocVector *self, const String *field) {
+DocVec_Field_Buf_IMP(DocVector *self, String *field) {
DocVectorIVARS *const ivars = DocVec_IVARS(self);
return (ByteBuf*)Hash_Fetch(ivars->field_bufs, (Obj*)field);
}
@@ -92,8 +92,8 @@ DocVec_Field_Names_IMP(DocVector *self) {
}
TermVector*
-DocVec_Term_Vector_IMP(DocVector *self, const String *field,
- const String *term_text) {
+DocVec_Term_Vector_IMP(DocVector *self, String *field,
+ String *term_text) {
DocVectorIVARS *const ivars = DocVec_IVARS(self);
Hash *field_vector = (Hash*)Hash_Fetch(ivars->field_vectors, (Obj*)field);
@@ -158,7 +158,7 @@ S_extract_tv_cache(ByteBuf *field_buf) {
}
static TermVector*
-S_extract_tv_from_tv_buf(const String *field, const String *term_text,
+S_extract_tv_from_tv_buf(String *field, String *term_text,
ByteBuf *tv_buf) {
TermVector *retval = NULL;
char *posdata = BB_Get_Buf(tv_buf);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/DocVector.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DocVector.cfh b/core/Lucy/Index/DocVector.cfh
index 6217eec..8ff0e83 100644
--- a/core/Lucy/Index/DocVector.cfh
+++ b/core/Lucy/Index/DocVector.cfh
@@ -34,18 +34,18 @@ class Lucy::Index::DocVector cnick DocVec
init(DocVector *self);
incremented TermVector*
- Term_Vector(DocVector *self, const String *field, const String *term);
+ Term_Vector(DocVector *self, String *field, String *term);
/** Add a compressed, encoded TermVector to the object.
*/
void
- Add_Field_Buf(DocVector *self, const String *field, ByteBuf *field_buf);
+ Add_Field_Buf(DocVector *self, String *field, ByteBuf *field_buf);
/** Return the compressed, encoded TermVector associated with a particular
* field.
*/
ByteBuf*
- Field_Buf(DocVector *self, const String *field);
+ Field_Buf(DocVector *self, String *field);
public void
Serialize(DocVector *self, OutStream *outstream);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/IndexManager.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/IndexManager.c b/core/Lucy/Index/IndexManager.c
index 3a6442e..40f922a 100644
--- a/core/Lucy/Index/IndexManager.c
+++ b/core/Lucy/Index/IndexManager.c
@@ -32,13 +32,13 @@
#include "Clownfish/Util/StringHelper.h"
IndexManager*
-IxManager_new(const String *host, LockFactory *lock_factory) {
+IxManager_new(String *host, LockFactory *lock_factory) {
IndexManager *self = (IndexManager*)VTable_Make_Obj(INDEXMANAGER);
return IxManager_init(self, host, lock_factory);
}
IndexManager*
-IxManager_init(IndexManager *self, const String *host,
+IxManager_init(IndexManager *self, String *host,
LockFactory *lock_factory) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
ivars->host = host
@@ -303,7 +303,7 @@ IxManager_Remove_Merge_Data_IMP(IndexManager *self) {
Lock*
IxManager_Make_Snapshot_Read_Lock_IMP(IndexManager *self,
- const String *filename) {
+ String *filename) {
LockFactory *lock_factory = S_obtain_lock_factory(self);
if (!Str_Starts_With_Utf8(filename, "snapshot_", 9)
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/IndexManager.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/IndexManager.cfh b/core/Lucy/Index/IndexManager.cfh
index 79308e0..7dc5e8b 100644
--- a/core/Lucy/Index/IndexManager.cfh
+++ b/core/Lucy/Index/IndexManager.cfh
@@ -40,14 +40,14 @@ public class Lucy::Index::IndexManager cnick IxManager
uint32_t deletion_lock_interval;
public inert incremented IndexManager*
- new(const String *host = NULL, LockFactory *lock_factory = NULL);
+ new(String *host = NULL, LockFactory *lock_factory = NULL);
/**
* @param host An identifier which should be unique per-machine.
* @param lock_factory A LockFactory.
*/
public inert IndexManager*
- init(IndexManager *self, const String *host = NULL,
+ init(IndexManager *self, String *host = NULL,
LockFactory *lock_factory = NULL);
public void
@@ -131,7 +131,7 @@ public class Lucy::Index::IndexManager cnick IxManager
* all the files it lists and indicates that they must not be deleted.
*/
public incremented Lock*
- Make_Snapshot_Read_Lock(IndexManager *self, const String *filename);
+ Make_Snapshot_Read_Lock(IndexManager *self, String *filename);
/** Return the highest number for a segment directory which contains a
* segmeta file in the snapshot.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/IndexReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/IndexReader.c b/core/Lucy/Index/IndexReader.c
index dd27114..e8d8c65 100644
--- a/core/Lucy/Index/IndexReader.c
+++ b/core/Lucy/Index/IndexReader.c
@@ -108,7 +108,7 @@ IxReader_Get_Components_IMP(IndexReader *self) {
}
DataReader*
-IxReader_Obtain_IMP(IndexReader *self, const String *api) {
+IxReader_Obtain_IMP(IndexReader *self, String *api) {
IndexReaderIVARS *const ivars = IxReader_IVARS(self);
DataReader *component
= (DataReader*)Hash_Fetch(ivars->components, (Obj*)api);
@@ -119,7 +119,7 @@ IxReader_Obtain_IMP(IndexReader *self, const String *api) {
}
DataReader*
-IxReader_Fetch_IMP(IndexReader *self, const String *api) {
+IxReader_Fetch_IMP(IndexReader *self, String *api) {
IndexReaderIVARS *const ivars = IxReader_IVARS(self);
return (DataReader*)Hash_Fetch(ivars->components, (Obj*)api);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/IndexReader.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/IndexReader.cfh b/core/Lucy/Index/IndexReader.cfh
index d460afc..1b647e9 100644
--- a/core/Lucy/Index/IndexReader.cfh
+++ b/core/Lucy/Index/IndexReader.cfh
@@ -102,7 +102,7 @@ public class Lucy::Index::IndexReader cnick IxReader
* component must implement.
*/
public DataReader*
- Obtain(IndexReader *self, const String *api);
+ Obtain(IndexReader *self, String *api);
/** Fetch a component, or return NULL if the component can't be found.
*
@@ -110,7 +110,7 @@ public class Lucy::Index::IndexReader cnick IxReader
* component must implement.
*/
public nullable DataReader*
- Fetch(IndexReader *self, const String *api);
+ Fetch(IndexReader *self, String *api);
public void
Close(IndexReader *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Inverter.c b/core/Lucy/Index/Inverter.c
index d24e14f..6ab0a74 100644
--- a/core/Lucy/Index/Inverter.c
+++ b/core/Lucy/Index/Inverter.c
@@ -192,13 +192,13 @@ Inverter_Clear_IMP(Inverter *self) {
}
InverterEntry*
-InvEntry_new(Schema *schema, const String *field, int32_t field_num) {
+InvEntry_new(Schema *schema, String *field, int32_t field_num) {
InverterEntry *self = (InverterEntry*)VTable_Make_Obj(INVERTERENTRY);
return InvEntry_init(self, schema, field, field_num);
}
InverterEntry*
-InvEntry_init(InverterEntry *self, Schema *schema, const String *field,
+InvEntry_init(InverterEntry *self, Schema *schema, String *field,
int32_t field_num) {
InverterEntryIVARS *const ivars = InvEntry_IVARS(self);
ivars->field_num = field_num;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/Inverter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Inverter.cfh b/core/Lucy/Index/Inverter.cfh
index 6fcf8ff..9dab4e4 100644
--- a/core/Lucy/Index/Inverter.cfh
+++ b/core/Lucy/Index/Inverter.cfh
@@ -155,11 +155,11 @@ final class Lucy::Index::Inverter::InverterEntry cnick InvEntry
bool highlightable;
inert incremented InverterEntry*
- new(Schema *schema = NULL, const String *field_name, int32_t field_num);
+ new(Schema *schema = NULL, String *field_name, int32_t field_num);
inert InverterEntry*
init(InverterEntry *self = NULL, Schema *schema,
- const String *field_name, int32_t field_num);
+ String *field_name, int32_t field_num);
public int32_t
Compare_To(InverterEntry *self, Obj *other);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/LexIndex.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexIndex.c b/core/Lucy/Index/LexIndex.c
index f8a2a82..9b7905f 100644
--- a/core/Lucy/Index/LexIndex.c
+++ b/core/Lucy/Index/LexIndex.c
@@ -33,14 +33,14 @@ S_read_entry(LexIndex *self);
LexIndex*
LexIndex_new(Schema *schema, Folder *folder, Segment *segment,
- const String *field) {
+ String *field) {
LexIndex *self = (LexIndex*)VTable_Make_Obj(LEXINDEX);
return LexIndex_init(self, schema, folder, segment, field);
}
LexIndex*
LexIndex_init(LexIndex *self, Schema *schema, Folder *folder,
- Segment *segment, const String *field) {
+ Segment *segment, String *field) {
int32_t field_num = Seg_Field_Num(segment, field);
String *seg_name = Seg_Get_Name(segment);
String *ixix_file = Str_newf("%o/lexicon-%i32.ixix", seg_name, field_num);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/LexIndex.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexIndex.cfh b/core/Lucy/Index/LexIndex.cfh
index e28499d..3d197fe 100644
--- a/core/Lucy/Index/LexIndex.cfh
+++ b/core/Lucy/Index/LexIndex.cfh
@@ -31,11 +31,11 @@ class Lucy::Index::LexIndex inherits Lucy::Index::Lexicon {
inert incremented LexIndex*
new(Schema *schema, Folder *folder, Segment *segment,
- const String *field);
+ String *field);
inert LexIndex*
init(LexIndex *self, Schema *schema, Folder *folder, Segment *segment,
- const String *field);
+ String *field);
public void
Seek(LexIndex *self, Obj *target = NULL);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/Lexicon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Lexicon.c b/core/Lucy/Index/Lexicon.c
index 56c1bbf..0669bf8 100644
--- a/core/Lucy/Index/Lexicon.c
+++ b/core/Lucy/Index/Lexicon.c
@@ -20,7 +20,7 @@
#include "Lucy/Index/Lexicon.h"
Lexicon*
-Lex_init(Lexicon *self, const String *field) {
+Lex_init(Lexicon *self, String *field) {
LexiconIVARS *const ivars = Lex_IVARS(self);
ivars->field = Str_Clone(field);
ABSTRACT_CLASS_CHECK(self, LEXICON);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/Lexicon.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Lexicon.cfh b/core/Lucy/Index/Lexicon.cfh
index 68335d4..2372d71 100644
--- a/core/Lucy/Index/Lexicon.cfh
+++ b/core/Lucy/Index/Lexicon.cfh
@@ -36,7 +36,7 @@ public class Lucy::Index::Lexicon cnick Lex inherits Clownfish::Obj {
String *field;
public inert Lexicon*
- init(Lexicon *self, const String *field);
+ init(Lexicon *self, String *field);
public void
Destroy(Lexicon *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/LexiconReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexiconReader.c b/core/Lucy/Index/LexiconReader.c
index fa00da8..a732291 100644
--- a/core/Lucy/Index/LexiconReader.c
+++ b/core/Lucy/Index/LexiconReader.c
@@ -90,7 +90,7 @@ PolyLexReader_Destroy_IMP(PolyLexiconReader *self) {
}
Lexicon*
-PolyLexReader_Lexicon_IMP(PolyLexiconReader *self, const String *field,
+PolyLexReader_Lexicon_IMP(PolyLexiconReader *self, String *field,
Obj *term) {
PolyLexicon *lexicon = NULL;
@@ -112,7 +112,7 @@ PolyLexReader_Lexicon_IMP(PolyLexiconReader *self, const String *field,
}
uint32_t
-PolyLexReader_Doc_Freq_IMP(PolyLexiconReader *self, const String *field,
+PolyLexReader_Doc_Freq_IMP(PolyLexiconReader *self, String *field,
Obj *term) {
PolyLexiconReaderIVARS *const ivars = PolyLexReader_IVARS(self);
uint32_t doc_freq = 0;
@@ -194,7 +194,7 @@ DefLexReader_Destroy_IMP(DefaultLexiconReader *self) {
}
Lexicon*
-DefLexReader_Lexicon_IMP(DefaultLexiconReader *self, const String *field,
+DefLexReader_Lexicon_IMP(DefaultLexiconReader *self, String *field,
Obj *term) {
DefaultLexiconReaderIVARS *const ivars = DefLexReader_IVARS(self);
int32_t field_num = Seg_Field_Num(ivars->segment, field);
@@ -211,7 +211,7 @@ DefLexReader_Lexicon_IMP(DefaultLexiconReader *self, const String *field,
}
static TermInfo*
-S_find_tinfo(DefaultLexiconReader *self, const String *field, Obj *target) {
+S_find_tinfo(DefaultLexiconReader *self, String *field, Obj *target) {
DefaultLexiconReaderIVARS *const ivars = DefLexReader_IVARS(self);
if (field != NULL && target != NULL) {
int32_t field_num = Seg_Field_Num(ivars->segment, field);
@@ -234,13 +234,13 @@ S_find_tinfo(DefaultLexiconReader *self, const String *field, Obj *target) {
TermInfo*
DefLexReader_Fetch_Term_Info_IMP(DefaultLexiconReader *self,
- const String *field, Obj *target) {
+ String *field, Obj *target) {
TermInfo *tinfo = S_find_tinfo(self, field, target);
return tinfo ? TInfo_Clone(tinfo) : NULL;
}
uint32_t
-DefLexReader_Doc_Freq_IMP(DefaultLexiconReader *self, const String *field,
+DefLexReader_Doc_Freq_IMP(DefaultLexiconReader *self, String *field,
Obj *term) {
TermInfo *tinfo = S_find_tinfo(self, field, term);
return tinfo ? TInfo_Get_Doc_Freq(tinfo) : 0;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/LexiconReader.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexiconReader.cfh b/core/Lucy/Index/LexiconReader.cfh
index 471d62a..cc7e01a 100644
--- a/core/Lucy/Index/LexiconReader.cfh
+++ b/core/Lucy/Index/LexiconReader.cfh
@@ -36,17 +36,17 @@ public abstract class Lucy::Index::LexiconReader cnick LexReader
* @param term Pre-locate the Lexicon to this term.
*/
public abstract incremented nullable Lexicon*
- Lexicon(LexiconReader *self, const String *field, Obj *term = NULL);
+ Lexicon(LexiconReader *self, String *field, Obj *term = NULL);
/** Return the number of documents where the specified term is present.
*/
public abstract uint32_t
- Doc_Freq(LexiconReader *self, const String *field, Obj *term);
+ Doc_Freq(LexiconReader *self, String *field, Obj *term);
/** If the term can be found, return a term info, otherwise return NULL.
*/
abstract incremented nullable TermInfo*
- Fetch_Term_Info(LexiconReader *self, const String *field, Obj *term);
+ Fetch_Term_Info(LexiconReader *self, String *field, Obj *term);
/** Return a LexiconReader which merges the output of other
* LexiconReaders.
@@ -71,10 +71,10 @@ class Lucy::Index::PolyLexiconReader cnick PolyLexReader
init(PolyLexiconReader *self, VArray *readers, I32Array *offsets);
public incremented nullable Lexicon*
- Lexicon(PolyLexiconReader *self, const String *field, Obj *term = NULL);
+ Lexicon(PolyLexiconReader *self, String *field, Obj *term = NULL);
public uint32_t
- Doc_Freq(PolyLexiconReader *self, const String *field, Obj *term);
+ Doc_Freq(PolyLexiconReader *self, String *field, Obj *term);
public void
Close(PolyLexiconReader *self);
@@ -97,16 +97,16 @@ class Lucy::Index::DefaultLexiconReader cnick DefLexReader
Snapshot *snapshot, VArray *segments, int32_t seg_tick);
public incremented nullable Lexicon*
- Lexicon(DefaultLexiconReader *self, const String *field,
+ Lexicon(DefaultLexiconReader *self, String *field,
Obj *term = NULL);
/** Return the number of documents in which the term appears.
*/
public uint32_t
- Doc_Freq(DefaultLexiconReader *self, const String *field, Obj *term);
+ Doc_Freq(DefaultLexiconReader *self, String *field, Obj *term);
incremented nullable TermInfo*
- Fetch_Term_Info(DefaultLexiconReader *self, const String *field,
+ Fetch_Term_Info(DefaultLexiconReader *self, String *field,
Obj *term);
public void
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/LexiconWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexiconWriter.c b/core/Lucy/Index/LexiconWriter.c
index 4253e67..a0dc149 100644
--- a/core/Lucy/Index/LexiconWriter.c
+++ b/core/Lucy/Index/LexiconWriter.c
@@ -182,7 +182,7 @@ LexWriter_Finish_Field_IMP(LexiconWriter *self, int32_t field_num) {
}
void
-LexWriter_Enter_Temp_Mode_IMP(LexiconWriter *self, const String *field,
+LexWriter_Enter_Temp_Mode_IMP(LexiconWriter *self, String *field,
OutStream *temp_outstream) {
LexiconWriterIVARS *const ivars = LexWriter_IVARS(self);
Schema *schema = LexWriter_Get_Schema(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/LexiconWriter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexiconWriter.cfh b/core/Lucy/Index/LexiconWriter.cfh
index 867120c..b015a6d 100644
--- a/core/Lucy/Index/LexiconWriter.cfh
+++ b/core/Lucy/Index/LexiconWriter.cfh
@@ -60,7 +60,7 @@ class Lucy::Index::LexiconWriter cnick LexWriter
/** Prepare to write terms to a temporary file.
*/
void
- Enter_Temp_Mode(LexiconWriter *self, const String *field,
+ Enter_Temp_Mode(LexiconWriter *self, String *field,
OutStream *temp_outstream);
/** Stop writing terms to temp file. Abandon (but don't close) the file.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/PolyLexicon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyLexicon.c b/core/Lucy/Index/PolyLexicon.c
index 2315839..cf57189 100644
--- a/core/Lucy/Index/PolyLexicon.c
+++ b/core/Lucy/Index/PolyLexicon.c
@@ -29,13 +29,13 @@ static void
S_refresh_lex_q(SegLexQueue *lex_q, VArray *seg_lexicons, Obj *target);
PolyLexicon*
-PolyLex_new(const String *field, VArray *sub_readers) {
+PolyLex_new(String *field, VArray *sub_readers) {
PolyLexicon *self = (PolyLexicon*)VTable_Make_Obj(POLYLEXICON);
return PolyLex_init(self, field, sub_readers);
}
PolyLexicon*
-PolyLex_init(PolyLexicon *self, const String *field, VArray *sub_readers) {
+PolyLex_init(PolyLexicon *self, String *field, VArray *sub_readers) {
uint32_t num_sub_readers = VA_Get_Size(sub_readers);
VArray *seg_lexicons = VA_new(num_sub_readers);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/PolyLexicon.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyLexicon.cfh b/core/Lucy/Index/PolyLexicon.cfh
index 87eca4e..11b6d17 100644
--- a/core/Lucy/Index/PolyLexicon.cfh
+++ b/core/Lucy/Index/PolyLexicon.cfh
@@ -30,10 +30,10 @@ class Lucy::Index::PolyLexicon cnick PolyLex
int32_t size;
inert incremented PolyLexicon*
- new(const String *field, VArray *sub_readers);
+ new(String *field, VArray *sub_readers);
inert PolyLexicon*
- init(PolyLexicon *self, const String *field, VArray *sub_readers);
+ init(PolyLexicon *self, String *field, VArray *sub_readers);
public void
Seek(PolyLexicon *self, Obj *target = NULL);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/PolyReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyReader.c b/core/Lucy/Index/PolyReader.c
index 267a3e9..c9c4890 100644
--- a/core/Lucy/Index/PolyReader.c
+++ b/core/Lucy/Index/PolyReader.c
@@ -36,7 +36,7 @@
// Obtain/release read locks and commit locks.
static bool
-S_obtain_read_lock(PolyReader *self, const String *snapshot_filename);
+S_obtain_read_lock(PolyReader *self, String *snapshot_filename);
static bool
S_obtain_deletion_lock(PolyReader *self);
static void
@@ -478,7 +478,7 @@ S_obtain_deletion_lock(PolyReader *self) {
}
static bool
-S_obtain_read_lock(PolyReader *self, const String *snapshot_file_name) {
+S_obtain_read_lock(PolyReader *self, String *snapshot_file_name) {
PolyReaderIVARS *const ivars = PolyReader_IVARS(self);
ivars->read_lock = IxManager_Make_Snapshot_Read_Lock(ivars->manager,
snapshot_file_name);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/PostingListReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingListReader.c b/core/Lucy/Index/PostingListReader.c
index f643917..4ad2501 100644
--- a/core/Lucy/Index/PostingListReader.c
+++ b/core/Lucy/Index/PostingListReader.c
@@ -109,7 +109,7 @@ DefPListReader_Destroy_IMP(DefaultPostingListReader *self) {
SegPostingList*
DefPListReader_Posting_List_IMP(DefaultPostingListReader *self,
- const String *field, Obj *target) {
+ String *field, Obj *target) {
DefaultPostingListReaderIVARS *const ivars = DefPListReader_IVARS(self);
FieldType *type = Schema_Fetch_Type(ivars->schema, field);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/PostingListReader.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingListReader.cfh b/core/Lucy/Index/PostingListReader.cfh
index 8157af6..9aef573 100644
--- a/core/Lucy/Index/PostingListReader.cfh
+++ b/core/Lucy/Index/PostingListReader.cfh
@@ -37,7 +37,7 @@ public class Lucy::Index::PostingListReader cnick PListReader
* term using Seek().
*/
public abstract incremented nullable PostingList*
- Posting_List(PostingListReader *self, const String *field = NULL,
+ Posting_List(PostingListReader *self, String *field = NULL,
Obj *term = NULL);
abstract LexiconReader*
@@ -65,7 +65,7 @@ class Lucy::Index::DefaultPostingListReader cnick DefPListReader
LexiconReader *lex_reader);
public incremented nullable SegPostingList*
- Posting_List(DefaultPostingListReader *self, const String *field = NULL,
+ Posting_List(DefaultPostingListReader *self, String *field = NULL,
Obj *term = NULL);
LexiconReader*
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index a3e61c0..6cf0d40 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -59,7 +59,7 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
PostingPool*
PostPool_new(Schema *schema, Snapshot *snapshot, Segment *segment,
- PolyReader *polyreader, const String *field,
+ PolyReader *polyreader, String *field,
LexiconWriter *lex_writer, MemoryPool *mem_pool,
OutStream *lex_temp_out, OutStream *post_temp_out,
OutStream *skip_out) {
@@ -71,7 +71,7 @@ PostPool_new(Schema *schema, Snapshot *snapshot, Segment *segment,
PostingPool*
PostPool_init(PostingPool *self, Schema *schema, Snapshot *snapshot,
- Segment *segment, PolyReader *polyreader, const String *field,
+ Segment *segment, PolyReader *polyreader, String *field,
LexiconWriter *lex_writer, MemoryPool *mem_pool,
OutStream *lex_temp_out, OutStream *post_temp_out,
OutStream *skip_out) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/PostingPool.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.cfh b/core/Lucy/Index/PostingPool.cfh
index 570ec15..590680c 100644
--- a/core/Lucy/Index/PostingPool.cfh
+++ b/core/Lucy/Index/PostingPool.cfh
@@ -51,14 +51,14 @@ class Lucy::Index::PostingPool cnick PostPool
inert incremented PostingPool*
new(Schema *schema, Snapshot *snapshot, Segment *segment,
- PolyReader *polyreader, const String *field,
+ PolyReader *polyreader, String *field,
LexiconWriter *lex_writer, MemoryPool *mem_pool,
OutStream *lex_temp_out, OutStream *post_temp_out,
OutStream *skip_out);
inert PostingPool*
init(PostingPool *self, Schema *schema, Snapshot *snapshot,
- Segment *segment, PolyReader *polyreader, const String *field,
+ Segment *segment, PolyReader *polyreader, String *field,
LexiconWriter *lex_writer, MemoryPool *mem_pool,
OutStream *lex_temp_out, OutStream *post_temp_out,
OutStream *skip_out);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/RawLexicon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/RawLexicon.c b/core/Lucy/Index/RawLexicon.c
index 66b4336..2652d96 100644
--- a/core/Lucy/Index/RawLexicon.c
+++ b/core/Lucy/Index/RawLexicon.c
@@ -26,14 +26,14 @@
#include "Lucy/Store/InStream.h"
RawLexicon*
-RawLex_new(Schema *schema, const String *field, InStream *instream,
+RawLex_new(Schema *schema, String *field, InStream *instream,
int64_t start, int64_t end) {
RawLexicon *self = (RawLexicon*)VTable_Make_Obj(RAWLEXICON);
return RawLex_init(self, schema, field, instream, start, end);
}
RawLexicon*
-RawLex_init(RawLexicon *self, Schema *schema, const String *field,
+RawLex_init(RawLexicon *self, Schema *schema, String *field,
InStream *instream, int64_t start, int64_t end) {
FieldType *type = Schema_Fetch_Type(schema, field);
Lex_init((Lexicon*)self, field);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/RawLexicon.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/RawLexicon.cfh b/core/Lucy/Index/RawLexicon.cfh
index 59b5f36..b0a8b3a 100644
--- a/core/Lucy/Index/RawLexicon.cfh
+++ b/core/Lucy/Index/RawLexicon.cfh
@@ -29,11 +29,11 @@ class Lucy::Index::RawLexicon cnick RawLex
int64_t len;
inert incremented RawLexicon*
- new(Schema *schema, const String *field, InStream *instream,
+ new(Schema *schema, String *field, InStream *instream,
int64_t start, int64_t end);
inert RawLexicon*
- init(RawLexicon *self, Schema *schema, const String *field,
+ init(RawLexicon *self, Schema *schema, String *field,
InStream *instream, int64_t start, int64_t end);
public void
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/RawPostingList.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/RawPostingList.c b/core/Lucy/Index/RawPostingList.c
index 8518893..b2ced79 100644
--- a/core/Lucy/Index/RawPostingList.c
+++ b/core/Lucy/Index/RawPostingList.c
@@ -26,14 +26,14 @@
#include "Lucy/Util/MemoryPool.h"
RawPostingList*
-RawPList_new(Schema *schema, const String *field, InStream *instream,
+RawPList_new(Schema *schema, String *field, InStream *instream,
int64_t start, int64_t end) {
RawPostingList *self = (RawPostingList*)VTable_Make_Obj(RAWPOSTINGLIST);
return RawPList_init(self, schema, field, instream, start, end);
}
RawPostingList*
-RawPList_init(RawPostingList *self, Schema *schema, const String *field,
+RawPList_init(RawPostingList *self, Schema *schema, String *field,
InStream *instream, int64_t start, int64_t end) {
PList_init((PostingList*)self);
RawPostingListIVARS *const ivars = RawPList_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/RawPostingList.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/RawPostingList.cfh b/core/Lucy/Index/RawPostingList.cfh
index 37da0e9..0ba119c 100644
--- a/core/Lucy/Index/RawPostingList.cfh
+++ b/core/Lucy/Index/RawPostingList.cfh
@@ -26,11 +26,11 @@ class Lucy::Index::RawPostingList cnick RawPList
int64_t len;
inert incremented RawPostingList*
- new(Schema *schema, const String *field, InStream *instream,
+ new(Schema *schema, String *field, InStream *instream,
int64_t start, int64_t end);
inert RawPostingList*
- init(RawPostingList *self, Schema *schema, const String *field,
+ init(RawPostingList *self, Schema *schema, String *field,
InStream *instream, int64_t lex_start, int64_t lex_end);
public void
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SegLexicon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegLexicon.c b/core/Lucy/Index/SegLexicon.c
index dd5931f..bd6e3df 100644
--- a/core/Lucy/Index/SegLexicon.c
+++ b/core/Lucy/Index/SegLexicon.c
@@ -38,14 +38,14 @@ S_scan_to(SegLexicon *self, Obj *target);
SegLexicon*
SegLex_new(Schema *schema, Folder *folder, Segment *segment,
- const String *field) {
+ String *field) {
SegLexicon *self = (SegLexicon*)VTable_Make_Obj(SEGLEXICON);
return SegLex_init(self, schema, folder, segment, field);
}
SegLexicon*
SegLex_init(SegLexicon *self, Schema *schema, Folder *folder,
- Segment *segment, const String *field) {
+ Segment *segment, String *field) {
Hash *metadata = (Hash*)CERTIFY(
Seg_Fetch_Metadata_Utf8(segment, "lexicon", 7),
HASH);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SegLexicon.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegLexicon.cfh b/core/Lucy/Index/SegLexicon.cfh
index c710735..dd25b05 100644
--- a/core/Lucy/Index/SegLexicon.cfh
+++ b/core/Lucy/Index/SegLexicon.cfh
@@ -41,11 +41,11 @@ class Lucy::Index::SegLexicon cnick SegLex
*/
inert incremented SegLexicon*
new(Schema *schema, Folder *folder, Segment *segment,
- const String *field);
+ String *field);
inert SegLexicon*
init(SegLexicon *self, Schema *schema, Folder *folder, Segment *segment,
- const String *field);
+ String *field);
nullable TermInfo*
Get_Term_Info(SegLexicon *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SegPostingList.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegPostingList.c b/core/Lucy/Index/SegPostingList.c
index 71b344d..62dcdf4 100644
--- a/core/Lucy/Index/SegPostingList.c
+++ b/core/Lucy/Index/SegPostingList.c
@@ -43,14 +43,14 @@ static void
S_seek_tinfo(SegPostingList *self, TermInfo *tinfo);
SegPostingList*
-SegPList_new(PostingListReader *plist_reader, const String *field) {
+SegPList_new(PostingListReader *plist_reader, String *field) {
SegPostingList *self = (SegPostingList*)VTable_Make_Obj(SEGPOSTINGLIST);
return SegPList_init(self, plist_reader, field);
}
SegPostingList*
SegPList_init(SegPostingList *self, PostingListReader *plist_reader,
- const String *field) {
+ String *field) {
SegPostingListIVARS *const ivars = SegPList_IVARS(self);
Schema *const schema = PListReader_Get_Schema(plist_reader);
Folder *const folder = PListReader_Get_Folder(plist_reader);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SegPostingList.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegPostingList.cfh b/core/Lucy/Index/SegPostingList.cfh
index 0213dde..8209fb4 100644
--- a/core/Lucy/Index/SegPostingList.cfh
+++ b/core/Lucy/Index/SegPostingList.cfh
@@ -36,11 +36,11 @@ class Lucy::Index::SegPostingList cnick SegPList
int32_t field_num;
inert incremented SegPostingList*
- new(PostingListReader *plist_reader, const String *field);
+ new(PostingListReader *plist_reader, String *field);
inert SegPostingList*
init(SegPostingList *self, PostingListReader *plist_reader,
- const String *field);
+ String *field);
InStream*
Get_Post_Stream(SegPostingList *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SegReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegReader.c b/core/Lucy/Index/SegReader.c
index 3a7db4c..b8ff67c 100644
--- a/core/Lucy/Index/SegReader.c
+++ b/core/Lucy/Index/SegReader.c
@@ -84,7 +84,7 @@ SegReader_Destroy_IMP(SegReader *self) {
}
void
-SegReader_Register_IMP(SegReader *self, const String *api,
+SegReader_Register_IMP(SegReader *self, String *api,
DataReader *component) {
SegReaderIVARS *const ivars = SegReader_IVARS(self);
if (Hash_Fetch(ivars->components, (Obj*)api)) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SegReader.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegReader.cfh b/core/Lucy/Index/SegReader.cfh
index ee5e638..44660fe 100644
--- a/core/Lucy/Index/SegReader.cfh
+++ b/core/Lucy/Index/SegReader.cfh
@@ -63,7 +63,7 @@ public class Lucy::Index::SegReader inherits Lucy::Index::IndexReader {
* @param component A DataReader.
*/
public void
- Register(SegReader *self, const String *api,
+ Register(SegReader *self, String *api,
decremented DataReader *component);
/** Return the name of the segment.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SegWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegWriter.c b/core/Lucy/Index/SegWriter.c
index d980ab9..adcd6a1 100644
--- a/core/Lucy/Index/SegWriter.c
+++ b/core/Lucy/Index/SegWriter.c
@@ -61,7 +61,7 @@ SegWriter_Destroy_IMP(SegWriter *self) {
}
void
-SegWriter_Register_IMP(SegWriter *self, const String *api,
+SegWriter_Register_IMP(SegWriter *self, String *api,
DataWriter *component) {
SegWriterIVARS *const ivars = SegWriter_IVARS(self);
CERTIFY(component, DATAWRITER);
@@ -72,7 +72,7 @@ SegWriter_Register_IMP(SegWriter *self, const String *api,
}
Obj*
-SegWriter_Fetch_IMP(SegWriter *self, const String *api) {
+SegWriter_Fetch_IMP(SegWriter *self, String *api) {
SegWriterIVARS *const ivars = SegWriter_IVARS(self);
return Hash_Fetch(ivars->by_api, (Obj*)api);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SegWriter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegWriter.cfh b/core/Lucy/Index/SegWriter.cfh
index 868f869..047525c 100644
--- a/core/Lucy/Index/SegWriter.cfh
+++ b/core/Lucy/Index/SegWriter.cfh
@@ -65,7 +65,7 @@ public class Lucy::Index::SegWriter inherits Lucy::Index::DataWriter {
* @param component A DataWriter.
*/
public void
- Register(SegWriter *self, const String *api,
+ Register(SegWriter *self, String *api,
decremented DataWriter *component);
/** Retrieve a registered component.
@@ -74,7 +74,7 @@ public class Lucy::Index::SegWriter inherits Lucy::Index::DataWriter {
* implements.
*/
public nullable Obj*
- Fetch(SegWriter *self, const String *api);
+ Fetch(SegWriter *self, String *api);
/** Add a DataWriter to the SegWriter's stack of writers.
*/
[lucy-commits] [02/50] [abbrv] git commit: refs/heads/master - Convert
TextTermStepper to CharBuf
Posted by nw...@apache.org.
Convert TextTermStepper to CharBuf
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/195985ec
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/195985ec
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/195985ec
Branch: refs/heads/master
Commit: 195985ec5c3e7bb7dcd792875a744fa73443078b
Parents: f521947
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Sep 10 01:17:42 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:13 2013 +0200
----------------------------------------------------------------------
core/Lucy/Index/SegLexicon.c | 9 +----
core/Lucy/Plan/TextType.c | 78 +++++++++++++++++++++++++++------------
core/Lucy/Plan/TextType.cfh | 8 ++++
3 files changed, 65 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/195985ec/core/Lucy/Index/SegLexicon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegLexicon.c b/core/Lucy/Index/SegLexicon.c
index ab52dc2..19c6e7b 100644
--- a/core/Lucy/Index/SegLexicon.c
+++ b/core/Lucy/Index/SegLexicon.c
@@ -202,15 +202,10 @@ static void
S_scan_to(SegLexicon *self, Obj *target) {
SegLexiconIVARS *const ivars = SegLex_IVARS(self);
- // (mildly evil encapsulation violation, since value can be null)
- Obj *current = TermStepper_Get_Value(ivars->term_stepper);
- if (!Obj_Is_A(target, Obj_Get_VTable(current))) {
- THROW(ERR, "Target is a %o, and not comparable to a %o",
- Obj_Get_Class_Name(target), Obj_Get_Class_Name(current));
- }
-
// Keep looping until the term text is ge target.
do {
+ // (mildly evil encapsulation violation, since value can be null)
+ Obj *current = TermStepper_Get_Value(ivars->term_stepper);
const int32_t comparison = Obj_Compare_To(current, target);
if (comparison >= 0 && ivars->term_num != -1) { break; }
} while (SegLex_Next(self));
http://git-wip-us.apache.org/repos/asf/lucy/blob/195985ec/core/Lucy/Plan/TextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.c b/core/Lucy/Plan/TextType.c
index 40d0490..d4b6ae8 100644
--- a/core/Lucy/Plan/TextType.c
+++ b/core/Lucy/Plan/TextType.c
@@ -21,6 +21,7 @@
#include "Lucy/Plan/TextType.h"
#include "Lucy/Store/InStream.h"
#include "Lucy/Store/OutStream.h"
+#include "Clownfish/CharBuf.h"
#include "Clownfish/Util/StringHelper.h"
String*
@@ -54,22 +55,44 @@ TextTermStepper*
TextTermStepper_init(TextTermStepper *self) {
TermStepper_init((TermStepper*)self);
TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
- ivars->value = (Obj*)Str_new(0);
+ ivars->value = (Obj*)CB_new(0);
+ ivars->string = NULL;
return self;
}
void
+TextTermStepper_Destroy_IMP(TextTermStepper *self) {
+ TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
+ DECREF(ivars->string);
+ SUPER_DESTROY(self, TEXTTERMSTEPPER);
+}
+
+void
TextTermStepper_Set_Value_IMP(TextTermStepper *self, Obj *value) {
TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
CERTIFY(value, STRING);
- DECREF(ivars->value);
- ivars->value = INCREF(value);
+ Obj_Mimic(ivars->value, value);
+ // Invalidate string.
+ DECREF(ivars->string);
+ ivars->string = NULL;
+}
+
+Obj*
+TextTermStepper_Get_Value_IMP(TextTermStepper *self) {
+ TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
+ if (ivars->string == NULL) {
+ ivars->string = CB_To_String((CharBuf*)ivars->value);
+ }
+ return (Obj*)ivars->string;
}
void
TextTermStepper_Reset_IMP(TextTermStepper *self) {
TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
- Str_Set_Size((String*)ivars->value, 0);
+ CB_Set_Size((CharBuf*)ivars->value, 0);
+ // Invalidate string.
+ DECREF(ivars->string);
+ ivars->string = NULL;
}
void
@@ -81,18 +104,21 @@ TextTermStepper_Write_Key_Frame_IMP(TextTermStepper *self,
OutStream_Write_C32(outstream, size);
OutStream_Write_Bytes(outstream, buf, size);
Obj_Mimic(ivars->value, value);
+ // Invalidate string.
+ DECREF(ivars->string);
+ ivars->string = NULL;
}
void
TextTermStepper_Write_Delta_IMP(TextTermStepper *self, OutStream *outstream,
Obj *value) {
TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
- String *new_value = (String*)CERTIFY(value, STRING);
- String *last_value = (String*)ivars->value;
- char *new_text = (char*)Str_Get_Ptr8(new_value);
- size_t new_size = Str_Get_Size(new_value);
- char *last_text = (char*)Str_Get_Ptr8(last_value);
- size_t last_size = Str_Get_Size(last_value);
+ String *new_value = (String*)CERTIFY(value, STRING);
+ CharBuf *last_value = (CharBuf*)ivars->value;
+ char *new_text = (char*)Str_Get_Ptr8(new_value);
+ size_t new_size = Str_Get_Size(new_value);
+ char *last_text = (char*)CB_Get_Ptr8(last_value);
+ size_t last_size = CB_Get_Size(last_value);
// Count how many bytes the strings share at the top.
const int32_t overlap = StrHelp_overlap(last_text, new_text,
@@ -105,7 +131,11 @@ TextTermStepper_Write_Delta_IMP(TextTermStepper *self, OutStream *outstream,
OutStream_Write_String(outstream, diff_start_str, diff_len);
// Update value.
- Str_Mimic((String*)ivars->value, value);
+ Obj_Mimic(ivars->value, value);
+
+ // Invalidate string.
+ DECREF(ivars->string);
+ ivars->string = NULL;
}
void
@@ -115,15 +145,12 @@ TextTermStepper_Read_Key_Frame_IMP(TextTermStepper *self,
const uint32_t text_len = InStream_Read_C32(instream);
// Allocate space.
- if (ivars->value == NULL) {
- ivars->value = (Obj*)Str_new(text_len);
- }
- String *value = (String*)ivars->value;
- char *ptr = Str_Grow(value, text_len);
+ CharBuf *charbuf = (CharBuf*)ivars->value;
+ char *ptr = CB_Grow(charbuf, text_len);
// Set the value text.
InStream_Read_Bytes(instream, ptr, text_len);
- Str_Set_Size(value, text_len);
+ CB_Set_Size(charbuf, text_len);
if (!StrHelp_utf8_valid(ptr, text_len)) {
THROW(ERR, "Invalid UTF-8 sequence in '%o' at byte %i64",
InStream_Get_Filename(instream),
@@ -132,6 +159,10 @@ TextTermStepper_Read_Key_Frame_IMP(TextTermStepper *self,
// Null-terminate.
ptr[text_len] = '\0';
+
+ // Invalidate string.
+ DECREF(ivars->string);
+ ivars->string = NULL;
}
void
@@ -142,15 +173,12 @@ TextTermStepper_Read_Delta_IMP(TextTermStepper *self, InStream *instream) {
const uint32_t total_text_len = text_overlap + finish_chars_len;
// Allocate space.
- if (ivars->value == NULL) {
- ivars->value = (Obj*)Str_new(total_text_len);
- }
- String *value = (String*)ivars->value;
- char *ptr = Str_Grow(value, total_text_len);
+ CharBuf *charbuf = (CharBuf*)ivars->value;
+ char *ptr = CB_Grow(charbuf, total_text_len);
// Set the value text.
InStream_Read_Bytes(instream, ptr + text_overlap, finish_chars_len);
- Str_Set_Size(value, total_text_len);
+ CB_Set_Size(charbuf, total_text_len);
if (!StrHelp_utf8_valid(ptr, total_text_len)) {
THROW(ERR, "Invalid UTF-8 sequence in '%o' at byte %i64",
InStream_Get_Filename(instream),
@@ -159,6 +187,10 @@ TextTermStepper_Read_Delta_IMP(TextTermStepper *self, InStream *instream) {
// Null-terminate.
ptr[total_text_len] = '\0';
+
+ // Invalidate string.
+ DECREF(ivars->string);
+ ivars->string = NULL;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/195985ec/core/Lucy/Plan/TextType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.cfh b/core/Lucy/Plan/TextType.cfh
index 0bcc3cc..654a06a 100644
--- a/core/Lucy/Plan/TextType.cfh
+++ b/core/Lucy/Plan/TextType.cfh
@@ -30,6 +30,8 @@ class Lucy::Plan::TextType inherits Lucy::Plan::FieldType {
class Lucy::Index::TermStepper::TextTermStepper
inherits Lucy::Index::TermStepper {
+ String *string;
+
inert incremented TextTermStepper*
new();
@@ -37,6 +39,9 @@ class Lucy::Index::TermStepper::TextTermStepper
init(TextTermStepper *self);
public void
+ Destroy(TextTermStepper *self);
+
+ public void
Reset(TextTermStepper *self);
/**
@@ -45,6 +50,9 @@ class Lucy::Index::TermStepper::TextTermStepper
public void
Set_Value(TextTermStepper *self, Obj *value = NULL);
+ public nullable Obj*
+ Get_Value(TextTermStepper *self);
+
public void
Write_Key_Frame(TextTermStepper *self, OutStream *outstream, Obj *value);
[lucy-commits] [39/50] [abbrv] git commit: refs/heads/master - Deduplicate some
CharBuf code
Posted by nw...@apache.org.
Deduplicate some CharBuf code
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/05e2baea
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/05e2baea
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/05e2baea
Branch: refs/heads/master
Commit: 05e2baead817bd04b0c58fa160e11c50e3f7ff83
Parents: 256d32c
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 19:04:56 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:20 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/CharBuf.c | 60 +++++++++++++------------
1 file changed, 31 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/05e2baea/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 6eb9c2e..8dbeb36 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -322,36 +322,52 @@ CB_Clone_IMP(CharBuf *self) {
return CB_new_from_trusted_utf8(self->ptr, self->size);
}
+static CFISH_INLINE void
+SI_mimic_utf8(CharBuf *self, const char* ptr, size_t size) {
+ if (size >= self->cap) { CB_Grow(self, size); }
+ memmove(self->ptr, ptr, size);
+ self->size = size;
+ self->ptr[size] = '\0';
+}
+
void
CB_Mimic_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
}
- if (size >= self->cap) { CB_Grow(self, size); }
- memmove(self->ptr, ptr, size);
- self->size = size;
- self->ptr[size] = '\0';
+ SI_mimic_utf8(self, ptr, size);
}
void
CB_Mimic_IMP(CharBuf *self, Obj *other) {
+ const char *ptr;
+ size_t size;
if (Obj_Is_A(other, CHARBUF)) {
CharBuf *twin = (CharBuf*)other;
- if (twin->size >= self->cap) { CB_Grow(self, twin->size); }
- memmove(self->ptr, twin->ptr, twin->size);
- self->size = twin->size;
- self->ptr[twin->size] = '\0';
+ ptr = twin->ptr;
+ size = twin->size;
}
else if (Obj_Is_A(other, STRING)) {
String *twin = (String*)other;
- if (twin->size >= self->cap) { CB_Grow(self, twin->size); }
- memmove(self->ptr, twin->ptr, twin->size);
- self->size = twin->size;
- self->ptr[twin->size] = '\0';
+ ptr = twin->ptr;
+ size = twin->size;
}
else {
THROW(ERR, "CharBuf can't mimic %o", Obj_Get_Class_Name(other));
}
+ SI_mimic_utf8(self, ptr, size);
+}
+
+static CFISH_INLINE void
+SI_cat_utf8(CharBuf *self, const char* ptr, size_t size) {
+ const size_t new_size = self->size + size;
+ if (new_size >= self->cap) {
+ size_t amount = Memory_oversize(new_size, sizeof(char));
+ CB_Grow(self, amount);
+ }
+ memcpy(self->ptr + self->size, ptr, size);
+ self->size = new_size;
+ self->ptr[new_size] = '\0';
}
void
@@ -359,31 +375,17 @@ CB_Cat_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
}
- CB_Cat_Trusted_Utf8_IMP(self, ptr, size);
+ SI_cat_utf8(self, ptr, size);
}
void
CB_Cat_Trusted_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
- const size_t new_size = self->size + size;
- if (new_size >= self->cap) {
- size_t amount = Memory_oversize(new_size, sizeof(char));
- CB_Grow(self, amount);
- }
- memcpy((self->ptr + self->size), ptr, size);
- self->size = new_size;
- self->ptr[new_size] = '\0';
+ SI_cat_utf8(self, ptr, size);
}
void
CB_Cat_IMP(CharBuf *self, String *string) {
- const size_t new_size = self->size + string->size;
- if (new_size >= self->cap) {
- size_t amount = Memory_oversize(new_size, sizeof(char));
- CB_Grow(self, amount);
- }
- memcpy((self->ptr + self->size), string->ptr, string->size);
- self->size = new_size;
- self->ptr[new_size] = '\0';
+ SI_cat_utf8(self, string->ptr, string->size);
}
void
[lucy-commits] [21/50] [abbrv] git commit: refs/heads/master - Const 'ptr' instance
variable of String
Posted by nw...@apache.org.
Const 'ptr' instance variable of String
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/34fedddd
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/34fedddd
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/34fedddd
Branch: refs/heads/master
Commit: 34fedddd686b75eee3c485c0c84a224169f7b09c
Parents: c120b67
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 14 19:11:59 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:17 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 53 +++++++++++++-----------
clownfish/runtime/core/Clownfish/String.cfh | 10 ++---
2 files changed, 34 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/34fedddd/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index df85e29..96cf22f 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -68,35 +68,36 @@ Str_new_from_trusted_utf8(const char *ptr, size_t size) {
}
String*
-Str_init_from_trusted_utf8(String *self, const char *ptr, size_t size) {
- // Derive.
- self->ptr = (char*)MALLOCATE(size + 1);
+Str_init_from_trusted_utf8(String *self, const char *utf8, size_t size) {
+ // Allocate.
+ char *ptr = (char*)MALLOCATE(size + 1);
// Copy.
- memcpy(self->ptr, ptr, size);
+ memcpy(ptr, utf8, size);
+ ptr[size] = '\0'; // Null terminate.
// Assign.
- self->size = size;
- self->ptr[size] = '\0'; // Null terminate.
+ self->ptr = ptr;
+ self->size = size;
return self;
}
String*
-Str_new_steal_from_trusted_str(char *ptr, size_t size) {
+Str_new_steal_from_trusted_str(const char *ptr, size_t size) {
String *self = (String*)VTable_Make_Obj(STRING);
return Str_init_steal_trusted_str(self, ptr, size);
}
String*
-Str_init_steal_trusted_str(String *self, char *ptr, size_t size) {
+Str_init_steal_trusted_str(String *self, const char *ptr, size_t size) {
self->ptr = ptr;
self->size = size;
return self;
}
String*
-Str_new_steal_str(char *ptr, size_t size) {
+Str_new_steal_str(const char *ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
}
@@ -106,10 +107,13 @@ Str_new_steal_str(char *ptr, size_t size) {
String*
Str_new_from_char(uint32_t code_point) {
const size_t MAX_UTF8_BYTES = 4;
+ char *ptr = (char*)MALLOCATE(MAX_UTF8_BYTES + 1);
+ size_t size = StrHelp_encode_utf8_char(code_point, (uint8_t*)ptr);
+ ptr[size] = '\0';
+
String *self = (String*)VTable_Make_Obj(STRING);
- self->ptr = (char*)MALLOCATE(MAX_UTF8_BYTES + 1);
- self->size = StrHelp_encode_utf8_char(code_point, (uint8_t*)self->ptr);
- self->ptr[self->size] = '\0';
+ self->ptr = ptr;
+ self->size = size;
return self;
}
@@ -127,7 +131,7 @@ Str_newf(const char *pattern, ...) {
void
Str_Destroy_IMP(String *self) {
- FREEMEM(self->ptr);
+ FREEMEM((char*)self->ptr);
SUPER_DESTROY(self, STRING);
}
@@ -321,7 +325,7 @@ Str_Ends_With_IMP(String *self, const String *postfix) {
bool
Str_Ends_With_Utf8_IMP(String *self, const char *postfix, size_t postfix_len) {
if (postfix_len <= self->size) {
- char *start = self->ptr + self->size - postfix_len;
+ const char *start = self->ptr + self->size - postfix_len;
if (memcmp(start, postfix, postfix_len) == 0) {
return true;
}
@@ -408,7 +412,7 @@ Str_SubString_IMP(String *self, size_t offset, size_t len) {
SStrIter_Advance(iter, offset);
int start_offset = iter->byte_offset;
- char *sub_start = self->ptr + start_offset;
+ const char *sub_start = self->ptr + start_offset;
SStrIter_Advance(iter, len);
size_t byte_len = iter->byte_offset - start_offset;
@@ -492,7 +496,7 @@ ViewCB_new_from_trusted_utf8(const char *utf8, size_t size) {
ViewCharBuf*
ViewCB_init(ViewCharBuf *self, const char *utf8, size_t size) {
- self->ptr = (char*)utf8;
+ self->ptr = utf8;
self->size = size;
return self;
}
@@ -518,18 +522,19 @@ SStr_new(void *allocation) {
StackString*
SStr_new_from_str(void *allocation, size_t alloc_size, String *string) {
- StackString *self
- = (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
- self->size = Str_Get_Size(string);
- self->ptr = ((char*)allocation) + sizeof(StackString);
+ size_t size = string->size;
+ char *ptr = ((char*)allocation) + sizeof(StackString);
- if (alloc_size < sizeof(StackString) + self->size + 1) {
+ if (alloc_size < sizeof(StackString) + size + 1) {
THROW(ERR, "alloc_size of StackString too small");
}
- memcpy(self->ptr, Str_Get_Ptr8(string), self->size);
- self->ptr[self->size] = '\0';
+ memcpy(ptr, string->ptr, size);
+ ptr[size] = '\0';
+ StackString *self = (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
+ self->ptr = ptr;
+ self->size = size;
return self;
}
@@ -538,7 +543,7 @@ SStr_wrap_str(void *allocation, const char *ptr, size_t size) {
StackString *self
= (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
self->size = size;
- self->ptr = (char*)ptr;
+ self->ptr = ptr;
return self;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/34fedddd/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index e639fa4..f64b73a 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -23,8 +23,8 @@ parcel Clownfish;
class Clownfish::String cnick Str
inherits Clownfish::Obj {
- char *ptr;
- size_t size;
+ const char *ptr;
+ size_t size;
/** Return a new String which holds a copy of the passed-in string.
* Check for UTF-8 validity.
@@ -48,19 +48,19 @@ class Clownfish::String cnick Str
* passed-in string. Check validity of supplied UTF-8.
*/
inert incremented String*
- new_steal_str(char *ptr, size_t size);
+ new_steal_str(const char *ptr, size_t size);
/** Return a pointer to a new String which assumes ownership of the
* passed-in string. Do not check validity of supplied UTF-8.
*/
inert incremented String*
- new_steal_from_trusted_str(char *ptr, size_t size);
+ new_steal_from_trusted_str(const char *ptr, size_t size);
/** Initialize the String using the passed-in string. Do not check
* validity of supplied UTF-8.
*/
public inert String*
- init_steal_trusted_str(decremented String *self, char *ptr, size_t size);
+ init_steal_trusted_str(String *self, const char *ptr, size_t size);
/** Return a String which holds a single character.
*/
[lucy-commits] [44/50] [abbrv] git commit: refs/heads/master - Remove un-const-ing
from method invocation funcs.
Posted by nw...@apache.org.
Remove un-const-ing from method invocation funcs.
Method invocation functions have been casting away const-ness by
accepting `const prefix_Foo *self` as the invocant but then invoking
the retrieved function pointer with `self` cast to `(prefix_Foo*)`.
This was necessary to avoid warnings from "const CharBuf" immutable
strings -- but now our String type is immutable without requiring
`const`, allowing us to improve type safety by removing the cast.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7dd4eeb7
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7dd4eeb7
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7dd4eeb7
Branch: refs/heads/master
Commit: 7dd4eeb7c3c53d8174d7af4f88885cc2efca2452
Parents: c36b887
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Sep 30 11:56:50 2013 -0700
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCBindMethod.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/7dd4eeb7/clownfish/compiler/src/CFCBindMethod.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindMethod.c b/clownfish/compiler/src/CFCBindMethod.c
index 0a2f7c9..3448e44 100644
--- a/clownfish/compiler/src/CFCBindMethod.c
+++ b/clownfish/compiler/src/CFCBindMethod.c
@@ -115,16 +115,15 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
const char pattern[] =
"extern %sVISIBLE size_t %s;\n"
"static CFISH_INLINE %s\n"
- "%s(const %s *self%s) {\n"
+ "%s(%s *self%s) {\n"
" const %s method = (%s)cfish_obj_method(self, %s);\n"
- " %smethod((%s*)self%s);\n"
+ " %smethod(self%s);\n"
"}\n";
char *method_def
= CFCUtil_sprintf(pattern, PREFIX, full_offset_sym, ret_type_str,
full_meth_sym, invoker_struct, params_minus_invoker,
full_typedef, full_typedef, full_offset_sym,
- maybe_return, invoker_struct,
- arg_names_minus_invoker);
+ maybe_return, arg_names_minus_invoker);
FREEMEM(full_offset_sym);
FREEMEM(full_meth_sym);
[lucy-commits] [25/50] [abbrv] git commit: refs/heads/master - Fix changes to
SortFieldWriter
Posted by nw...@apache.org.
Fix changes to SortFieldWriter
Now I realized that the objects which have previously be Mimiced were
keys of a ZombieKeyedHash allocated from a MemoryPool. As a temporary
fix, Clone the last Fetched value when the hash is cleared.
With immutable strings, I think we can get rid of ZombieKeyedHash and
use a normal Hash instead. Then this fix can be reverted.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/ee295df5
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/ee295df5
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/ee295df5
Branch: refs/heads/master
Commit: ee295df5589199b0ad872566911d2a32996005bb
Parents: 0b4bf99
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Sep 18 13:21:36 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:17 2013 +0200
----------------------------------------------------------------------
core/Lucy/Index/SortFieldWriter.c | 17 ++++++++++++-----
core/Lucy/Index/SortFieldWriter.cfh | 1 +
2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee295df5/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index bf08089..18ace6a 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -94,6 +94,7 @@ SortFieldWriter_init(SortFieldWriter *self, Schema *schema,
ivars->run_ord = 0;
ivars->run_tick = 0;
ivars->ord_width = 0;
+ ivars->last_val = NULL;
// Assign.
ivars->field = Str_Clone(field);
@@ -128,6 +129,11 @@ void
SortFieldWriter_Clear_Cache_IMP(SortFieldWriter *self) {
SortFieldWriterIVARS *const ivars = SortFieldWriter_IVARS(self);
if (ivars->uniq_vals) {
+ if (ivars->last_val) {
+ Obj *clone = Obj_Clone(ivars->last_val);
+ DECREF(ivars->last_val);
+ ivars->last_val = clone;
+ }
Hash_Clear(ivars->uniq_vals);
}
SortFieldWriter_Clear_Cache_t super_clear_cache
@@ -552,24 +558,25 @@ S_write_files(SortFieldWriter *self, OutStream *ord_out, OutStream *ix_out,
ords[0] = 0;
// Build array of ords, write non-NULL sorted values.
- Obj *val = INCREF(elem->value);
+ ivars->last_val = INCREF(elem->value);
Obj *last_val_address = elem->value;
S_write_val(elem->value, prim_id, ix_out, dat_out, dat_start);
while (NULL != (elem = (SFWriterElem*)SortFieldWriter_Fetch(self))) {
if (elem->value != last_val_address) {
int32_t comparison
- = FType_Compare_Values(ivars->type, elem->value, val);
+ = FType_Compare_Values(ivars->type, elem->value, ivars->last_val);
if (comparison != 0) {
ord++;
S_write_val(elem->value, prim_id, ix_out, dat_out, dat_start);
- DECREF(val);
- val = INCREF(elem->value);
+ DECREF(ivars->last_val);
+ ivars->last_val = INCREF(elem->value);
}
last_val_address = elem->value;
}
ords[elem->doc_id] = ord;
}
- DECREF(val);
+ DECREF(ivars->last_val);
+ ivars->last_val = NULL;
// If there are NULL values, write one now and record the NULL ord.
if (has_nulls) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee295df5/core/Lucy/Index/SortFieldWriter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.cfh b/core/Lucy/Index/SortFieldWriter.cfh
index 3f6301b..274961c 100644
--- a/core/Lucy/Index/SortFieldWriter.cfh
+++ b/core/Lucy/Index/SortFieldWriter.cfh
@@ -51,6 +51,7 @@ class Lucy::Index::SortFieldWriter
int32_t run_ord;
int32_t run_tick;
int32_t ord_width;
+ Obj *last_val;
inert incremented SortFieldWriter*
new(Schema *schema, Snapshot *snapshot, Segment *segment,
[lucy-commits] [42/50] [abbrv] git commit: refs/heads/master - Switch String#Hash to
SStrIter_Next_t
Posted by nw...@apache.org.
Switch String#Hash to SStrIter_Next_t
Now that method typedefs are fixed, we don't have to fetch the method
pointer form the implementing class.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/94b9ae4f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/94b9ae4f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/94b9ae4f
Branch: refs/heads/master
Commit: 94b9ae4f365b28b263c3b8491ae504a65f9cab1e
Parents: 7dd4eeb
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 30 22:54:58 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/94b9ae4f/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 6396dc9..41ecab2 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -202,10 +202,10 @@ Str_Hash_Sum_IMP(String *self) {
uint32_t hashvalue = 5381;
StackStringIterator *iter = STR_STACKTOP(self);
- const StrIter_Next_t next
- = METHOD_PTR(STRINGITERATOR, CFISH_StrIter_Next);
+ const SStrIter_Next_t next
+ = METHOD_PTR(STACKSTRINGITERATOR, CFISH_SStrIter_Next);
int32_t code_point;
- while (STRITER_DONE != (code_point = next((StringIterator*)iter))) {
+ while (STRITER_DONE != (code_point = next(iter))) {
hashvalue = ((hashvalue << 5) + hashvalue) ^ code_point;
}
[lucy-commits] [26/50] [abbrv] git commit: refs/heads/master - Rework previous
change to SortFieldWriter
Posted by nw...@apache.org.
Rework previous change to SortFieldWriter
I'm still not sure whether this is safe.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7ba4174c
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7ba4174c
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7ba4174c
Branch: refs/heads/master
Commit: 7ba4174cfbe66f4ab097ce3f6d5578ee3be72a36
Parents: 2e8f892
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 14 21:07:44 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:17 2013 +0200
----------------------------------------------------------------------
core/Lucy/Index/SortFieldWriter.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/7ba4174c/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 86bb84d..bf08089 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -552,7 +552,7 @@ S_write_files(SortFieldWriter *self, OutStream *ord_out, OutStream *ix_out,
ords[0] = 0;
// Build array of ords, write non-NULL sorted values.
- Obj *val = elem->value;
+ Obj *val = INCREF(elem->value);
Obj *last_val_address = elem->value;
S_write_val(elem->value, prim_id, ix_out, dat_out, dat_start);
while (NULL != (elem = (SFWriterElem*)SortFieldWriter_Fetch(self))) {
@@ -562,12 +562,14 @@ S_write_files(SortFieldWriter *self, OutStream *ord_out, OutStream *ix_out,
if (comparison != 0) {
ord++;
S_write_val(elem->value, prim_id, ix_out, dat_out, dat_start);
- val = elem->value;
+ DECREF(val);
+ val = INCREF(elem->value);
}
last_val_address = elem->value;
}
ords[elem->doc_id] = ord;
}
+ DECREF(val);
// If there are NULL values, write one now and record the NULL ord.
if (has_nulls) {
[lucy-commits] [20/50] [abbrv] git commit: refs/heads/master - Replace
Str_Inc_RefCount with INCREF
Posted by nw...@apache.org.
Replace Str_Inc_RefCount with INCREF
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/fbcf77cd
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/fbcf77cd
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/fbcf77cd
Branch: refs/heads/master
Commit: fbcf77cd54edac7b5caa4627d44f68353a2babc9
Parents: 180fccd
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri May 10 18:42:05 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:17 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/Num.c | 2 +-
core/Lucy/Index/PolyReader.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/fbcf77cd/clownfish/runtime/core/Clownfish/Num.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Num.c b/clownfish/runtime/core/Clownfish/Num.c
index f18bf76..cf38a86 100644
--- a/clownfish/runtime/core/Clownfish/Num.c
+++ b/clownfish/runtime/core/Clownfish/Num.c
@@ -375,7 +375,7 @@ Bool_Hash_Sum_IMP(BoolNum *self) {
String*
Bool_To_String_IMP(BoolNum *self) {
- return (String*)Str_Inc_RefCount(self->string);
+ return (String*)INCREF(self->string);
}
bool
http://git-wip-us.apache.org/repos/asf/lucy/blob/fbcf77cd/core/Lucy/Index/PolyReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyReader.c b/core/Lucy/Index/PolyReader.c
index 0446bcb..1dbc0b5 100644
--- a/core/Lucy/Index/PolyReader.c
+++ b/core/Lucy/Index/PolyReader.c
@@ -355,7 +355,7 @@ PolyReader_do_open(PolyReader *self, Obj *index, Snapshot *snapshot,
THROW(ERR, "Supplied snapshot objects must not be empty");
}
else {
- Str_Inc_RefCount(target_snap_file);
+ target_snap_file = (String*)INCREF(target_snap_file);
}
}
else {
[lucy-commits] [06/50] [abbrv] git commit: refs/heads/master - Make SortCache_Value
work with immutable strings
Posted by nw...@apache.org.
Make SortCache_Value work with immutable strings
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f042ed32
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f042ed32
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f042ed32
Branch: refs/heads/master
Commit: f042ed3240833fed71b3e11ebf0825d981a32e9a
Parents: d7a385b
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 9 21:15:52 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:13 2013 +0200
----------------------------------------------------------------------
core/Lucy/Index/SortCache.c | 15 +-----
core/Lucy/Index/SortCache.cfh | 15 ++----
core/Lucy/Index/SortCache/NumericSortCache.c | 52 +++++----------------
core/Lucy/Index/SortCache/NumericSortCache.cfh | 28 ++++-------
core/Lucy/Index/SortCache/TextSortCache.c | 23 ++-------
core/Lucy/Index/SortCache/TextSortCache.cfh | 7 +--
core/Lucy/Index/SortFieldWriter.c | 8 ++--
core/Lucy/Search/Collector/SortCollector.c | 9 ++--
core/Lucy/Search/RangeQuery.c | 10 ++--
perl/buildlib/Lucy/Build/Binding/Index.pm | 5 +-
10 files changed, 46 insertions(+), 126 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/core/Lucy/Index/SortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache.c b/core/Lucy/Index/SortCache.c
index 53f6d43..446ced2 100644
--- a/core/Lucy/Index/SortCache.c
+++ b/core/Lucy/Index/SortCache.c
@@ -111,22 +111,13 @@ SortCache_Find_IMP(SortCache *self, Obj *term) {
int32_t lo = 0;
int32_t hi = ivars->cardinality - 1;
int32_t result = -100;
- Obj *blank = SortCache_Make_Blank(self);
-
- if (term != NULL
- && !Obj_Is_A(term, Obj_Get_VTable(blank))
- && !Obj_Is_A(blank, Obj_Get_VTable(term))
- ) {
- THROW(ERR, "SortCache error for field %o: term is a %o, and not "
- "comparable to a %o", ivars->field, Obj_Get_Class_Name(term),
- Obj_Get_Class_Name(blank));
- }
// Binary search.
while (hi >= lo) {
const int32_t mid = lo + ((hi - lo) / 2);
- Obj *val = SortCache_Value(self, mid, blank);
+ Obj *val = SortCache_Value(self, mid);
int32_t comparison = FType_null_back_compare_values(type, term, val);
+ DECREF(val);
if (comparison < 0) {
hi = mid - 1;
}
@@ -139,8 +130,6 @@ SortCache_Find_IMP(SortCache *self, Obj *term) {
}
}
- DECREF(blank);
-
if (hi < 0) {
// Target is "less than" the first cache entry.
return -1;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/core/Lucy/Index/SortCache.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache.cfh b/core/Lucy/Index/SortCache.cfh
index 9554425..f16b78f 100644
--- a/core/Lucy/Index/SortCache.cfh
+++ b/core/Lucy/Index/SortCache.cfh
@@ -34,18 +34,11 @@ class Lucy::Index::SortCache inherits Clownfish::Obj {
void *ords, int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width);
- /** Assign the value for ordinal <code>ord</code> to <code>blank</code>.
- *
- * @return either <code>blank</code> (no longer blank), or NULL if the
- * value for <code>ord</code> is NULL.
- */
- public abstract nullable Obj*
- Value(SortCache *self, int32_t ord, Obj *blank);
-
- /** Return an object appropriate for use as an argument to Value().
+ /** Return the value for ordinal <code>ord</code>, or NULL if the value
+ * for <code>ord</code> is NULL.
*/
- public abstract incremented Obj*
- Make_Blank(SortCache *self);
+ public abstract nullable incremented Obj*
+ Value(SortCache *self, int32_t ord);
public void*
Get_Ords(SortCache *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/core/Lucy/Index/SortCache/NumericSortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/NumericSortCache.c b/core/Lucy/Index/SortCache/NumericSortCache.c
index 143c9c1..7241e6f 100644
--- a/core/Lucy/Index/SortCache/NumericSortCache.c
+++ b/core/Lucy/Index/SortCache/NumericSortCache.c
@@ -102,26 +102,19 @@ F64SortCache_init(Float64SortCache *self, const String *field,
}
Obj*
-F64SortCache_Value_IMP(Float64SortCache *self, int32_t ord, Obj *blank) {
+F64SortCache_Value_IMP(Float64SortCache *self, int32_t ord) {
Float64SortCacheIVARS *const ivars = F64SortCache_IVARS(self);
if (ord == ivars->null_ord) {
return NULL;
}
else if (ord < 0) {
THROW(ERR, "Ordinal less than 0 for %o: %i32", ivars->field, ord);
+ UNREACHABLE_RETURN(Obj*);
}
else {
- Float64 *num_blank = (Float64*)CERTIFY(blank, FLOAT64);
InStream_Seek(ivars->dat_in, ord * sizeof(double));
- Float64_Set_Value(num_blank, InStream_Read_F64(ivars->dat_in));
+ return (Obj*)Float64_new(InStream_Read_F64(ivars->dat_in));
}
- return blank;
-}
-
-Float64*
-F64SortCache_Make_Blank_IMP(Float64SortCache *self) {
- UNUSED_VAR(self);
- return Float64_new(0.0);
}
/***************************************************************************/
@@ -147,26 +140,19 @@ F32SortCache_init(Float32SortCache *self, const String *field,
}
Obj*
-F32SortCache_Value_IMP(Float32SortCache *self, int32_t ord, Obj *blank) {
+F32SortCache_Value_IMP(Float32SortCache *self, int32_t ord) {
Float32SortCacheIVARS *const ivars = F32SortCache_IVARS(self);
if (ord == ivars->null_ord) {
return NULL;
}
else if (ord < 0) {
THROW(ERR, "Ordinal less than 0 for %o: %i32", ivars->field, ord);
+ UNREACHABLE_RETURN(Obj*);
}
else {
- Float32 *num_blank = (Float32*)CERTIFY(blank, FLOAT32);
InStream_Seek(ivars->dat_in, ord * sizeof(float));
- Float32_Set_Value(num_blank, InStream_Read_F32(ivars->dat_in));
+ return (Obj*)Float32_new(InStream_Read_F32(ivars->dat_in));
}
- return blank;
-}
-
-Float32*
-F32SortCache_Make_Blank_IMP(Float32SortCache *self) {
- UNUSED_VAR(self);
- return Float32_new(0.0f);
}
/***************************************************************************/
@@ -192,26 +178,19 @@ I32SortCache_init(Int32SortCache *self, const String *field,
}
Obj*
-I32SortCache_Value_IMP(Int32SortCache *self, int32_t ord, Obj *blank) {
+I32SortCache_Value_IMP(Int32SortCache *self, int32_t ord) {
Int32SortCacheIVARS *const ivars = I32SortCache_IVARS(self);
if (ord == ivars->null_ord) {
return NULL;
}
else if (ord < 0) {
THROW(ERR, "Ordinal less than 0 for %o: %i32", ivars->field, ord);
+ UNREACHABLE_RETURN(Obj*);
}
else {
- Integer32 *int_blank = (Integer32*)CERTIFY(blank, INTEGER32);
InStream_Seek(ivars->dat_in, ord * sizeof(int32_t));
- Int32_Set_Value(int_blank, InStream_Read_I32(ivars->dat_in));
+ return (Obj*)Int32_new(InStream_Read_I32(ivars->dat_in));
}
- return blank;
-}
-
-Integer32*
-I32SortCache_Make_Blank_IMP(Int32SortCache *self) {
- UNUSED_VAR(self);
- return Int32_new(0);
}
/***************************************************************************/
@@ -237,26 +216,19 @@ I64SortCache_init(Int64SortCache *self, const String *field,
}
Obj*
-I64SortCache_Value_IMP(Int64SortCache *self, int32_t ord, Obj *blank) {
+I64SortCache_Value_IMP(Int64SortCache *self, int32_t ord) {
Int64SortCacheIVARS *const ivars = I64SortCache_IVARS(self);
if (ord == ivars->null_ord) {
return NULL;
}
else if (ord < 0) {
THROW(ERR, "Ordinal less than 0 for %o: %i32", ivars->field, ord);
+ UNREACHABLE_RETURN(Obj*);
}
else {
- Integer64 *int_blank = (Integer64*)CERTIFY(blank, INTEGER64);
InStream_Seek(ivars->dat_in, ord * sizeof(int64_t));
- Int64_Set_Value(int_blank, InStream_Read_I64(ivars->dat_in));
+ return (Obj*)Int64_new(InStream_Read_I64(ivars->dat_in));
}
- return blank;
-}
-
-Integer64*
-I64SortCache_Make_Blank_IMP(Int64SortCache *self) {
- UNUSED_VAR(self);
- return Int64_new(0);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/core/Lucy/Index/SortCache/NumericSortCache.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/NumericSortCache.cfh b/core/Lucy/Index/SortCache/NumericSortCache.cfh
index e1ba6e7..4b6de04 100644
--- a/core/Lucy/Index/SortCache/NumericSortCache.cfh
+++ b/core/Lucy/Index/SortCache/NumericSortCache.cfh
@@ -44,11 +44,8 @@ class Lucy::Index::SortCache::Float64SortCache cnick F64SortCache
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *dat_in);
- public nullable Obj*
- Value(Float64SortCache *self, int32_t ord, Obj *blank);
-
- public incremented Float64*
- Make_Blank(Float64SortCache *self);
+ public nullable incremented Obj*
+ Value(Float64SortCache *self, int32_t ord);
}
class Lucy::Index::SortCache::Float32SortCache cnick F32SortCache
@@ -64,11 +61,8 @@ class Lucy::Index::SortCache::Float32SortCache cnick F32SortCache
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *dat_in);
- public nullable Obj*
- Value(Float32SortCache *self, int32_t ord, Obj *blank);
-
- public incremented Float32*
- Make_Blank(Float32SortCache *self);
+ public nullable incremented Obj*
+ Value(Float32SortCache *self, int32_t ord);
}
class Lucy::Index::SortCache::Int32SortCache cnick I32SortCache
@@ -84,11 +78,8 @@ class Lucy::Index::SortCache::Int32SortCache cnick I32SortCache
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *dat_in);
- public nullable Obj*
- Value(Int32SortCache *self, int32_t ord, Obj *blank);
-
- public incremented Integer32*
- Make_Blank(Int32SortCache *self);
+ public nullable incremented Obj*
+ Value(Int32SortCache *self, int32_t ord);
}
class Lucy::Index::SortCache::Int64SortCache cnick I64SortCache
@@ -104,11 +95,8 @@ class Lucy::Index::SortCache::Int64SortCache cnick I64SortCache
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *dat_in);
- public nullable Obj*
- Value(Int64SortCache *self, int32_t ord, Obj *blank);
-
- public incremented Integer64*
- Make_Blank(Int64SortCache *self);
+ public nullable incremented Obj*
+ Value(Int64SortCache *self, int32_t ord);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/core/Lucy/Index/SortCache/TextSortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/TextSortCache.c b/core/Lucy/Index/SortCache/TextSortCache.c
index d9573f2..97df2bb 100644
--- a/core/Lucy/Index/SortCache/TextSortCache.c
+++ b/core/Lucy/Index/SortCache/TextSortCache.c
@@ -89,7 +89,7 @@ TextSortCache_Destroy_IMP(TextSortCache *self) {
#define NULL_SENTINEL -1
Obj*
-TextSortCache_Value_IMP(TextSortCache *self, int32_t ord, Obj *blank) {
+TextSortCache_Value_IMP(TextSortCache *self, int32_t ord) {
TextSortCacheIVARS *const ivars = TextSortCache_IVARS(self);
if (ord == ivars->null_ord) {
return NULL;
@@ -110,26 +110,13 @@ TextSortCache_Value_IMP(TextSortCache *self, int32_t ord, Obj *blank) {
}
// Read character data into String.
- CERTIFY(blank, STRING);
- int64_t len = next_offset - offset;
- char *ptr = Str_Grow((String*)blank, (size_t)len);
+ size_t len = (size_t)(next_offset - offset);
+ char *ptr = (char*)MALLOCATE(len + 1);
InStream_Seek(ivars->dat_in, offset);
- InStream_Read_Bytes(ivars->dat_in, ptr, (size_t)len);
+ InStream_Read_Bytes(ivars->dat_in, ptr, len);
ptr[len] = '\0';
- if (!StrHelp_utf8_valid(ptr, (size_t)len)) {
- Str_Set_Size((String*)blank, 0);
- THROW(ERR, "Invalid UTF-8 at %i64 in %o", offset,
- InStream_Get_Filename(ivars->dat_in));
- }
- Str_Set_Size((String*)blank, (size_t)len);
+ return (Obj*)Str_new_steal_str(ptr, len, len + 1);
}
- return blank;
-}
-
-String*
-TextSortCache_Make_Blank_IMP(TextSortCache *self) {
- UNUSED_VAR(self);
- return Str_new_from_trusted_utf8("", 0);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/core/Lucy/Index/SortCache/TextSortCache.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/TextSortCache.cfh b/core/Lucy/Index/SortCache/TextSortCache.cfh
index 7fb4f12..66b73c1 100644
--- a/core/Lucy/Index/SortCache/TextSortCache.cfh
+++ b/core/Lucy/Index/SortCache/TextSortCache.cfh
@@ -36,11 +36,8 @@ class Lucy::Index::SortCache::TextSortCache
int32_t ord_width, InStream *ord_in, InStream *ix_in,
InStream *dat_in);
- public nullable Obj*
- Value(TextSortCache *self, int32_t ord, Obj *blank);
-
- public incremented String*
- Make_Blank(TextSortCache *self);
+ public nullable incremented Obj*
+ Value(TextSortCache *self, int32_t ord);
public void
Destroy(TextSortCache *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 8c8e39b..b251123 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -436,14 +436,14 @@ SortFieldWriter_Refill_IMP(SortFieldWriter *self) {
Hash *const uniq_vals = ivars->uniq_vals;
I32Array *const doc_map = ivars->doc_map;
SortCache *const sort_cache = ivars->sort_cache;
- Obj *const blank = SortCache_Make_Blank(sort_cache);
while (ivars->run_ord < ivars->run_cardinality
&& MemPool_Get_Consumed(ivars->mem_pool) < ivars->mem_thresh
) {
- Obj *val = SortCache_Value(sort_cache, ivars->run_ord, blank);
+ Obj *val = SortCache_Value(sort_cache, ivars->run_ord);
if (val) {
Hash_Store(uniq_vals, val, (Obj*)CFISH_TRUE);
+ DECREF(val);
break;
}
ivars->run_ord++;
@@ -457,9 +457,10 @@ SortFieldWriter_Refill_IMP(SortFieldWriter *self) {
? I32Arr_Get(doc_map, raw_doc_id)
: raw_doc_id;
if (remapped) {
- Obj *val = SortCache_Value(sort_cache, ord, blank);
+ Obj *val = SortCache_Value(sort_cache, ord);
SortFieldWriter_Add(self, remapped, val);
count++;
+ DECREF(val);
}
}
else if (ord > ivars->run_ord) {
@@ -475,7 +476,6 @@ SortFieldWriter_Refill_IMP(SortFieldWriter *self) {
ivars->sort_cache = NULL;
}
- DECREF(blank);
return count;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/core/Lucy/Search/Collector/SortCollector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Collector/SortCollector.c b/core/Lucy/Search/Collector/SortCollector.c
index 15e9480..4001b6b 100644
--- a/core/Lucy/Search/Collector/SortCollector.c
+++ b/core/Lucy/Search/Collector/SortCollector.c
@@ -295,15 +295,12 @@ SortColl_Collect_IMP(SortCollector *self, int32_t doc_id) {
for (uint32_t i = 0, max = ivars->num_rules; i < max; i++) {
SortCache *cache = ivars->sort_caches[i];
- Obj *old_val = (Obj*)VA_Delete(values, i);
+ Obj *old_val = VA_Delete(values, i);
+ DECREF(old_val);
if (cache) {
int32_t ord = SortCache_Ordinal(cache, doc_id);
- Obj *blank = old_val
- ? old_val
- : SortCache_Make_Blank(cache);
- Obj *val = SortCache_Value(cache, ord, blank);
+ Obj *val = SortCache_Value(cache, ord);
if (val) { VA_Store(values, i, (Obj*)val); }
- else { DECREF(blank); }
}
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/core/Lucy/Search/RangeQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.c b/core/Lucy/Search/RangeQuery.c
index cbc5b74..a208213 100644
--- a/core/Lucy/Search/RangeQuery.c
+++ b/core/Lucy/Search/RangeQuery.c
@@ -279,8 +279,7 @@ S_find_lower_bound(RangeCompiler *self, SortCache *sort_cache) {
lower_bound = 0;
}
else {
- Obj *value = SortCache_Make_Blank(sort_cache);
- Obj *low_found = SortCache_Value(sort_cache, low_ord, value);
+ Obj *low_found = SortCache_Value(sort_cache, low_ord);
bool exact_match = low_found == NULL
? false
: Obj_Equals(lower_term, low_found);
@@ -289,7 +288,7 @@ S_find_lower_bound(RangeCompiler *self, SortCache *sort_cache) {
if (!exact_match || !RangeQuery_IVARS(parent)->include_lower) {
lower_bound++;
}
- DECREF(value);
+ DECREF(low_found);
}
}
@@ -309,8 +308,7 @@ S_find_upper_bound(RangeCompiler *self, SortCache *sort_cache) {
retval = -1;
}
else {
- Obj *value = SortCache_Make_Blank(sort_cache);
- Obj *hi_found = SortCache_Value(sort_cache, hi_ord, value);
+ Obj *hi_found = SortCache_Value(sort_cache, hi_ord);
bool exact_match = hi_found == NULL
? false
: Obj_Equals(upper_term, (Obj*)hi_found);
@@ -319,7 +317,7 @@ S_find_upper_bound(RangeCompiler *self, SortCache *sort_cache) {
if (exact_match && !RangeQuery_IVARS(parent)->include_upper) {
retval--;
}
- DECREF(value);
+ DECREF(hi_found);
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f042ed32/perl/buildlib/Lucy/Build/Binding/Index.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Index.pm b/perl/buildlib/Lucy/Build/Binding/Index.pm
index ac31d09..b02f299 100644
--- a/perl/buildlib/Lucy/Build/Binding/Index.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Index.pm
@@ -936,10 +936,9 @@ CODE:
CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error()));
}
{
- cfish_Obj *blank = LUCY_SortCache_Make_Blank(self);
- cfish_Obj *value = LUCY_SortCache_Value(self, ord, blank);
+ cfish_Obj *value = LUCY_SortCache_Value(self, ord);
RETVAL = XSBind_cfish_to_perl(value);
- CFISH_DECREF(blank);
+ CFISH_DECREF(value);
}
}
OUTPUT: RETVAL
[lucy-commits] [41/50] [abbrv] git commit: refs/heads/master - Convert 'const Obj'
to 'Obj'
Posted by nw...@apache.org.
Convert 'const Obj' to 'Obj'
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f3e6ed64
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f3e6ed64
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f3e6ed64
Branch: refs/heads/master
Commit: f3e6ed642f21af9b6bdb9b29dae8160cb3ef5abd
Parents: bb0fff5
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 30 22:46:48 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/Hash.c | 10 +++++-----
clownfish/runtime/core/Clownfish/Hash.cfh | 6 +++---
core/Lucy/Search/TermQuery.c | 4 ++--
core/Lucy/Search/TermQuery.cfh | 4 ++--
4 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/f3e6ed64/clownfish/runtime/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.c b/clownfish/runtime/core/Clownfish/Hash.c
index fd78864..ed6cb6f 100644
--- a/clownfish/runtime/core/Clownfish/Hash.c
+++ b/clownfish/runtime/core/Clownfish/Hash.c
@@ -48,7 +48,7 @@ SI_kill_iter(Hash *self);
// Return the entry associated with the key, if any.
static CFISH_INLINE HashEntry*
-SI_fetch_entry(Hash *self, const Obj *key, int32_t hash_sum);
+SI_fetch_entry(Hash *self, Obj *key, int32_t hash_sum);
// Double the number of buckets and redistribute all entries.
static CFISH_INLINE HashEntry*
@@ -179,7 +179,7 @@ Hash_Fetch_Utf8_IMP(Hash *self, const char *key, size_t key_len) {
}
static CFISH_INLINE HashEntry*
-SI_fetch_entry(Hash *self, const Obj *key, int32_t hash_sum) {
+SI_fetch_entry(Hash *self, Obj *key, int32_t hash_sum) {
uint32_t tick = hash_sum;
HashEntry *const entries = (HashEntry*)self->entries;
HashEntry *entry;
@@ -201,13 +201,13 @@ SI_fetch_entry(Hash *self, const Obj *key, int32_t hash_sum) {
}
Obj*
-Hash_Fetch_IMP(Hash *self, const Obj *key) {
+Hash_Fetch_IMP(Hash *self, Obj *key) {
HashEntry *entry = SI_fetch_entry(self, key, Obj_Hash_Sum(key));
return entry ? entry->value : NULL;
}
Obj*
-Hash_Delete_IMP(Hash *self, const Obj *key) {
+Hash_Delete_IMP(Hash *self, Obj *key) {
HashEntry *entry = SI_fetch_entry(self, key, Obj_Hash_Sum(key));
if (entry) {
Obj *value = entry->value;
@@ -265,7 +265,7 @@ Hash_Next_IMP(Hash *self, Obj **key, Obj **value) {
}
Obj*
-Hash_Find_Key_IMP(Hash *self, const Obj *key, int32_t hash_sum) {
+Hash_Find_Key_IMP(Hash *self, Obj *key, int32_t hash_sum) {
HashEntry *entry = SI_fetch_entry(self, key, hash_sum);
return entry ? entry->key : NULL;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f3e6ed64/clownfish/runtime/core/Clownfish/Hash.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.cfh b/clownfish/runtime/core/Clownfish/Hash.cfh
index 5f289fd..afa1904 100644
--- a/clownfish/runtime/core/Clownfish/Hash.cfh
+++ b/clownfish/runtime/core/Clownfish/Hash.cfh
@@ -65,7 +65,7 @@ class Clownfish::Hash inherits Clownfish::Obj {
* @return the value, or NULL if <code>key</code> is not present.
*/
nullable Obj*
- Fetch(Hash *self, const Obj *key);
+ Fetch(Hash *self, Obj *key);
nullable Obj*
Fetch_Utf8(Hash *self, const char *key, size_t key_len);
@@ -76,7 +76,7 @@ class Clownfish::Hash inherits Clownfish::Obj {
* succeeds; otherwise NULL.
*/
incremented nullable Obj*
- Delete(Hash *self, const Obj *key);
+ Delete(Hash *self, Obj *key);
incremented nullable Obj*
Delete_Utf8(Hash *self, const char *key, size_t key_ley);
@@ -101,7 +101,7 @@ class Clownfish::Hash inherits Clownfish::Obj {
* rather than its value.
*/
nullable Obj*
- Find_Key(Hash *self, const Obj *key, int32_t hash_sum);
+ Find_Key(Hash *self, Obj *key, int32_t hash_sum);
/** Return an VArray of pointers to the hash's keys.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/f3e6ed64/core/Lucy/Search/TermQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.c b/core/Lucy/Search/TermQuery.c
index 913d6a5..38db59a 100644
--- a/core/Lucy/Search/TermQuery.c
+++ b/core/Lucy/Search/TermQuery.c
@@ -35,13 +35,13 @@
#include "Lucy/Util/Freezer.h"
TermQuery*
-TermQuery_new(String *field, const Obj *term) {
+TermQuery_new(String *field, Obj *term) {
TermQuery *self = (TermQuery*)VTable_Make_Obj(TERMQUERY);
return TermQuery_init(self, field, term);
}
TermQuery*
-TermQuery_init(TermQuery *self, String *field, const Obj *term) {
+TermQuery_init(TermQuery *self, String *field, Obj *term) {
Query_init((Query*)self, 1.0f);
TermQueryIVARS *const ivars = TermQuery_IVARS(self);
ivars->field = Str_Clone(field);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f3e6ed64/core/Lucy/Search/TermQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.cfh b/core/Lucy/Search/TermQuery.cfh
index a59b4c6..cbdd42c 100644
--- a/core/Lucy/Search/TermQuery.cfh
+++ b/core/Lucy/Search/TermQuery.cfh
@@ -29,14 +29,14 @@ public class Lucy::Search::TermQuery inherits Lucy::Search::Query {
Obj *term;
inert incremented TermQuery*
- new(String *field, const Obj *term);
+ new(String *field, Obj *term);
/**
* @param field Field name.
* @param term Term text.
*/
public inert TermQuery*
- init(TermQuery *self, String *field, const Obj *term);
+ init(TermQuery *self, String *field, Obj *term);
/** Accessor for object's <code>field</code> member.
*/
[lucy-commits] [24/50] [abbrv] git commit: refs/heads/master - Replace
*_Dec_RefCount with DECREF
Posted by nw...@apache.org.
Replace *_Dec_RefCount with DECREF
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/5d560596
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/5d560596
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/5d560596
Branch: refs/heads/master
Commit: 5d56059699e5f73bd8892075f85d27ab3aee5a02
Parents: fbcf77c
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri May 10 18:51:46 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:17 2013 +0200
----------------------------------------------------------------------
core/Lucy/Index/Snapshot.c | 2 +-
core/Lucy/Index/SortCache/NumericSortCache.c | 4 ++--
core/Lucy/Index/SortCache/TextSortCache.c | 6 +++---
core/Lucy/Index/SortReader.c | 8 ++++----
core/Lucy/Search/PolyQuery.c | 2 +-
core/Lucy/Store/CompoundFileReader.c | 4 ++--
core/Lucy/Store/RAMDirHandle.c | 4 ++--
7 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/5d560596/core/Lucy/Index/Snapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Snapshot.c b/core/Lucy/Index/Snapshot.c
index a8b2afe..fd9f546 100644
--- a/core/Lucy/Index/Snapshot.c
+++ b/core/Lucy/Index/Snapshot.c
@@ -70,7 +70,7 @@ Snapshot_Delete_Entry_IMP(Snapshot *self, const String *entry) {
SnapshotIVARS *const ivars = Snapshot_IVARS(self);
Obj *val = Hash_Delete(ivars->entries, (Obj*)entry);
if (val) {
- Obj_Dec_RefCount(val);
+ DECREF(val);
return true;
}
else {
http://git-wip-us.apache.org/repos/asf/lucy/blob/5d560596/core/Lucy/Index/SortCache/NumericSortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/NumericSortCache.c b/core/Lucy/Index/SortCache/NumericSortCache.c
index 7241e6f..fe35359 100644
--- a/core/Lucy/Index/SortCache/NumericSortCache.c
+++ b/core/Lucy/Index/SortCache/NumericSortCache.c
@@ -70,11 +70,11 @@ NumSortCache_Destroy_IMP(NumericSortCache *self) {
NumericSortCacheIVARS *const ivars = NumSortCache_IVARS(self);
if (ivars->ord_in) {
InStream_Close(ivars->ord_in);
- InStream_Dec_RefCount(ivars->ord_in);
+ DECREF(ivars->ord_in);
}
if (ivars->dat_in) {
InStream_Close(ivars->dat_in);
- InStream_Dec_RefCount(ivars->dat_in);
+ DECREF(ivars->dat_in);
}
SUPER_DESTROY(self, NUMERICSORTCACHE);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/5d560596/core/Lucy/Index/SortCache/TextSortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/TextSortCache.c b/core/Lucy/Index/SortCache/TextSortCache.c
index ad533a4..b96c49f 100644
--- a/core/Lucy/Index/SortCache/TextSortCache.c
+++ b/core/Lucy/Index/SortCache/TextSortCache.c
@@ -73,15 +73,15 @@ TextSortCache_Destroy_IMP(TextSortCache *self) {
TextSortCacheIVARS *const ivars = TextSortCache_IVARS(self);
if (ivars->ord_in) {
InStream_Close(ivars->ord_in);
- InStream_Dec_RefCount(ivars->ord_in);
+ DECREF(ivars->ord_in);
}
if (ivars->ix_in) {
InStream_Close(ivars->ix_in);
- InStream_Dec_RefCount(ivars->ix_in);
+ DECREF(ivars->ix_in);
}
if (ivars->dat_in) {
InStream_Close(ivars->dat_in);
- InStream_Dec_RefCount(ivars->dat_in);
+ DECREF(ivars->dat_in);
}
SUPER_DESTROY(self, TEXTSORTCACHE);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/5d560596/core/Lucy/Index/SortReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortReader.c b/core/Lucy/Index/SortReader.c
index 2958422..28b55f0 100644
--- a/core/Lucy/Index/SortReader.c
+++ b/core/Lucy/Index/SortReader.c
@@ -118,19 +118,19 @@ void
DefSortReader_Close_IMP(DefaultSortReader *self) {
DefaultSortReaderIVARS *const ivars = DefSortReader_IVARS(self);
if (ivars->caches) {
- Hash_Dec_RefCount(ivars->caches);
+ DECREF(ivars->caches);
ivars->caches = NULL;
}
if (ivars->counts) {
- Hash_Dec_RefCount(ivars->counts);
+ DECREF(ivars->counts);
ivars->counts = NULL;
}
if (ivars->null_ords) {
- Hash_Dec_RefCount(ivars->null_ords);
+ DECREF(ivars->null_ords);
ivars->null_ords = NULL;
}
if (ivars->ord_widths) {
- Hash_Dec_RefCount(ivars->ord_widths);
+ DECREF(ivars->ord_widths);
ivars->ord_widths = NULL;
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/5d560596/core/Lucy/Search/PolyQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.c b/core/Lucy/Search/PolyQuery.c
index 8e85af9..6d74c35 100644
--- a/core/Lucy/Search/PolyQuery.c
+++ b/core/Lucy/Search/PolyQuery.c
@@ -194,7 +194,7 @@ PolyCompiler_Highlight_Spans_IMP(PolyCompiler *self, Searcher *searcher,
doc_vec, field);
if (child_spans) {
VA_Push_VArray(spans, child_spans);
- VA_Dec_RefCount(child_spans);
+ DECREF(child_spans);
}
}
return spans;
http://git-wip-us.apache.org/repos/asf/lucy/blob/5d560596/core/Lucy/Store/CompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c
index 8ee59c7..86307c3 100644
--- a/core/Lucy/Store/CompoundFileReader.c
+++ b/core/Lucy/Store/CompoundFileReader.c
@@ -299,11 +299,11 @@ bool
CFReaderDH_Close_IMP(CFReaderDirHandle *self) {
CFReaderDirHandleIVARS *const ivars = CFReaderDH_IVARS(self);
if (ivars->elems) {
- VA_Dec_RefCount(ivars->elems);
+ DECREF(ivars->elems);
ivars->elems = NULL;
}
if (ivars->cf_reader) {
- CFReader_Dec_RefCount(ivars->cf_reader);
+ DECREF(ivars->cf_reader);
ivars->cf_reader = NULL;
}
return true;
http://git-wip-us.apache.org/repos/asf/lucy/blob/5d560596/core/Lucy/Store/RAMDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMDirHandle.c b/core/Lucy/Store/RAMDirHandle.c
index 993f741..39caf05 100644
--- a/core/Lucy/Store/RAMDirHandle.c
+++ b/core/Lucy/Store/RAMDirHandle.c
@@ -42,11 +42,11 @@ bool
RAMDH_Close_IMP(RAMDirHandle *self) {
RAMDirHandleIVARS *const ivars = RAMDH_IVARS(self);
if (ivars->elems) {
- VA_Dec_RefCount(ivars->elems);
+ DECREF(ivars->elems);
ivars->elems = NULL;
}
if (ivars->folder) {
- RAMFolder_Dec_RefCount(ivars->folder);
+ DECREF(ivars->folder);
ivars->folder = NULL;
}
return true;
[lucy-commits] [45/50] [abbrv] git commit: refs/heads/master - Missing #include in C
sample program
Posted by nw...@apache.org.
Missing #include in C sample program
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/02320355
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/02320355
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/02320355
Branch: refs/heads/master
Commit: 023203551deebee1eba08507c6b2f7e3448dcb46
Parents: 94b9ae4
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Oct 4 12:58:43 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200
----------------------------------------------------------------------
c/sample/getting_started.c | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/02320355/c/sample/getting_started.c
----------------------------------------------------------------------
diff --git a/c/sample/getting_started.c b/c/sample/getting_started.c
index 10093b8..16f9159 100644
--- a/c/sample/getting_started.c
+++ b/c/sample/getting_started.c
@@ -28,6 +28,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#define CFISH_USE_SHORT_NAMES
[lucy-commits] [18/50] [abbrv] git commit: refs/heads/master - Convert
Str_Swap_Chars to immutable strings
Posted by nw...@apache.org.
Convert Str_Swap_Chars to immutable strings
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e47845a0
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e47845a0
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e47845a0
Branch: refs/heads/master
Commit: e47845a04f3d5c43c9ed756ac33b9fda1def3b75
Parents: ee999eb
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 14 14:43:40 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:16 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 28 +++++++-------------
clownfish/runtime/core/Clownfish/String.cfh | 7 ++---
.../runtime/core/Clownfish/Test/TestString.c | 21 ++++++++++++---
core/Lucy/Store/FSFolder.c | 9 +++++--
4 files changed, 39 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/e47845a0/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index ef98320..d39f271 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -161,28 +161,20 @@ Str_To_String_IMP(String *self) {
return Str_new_from_trusted_utf8(self->ptr, self->size);
}
-int32_t
+String*
Str_Swap_Chars_IMP(String *self, uint32_t match, uint32_t replacement) {
- int32_t num_swapped = 0;
+ CharBuf *charbuf = CB_new(self->size);
+ StackStringIterator *iter = STR_STACKTOP(self);
+ uint32_t code_point;
- if (match > 127) {
- THROW(ERR, "match point too high: %u32", match);
- }
- else if (replacement > 127) {
- THROW(ERR, "replacement code point too high: %u32", replacement);
- }
- else {
- char *ptr = self->ptr;
- char *const limit = ptr + self->size;
- for (; ptr < limit; ptr++) {
- if (*ptr == (char)match) {
- *ptr = (char)replacement;
- num_swapped++;
- }
- }
+ while (STRITER_DONE != (code_point = SStrIter_Next(iter))) {
+ if (code_point == match) { code_point = replacement; }
+ CB_Cat_Char(charbuf, code_point);
}
- return num_swapped;
+ String *retval = CB_Yield_String(charbuf);
+ DECREF(charbuf);
+ return retval;
}
int64_t
http://git-wip-us.apache.org/repos/asf/lucy/blob/e47845a0/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index f49ddd2..ee78652 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -105,10 +105,11 @@ class Clownfish::String cnick Str
incremented String*
Cat_Trusted_UTF8(String *self, const char *ptr, size_t size);
- /** Replace all instances of one character for the other. For now, both
- * the source and replacement code points must be ASCII.
+ /** Replace all instances of one character for the other.
+ *
+ * @return a new String with the characters replaced.
*/
- int32_t
+ incremented String*
Swap_Chars(String *self, uint32_t match, uint32_t replacement);
public int64_t
http://git-wip-us.apache.org/repos/asf/lucy/blob/e47845a0/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 31143fc..daecdc6 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestString.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestString.c
@@ -35,6 +35,7 @@
static char smiley[] = { (char)0xE2, (char)0x98, (char)0xBA, 0 };
static uint32_t smiley_len = 3;
+static uint32_t smiley_cp = 0x263A;
TestString*
TestStr_new() {
@@ -60,7 +61,7 @@ S_smiley_with_whitespace(int *num_spaces_ptr) {
CharBuf *buf = CB_new(0);
for (int i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
- CB_Cat_Char(buf, 0x263A);
+ CB_Cat_Char(buf, smiley_cp);
for (int i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
String *retval = CB_To_String(buf);
@@ -138,7 +139,9 @@ test_Find(TestBatchRunner *runner) {
static void
test_Code_Point_At_and_From(TestBatchRunner *runner) {
- uint32_t code_points[] = { 'a', 0x263A, 0x263A, 'b', 0x263A, 'c' };
+ uint32_t code_points[] = {
+ 'a', smiley_cp, smiley_cp, 'b', smiley_cp, 'c'
+ };
uint32_t num_code_points = sizeof(code_points) / sizeof(uint32_t);
String *string = Str_newf("a%s%sb%sc", smiley, smiley, smiley);
uint32_t i;
@@ -289,6 +292,17 @@ test_Compare_To(TestBatchRunner *runner) {
}
static void
+test_Swap_Chars(TestBatchRunner *runner) {
+ String *source = S_get_str("aXXbXc");
+ String *got = Str_Swap_Chars(source, 'X', smiley_cp);
+ String *wanted = Str_newf("a%s%sb%sc", smiley, smiley, smiley);
+ TEST_TRUE(runner, Str_Equals(got, (Obj*)wanted), "Swap_Chars");
+ DECREF(wanted);
+ DECREF(got);
+ DECREF(source);
+}
+
+static void
test_iterator(TestBatchRunner *runner) {
static const uint32_t code_points[] = {
0x41,
@@ -481,7 +495,7 @@ test_iterator_substring(TestBatchRunner *runner) {
void
TestStr_Run_IMP(TestString *self, TestBatchRunner *runner) {
- TestBatchRunner_Plan(runner, (TestBatch*)self, 99);
+ TestBatchRunner_Plan(runner, (TestBatch*)self, 100);
test_Cat(runner);
test_Clone(runner);
test_Code_Point_At_and_From(runner);
@@ -492,6 +506,7 @@ TestStr_Run_IMP(TestString *self, TestBatchRunner *runner) {
test_To_I64(runner);
test_Length(runner);
test_Compare_To(runner);
+ test_Swap_Chars(runner);
test_iterator(runner);
test_iterator_whitespace(runner);
test_iterator_substring(runner);
http://git-wip-us.apache.org/repos/asf/lucy/blob/e47845a0/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index e923d33..cdb353c 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -270,10 +270,15 @@ static String*
S_fullpath(FSFolder *self, const String *path) {
FSFolderIVARS *const ivars = FSFolder_IVARS(self);
String *fullpath = Str_newf("%o%s%o", ivars->path, DIR_SEP, path);
+ String *retval;
if (DIR_SEP[0] != '/') {
- Str_Swap_Chars(fullpath, '/', DIR_SEP[0]);
+ retval = Str_Swap_Chars(fullpath, '/', DIR_SEP[0]);
+ DECREF(fullpath);
+ }
+ else {
+ retval = fullpath;
}
- return fullpath;
+ return retval;
}
static bool
[lucy-commits] [29/50] [abbrv] git commit: refs/heads/master - Add core String test
to Clownfish Perl bindings
Posted by nw...@apache.org.
Add core String test to Clownfish Perl bindings
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/84ce63e6
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/84ce63e6
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/84ce63e6
Branch: refs/heads/master
Commit: 84ce63e6e53fd30c1c88da2d6c3f6f4205ca1b8f
Parents: a49e0d4
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 16:06:59 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:18 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/perl/t/core/023-string.t | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/84ce63e6/clownfish/runtime/perl/t/core/023-string.t
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/t/core/023-string.t b/clownfish/runtime/perl/t/core/023-string.t
new file mode 100644
index 0000000..d2836ff
--- /dev/null
+++ b/clownfish/runtime/perl/t/core/023-string.t
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use strict;
+use warnings;
+
+use Clownfish::Test;
+my $success = Clownfish::Test::run_tests("Clownfish::Test::TestString");
+
+exit($success ? 0 : 1);
+
[lucy-commits] [05/50] [abbrv] git commit: refs/heads/master - Eliminate
ViewCB_Assign in Index::Inverter
Posted by nw...@apache.org.
Eliminate ViewCB_Assign in Index::Inverter
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/062c39b2
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/062c39b2
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/062c39b2
Branch: refs/heads/master
Commit: 062c39b2689a1551c37062ca0f1124d88422a63f
Parents: 522588c
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Sep 8 12:11:15 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:13 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Index/Inverter.c | 8 +++-----
core/Lucy/Index/Inverter.c | 8 ++++----
perl/xs/Lucy/Index/Inverter.c | 7 ++++---
3 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/062c39b2/c/src/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/Inverter.c b/c/src/Lucy/Index/Inverter.c
index 99b5579..b5882c2 100644
--- a/c/src/Lucy/Index/Inverter.c
+++ b/c/src/Lucy/Index/Inverter.c
@@ -80,11 +80,9 @@ Inverter_Invert_Doc_IMP(Inverter *self, Doc *doc) {
// Get the field value.
switch (FType_Primitive_ID(type) & FType_PRIMITIVE_ID_MASK) {
case FType_TEXT: {
- String *char_buf
- = (String*)CERTIFY(obj, STRING);
- ViewCharBuf *value
- = (ViewCharBuf*)inventry_ivars->value;
- ViewCB_Assign(value, char_buf);
+ String *string = (String*)CERTIFY(obj, STRING);
+ DECREF(inventry_ivars->value);
+ inventry_ivars->value = INCREF(string);
break;
}
case FType_BLOB: {
http://git-wip-us.apache.org/repos/asf/lucy/blob/062c39b2/core/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Inverter.c b/core/Lucy/Index/Inverter.c
index 3c70742..0147732 100644
--- a/core/Lucy/Index/Inverter.c
+++ b/core/Lucy/Index/Inverter.c
@@ -164,9 +164,9 @@ Inverter_Add_Field_IMP(Inverter *self, InverterEntry *entry) {
Inversion_Invert(entry_ivars->inversion);
}
else if (entry_ivars->indexed || entry_ivars->highlightable) {
- ViewCharBuf *value = (ViewCharBuf*)entry_ivars->value;
- size_t token_len = ViewCB_Get_Size(value);
- Token *seed = Token_new((char*)ViewCB_Get_Ptr8(value),
+ String *value = (String*)entry_ivars->value;
+ size_t token_len = Str_Get_Size(value);
+ Token *seed = Token_new((char*)Str_Get_Ptr8(value),
token_len, 0, token_len, 1.0f, 1);
DECREF(entry_ivars->inversion);
entry_ivars->inversion = Inversion_new(seed);
@@ -215,7 +215,7 @@ InvEntry_init(InverterEntry *self, Schema *schema, const String *field,
uint8_t prim_id = FType_Primitive_ID(ivars->type);
switch (prim_id & FType_PRIMITIVE_ID_MASK) {
case FType_TEXT:
- ivars->value = (Obj*)ViewCB_new_from_trusted_utf8(NULL, 0);
+ ivars->value = NULL;
break;
case FType_BLOB:
ivars->value = (Obj*)ViewBB_new(NULL, 0);
http://git-wip-us.apache.org/repos/asf/lucy/blob/062c39b2/perl/xs/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c
index 093c1d4..67116e0 100644
--- a/perl/xs/Lucy/Index/Inverter.c
+++ b/perl/xs/Lucy/Index/Inverter.c
@@ -99,9 +99,10 @@ LUCY_Inverter_Invert_Doc_IMP(lucy_Inverter *self, lucy_Doc *doc) {
case lucy_FType_TEXT: {
STRLEN val_len;
char *val_ptr = SvPVutf8(value_sv, val_len);
- cfish_ViewCharBuf *value
- = (cfish_ViewCharBuf*)entry_ivars->value;
- CFISH_ViewCB_Assign_Str(value, val_ptr, val_len);
+ CFISH_DECREF(entry_ivars->value);
+ entry_ivars->value
+ = (cfish_Obj*)cfish_ViewCB_new_from_trusted_utf8(
+ val_ptr, val_len);
break;
}
case lucy_FType_BLOB: {
[lucy-commits] [14/50] [abbrv] git commit: refs/heads/master - Fix bulk renaming of
ZombieCharBuf
Posted by nw...@apache.org.
Fix bulk renaming of ZombieCharBuf
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/ee999eb6
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/ee999eb6
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/ee999eb6
Branch: refs/heads/master
Commit: ee999eb61bfa3ad924e307fceb33ddc548857d38
Parents: b0ddea3
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Sep 13 20:56:58 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:16 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCPerlTypeMap.c | 2 +-
clownfish/compiler/src/CFCRuby.c | 2 +-
clownfish/runtime/core/Clownfish/String.cfh | 12 ++++++------
.../runtime/perl/buildlib/Clownfish/Build/Binding.pm | 2 +-
clownfish/runtime/perl/xs/XSBind.c | 2 +-
core/Lucy/Store/Folder.c | 2 +-
core/Lucy/Test/Store/TestCompoundFileReader.c | 2 +-
core/Lucy/Test/Store/TestFolderCommon.c | 2 +-
core/Lucy/Test/Store/TestRAMFolder.c | 2 +-
perl/buildlib/Lucy/Build/Binding/Misc.pm | 2 +-
perl/xs/Lucy/Index/DocReader.c | 2 +-
perl/xs/Lucy/Index/Inverter.c | 2 +-
12 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/clownfish/compiler/src/CFCPerlTypeMap.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlTypeMap.c b/clownfish/compiler/src/CFCPerlTypeMap.c
index a50e013..f568e15 100644
--- a/clownfish/compiler/src/CFCPerlTypeMap.c
+++ b/clownfish/compiler/src/CFCPerlTypeMap.c
@@ -234,7 +234,7 @@ static const char typemap_input[] =
" $var = (sizeof(UV) == 8) ? ($type)SvUV($arg) : ($type)SvNV($arg);\n"
"\n"
"CONST_CHARBUF\n"
- " $var = (const cfish_String*)CFISH_SStr_WRAP_STR(SvPVutf8_nolen($arg), SvCUR($arg));\n"
+ " $var = (const cfish_String*)CFISH_SSTR_WRAP_STR(SvPVutf8_nolen($arg), SvCUR($arg));\n"
"\n";
static const char typemap_output[] =
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/clownfish/compiler/src/CFCRuby.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCRuby.c b/clownfish/compiler/src/CFCRuby.c
index 4b67022..b225fd9 100644
--- a/clownfish/compiler/src/CFCRuby.c
+++ b/clownfish/compiler/src/CFCRuby.c
@@ -205,7 +205,7 @@ S_write_boot_c(CFCRuby *self) {
"%s() {\n"
" %sbootstrap_parcel();\n"
"\n"
- " cfish_StackString *alias = CFISH_SStr_WRAP_STR(\"\", 0);\n"
+ " cfish_StackString *alias = CFISH_SSTR_WRAP_STR(\"\", 0);\n"
"}\n"
"\n"
"%s\n"
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index d54f473..f49ddd2 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -423,20 +423,20 @@ class Clownfish::StackStringIterator cnick SStrIter
__C__
-#define CFISH_SStr_BLANK() cfish_SStr_new(cfish_alloca(cfish_SStr_size()))
+#define CFISH_SSTR_BLANK() cfish_SStr_new(cfish_alloca(cfish_SStr_size()))
-#define CFISH_SStr_WRAP(source) \
+#define CFISH_SSTR_WRAP(source) \
cfish_SStr_wrap(cfish_alloca(cfish_SStr_size()), source)
-#define CFISH_SStr_WRAP_STR(ptr, size) \
+#define CFISH_SSTR_WRAP_STR(ptr, size) \
cfish_SStr_wrap_str(cfish_alloca(cfish_SStr_size()), ptr, size)
#define CFISH_STRITER_DONE UINT32_MAX
#ifdef CFISH_USE_SHORT_NAMES
- #define SStr_BLANK CFISH_SStr_BLANK
- #define SSTR_WRAP CFISH_SStr_WRAP
- #define SSTR_WRAP_STR CFISH_SStr_WRAP_STR
+ #define SSTR_BLANK CFISH_SSTR_BLANK
+ #define SSTR_WRAP CFISH_SSTR_WRAP
+ #define SSTR_WRAP_STR CFISH_SSTR_WRAP_STR
#define STRITER_DONE CFISH_STRITER_DONE
#endif
__END_C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/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 5edf4c0..2d7ef0e 100644
--- a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -594,7 +594,7 @@ CODE:
CFISH_UNUSED_VAR(unused_sv);
STRLEN size;
char *ptr = SvPVutf8(class_name_sv, size);
- cfish_StackString *class_name = CFISH_SStr_WRAP_STR(ptr, size);
+ cfish_StackString *class_name = CFISH_SSTR_WRAP_STR(ptr, size);
cfish_VTable *vtable
= cfish_VTable_fetch_vtable((cfish_String*)class_name);
RETVAL = vtable ? (SV*)CFISH_VTable_To_Host(vtable) : &PL_sv_undef;
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index b466cf6..39d65d8 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -64,7 +64,7 @@ XSBind_new_blank_obj(SV *either_sv) {
// Use the supplied class name string to find a VTable.
STRLEN len;
char *ptr = SvPVutf8(either_sv, len);
- cfish_StackString *klass = CFISH_SStr_WRAP_STR(ptr, len);
+ cfish_StackString *klass = CFISH_SSTR_WRAP_STR(ptr, len);
vtable = cfish_VTable_singleton((cfish_String*)klass, NULL);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index c002e9d..9d7bb46 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -262,7 +262,7 @@ Folder_Open_Dir_IMP(Folder *self, const String *path) {
folder = Folder_Find_Folder(self, path);
}
else {
- StackString *empty = SStr_BLANK();
+ StackString *empty = SSTR_BLANK();
folder = Folder_Find_Folder(self, (String*)empty);
}
if (!folder) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/core/Lucy/Test/Store/TestCompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestCompoundFileReader.c b/core/Lucy/Test/Store/TestCompoundFileReader.c
index d28075b..bb7eb89 100644
--- a/core/Lucy/Test/Store/TestCompoundFileReader.c
+++ b/core/Lucy/Test/Store/TestCompoundFileReader.c
@@ -78,7 +78,7 @@ S_folder_with_contents() {
OutStream_Close(bar_out);
DECREF(foo_out);
DECREF(bar_out);
- StackString *empty = SStr_BLANK();
+ StackString *empty = SSTR_BLANK();
RAMFolder_Consolidate(folder, (String*)empty);
return (Folder*)folder;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/core/Lucy/Test/Store/TestFolderCommon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFolderCommon.c b/core/Lucy/Test/Store/TestFolderCommon.c
index f137544..ce13170 100644
--- a/core/Lucy/Test/Store/TestFolderCommon.c
+++ b/core/Lucy/Test/Store/TestFolderCommon.c
@@ -137,7 +137,7 @@ test_Local_Find_Folder(TestBatchRunner *runner, set_up_t set_up,
local = Folder_Local_Find_Folder(folder, nope);
TEST_TRUE(runner, local == NULL, "Non-existent entry yields NULL");
- StackString *empty = SStr_BLANK();
+ StackString *empty = SSTR_BLANK();
local = Folder_Local_Find_Folder(folder, (String*)empty);
TEST_TRUE(runner, local == NULL, "Empty string yields NULL");
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/core/Lucy/Test/Store/TestRAMFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestRAMFolder.c b/core/Lucy/Test/Store/TestRAMFolder.c
index e712697..13aeb9d 100644
--- a/core/Lucy/Test/Store/TestRAMFolder.c
+++ b/core/Lucy/Test/Store/TestRAMFolder.c
@@ -139,7 +139,7 @@ test_Local_Find_Folder(TestBatchRunner *runner) {
local = (RAMFolder*)RAMFolder_Local_Find_Folder(folder, nope);
TEST_TRUE(runner, local == NULL, "Non-existent entry yields NULL");
- StackString *empty = SStr_BLANK();
+ StackString *empty = SSTR_BLANK();
local = (RAMFolder*)RAMFolder_Local_Find_Folder(folder, (String*)empty);
TEST_TRUE(runner, local == NULL, "Empty string yields NULL");
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/perl/buildlib/Lucy/Build/Binding/Misc.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm
index 287ef18..6f082bc 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -141,7 +141,7 @@ PPCODE:
{
char *class_name = HvNAME(SvSTASH(SvRV(blank_obj)));
cfish_StackString *klass
- = CFISH_SStr_WRAP_STR(class_name, strlen(class_name));
+ = CFISH_SSTR_WRAP_STR(class_name, strlen(class_name));
cfish_VTable *vtable
= (cfish_VTable*)cfish_VTable_singleton((cfish_String*)klass, NULL);
STRLEN len;
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/perl/xs/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/DocReader.c b/perl/xs/Lucy/Index/DocReader.c
index 0f95a11..15eafe1 100644
--- a/perl/xs/Lucy/Index/DocReader.c
+++ b/perl/xs/Lucy/Index/DocReader.c
@@ -62,7 +62,7 @@ LUCY_DefDocReader_Fetch_Doc_IMP(lucy_DefaultDocReader *self, int32_t doc_id) {
// Find the Field's FieldType.
cfish_StackString *field_name_zcb
- = CFISH_SStr_WRAP_STR(field_name_ptr, field_name_len);
+ = CFISH_SSTR_WRAP_STR(field_name_ptr, field_name_len);
type = LUCY_Schema_Fetch_Type(schema, (cfish_String*)field_name_zcb);
// Read the field value.
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee999eb6/perl/xs/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c
index 67116e0..1d120b1 100644
--- a/perl/xs/Lucy/Index/Inverter.c
+++ b/perl/xs/Lucy/Index/Inverter.c
@@ -50,7 +50,7 @@ S_fetch_entry(lucy_Inverter *self, HE *hash_entry) {
}
}
- cfish_StackString *field = CFISH_SStr_WRAP_STR(key, key_len);
+ cfish_StackString *field = CFISH_SSTR_WRAP_STR(key, key_len);
int32_t field_num
= LUCY_Seg_Field_Num(ivars->segment, (cfish_String*)field);
if (!field_num) {
[lucy-commits] [28/50] [abbrv] git commit: refs/heads/master - Optimize writing of
terms
Posted by nw...@apache.org.
Optimize writing of terms
* Make TextTermStepper#Write_* accept either Strings or CharBufs.
* Convert LexiconWriter#Add_Term to accept an Obj.
* Convert S_write_terms_and_postings in PostingPool to use a CharBuf
in order to avoid repeated String allocations.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/3e074440
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/3e074440
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/3e074440
Branch: refs/heads/master
Commit: 3e074440839039a928e72d3ee3319d1b75217354
Parents: 9bf27d9
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 21 15:25:32 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:18 2013 +0200
----------------------------------------------------------------------
core/Lucy/Index/LexiconWriter.c | 5 +++--
core/Lucy/Index/LexiconWriter.cfh | 2 +-
core/Lucy/Index/PostingPool.c | 20 ++++++++++----------
core/Lucy/Plan/TextType.c | 34 ++++++++++++++++++++++++----------
core/Lucy/Plan/TextType.cfh | 2 +-
5 files changed, 39 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/3e074440/core/Lucy/Index/LexiconWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexiconWriter.c b/core/Lucy/Index/LexiconWriter.c
index 5189c49..4253e67 100644
--- a/core/Lucy/Index/LexiconWriter.c
+++ b/core/Lucy/Index/LexiconWriter.c
@@ -18,6 +18,7 @@
#include "Lucy/Util/ToolSet.h"
#include "Lucy/Index/LexiconWriter.h"
+#include "Clownfish/CharBuf.h"
#include "Lucy/Plan/FieldType.h"
#include "Lucy/Plan/Schema.h"
#include "Lucy/Index/PolyReader.h"
@@ -104,7 +105,7 @@ S_add_last_term_to_ix(LexiconWriter *self) {
}
void
-LexWriter_Add_Term_IMP(LexiconWriter* self, String* term_text, TermInfo* tinfo) {
+LexWriter_Add_Term_IMP(LexiconWriter* self, Obj* term_text, TermInfo* tinfo) {
LexiconWriterIVARS *const ivars = LexWriter_IVARS(self);
OutStream *dat_out = ivars->dat_out;
@@ -115,7 +116,7 @@ LexWriter_Add_Term_IMP(LexiconWriter* self, String* term_text, TermInfo* tinfo)
S_add_last_term_to_ix(self);
}
- TermStepper_Write_Delta(ivars->term_stepper, dat_out, (Obj*)term_text);
+ TermStepper_Write_Delta(ivars->term_stepper, dat_out, term_text);
TermStepper_Write_Delta(ivars->tinfo_stepper, dat_out, (Obj*)tinfo);
// Track number of terms.
http://git-wip-us.apache.org/repos/asf/lucy/blob/3e074440/core/Lucy/Index/LexiconWriter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexiconWriter.cfh b/core/Lucy/Index/LexiconWriter.cfh
index 340e271..867120c 100644
--- a/core/Lucy/Index/LexiconWriter.cfh
+++ b/core/Lucy/Index/LexiconWriter.cfh
@@ -72,7 +72,7 @@ class Lucy::Index::LexiconWriter cnick LexWriter
* field number).
*/
void
- Add_Term(LexiconWriter* self, String* term_text, TermInfo* tinfo);
+ Add_Term(LexiconWriter* self, Obj* term_text, TermInfo* tinfo);
public void
Add_Segment(LexiconWriter *self, SegReader *reader,
http://git-wip-us.apache.org/repos/asf/lucy/blob/3e074440/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index a969fd5..a3e61c0 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -22,6 +22,7 @@
#include "Lucy/Util/ToolSet.h"
#include "Lucy/Index/PostingPool.h"
+#include "Clownfish/CharBuf.h"
#include "Lucy/Analysis/Inversion.h"
#include "Lucy/Plan/Architecture.h"
#include "Lucy/Plan/FieldType.h"
@@ -377,10 +378,10 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
(*(RawPosting**)PostPool_Fetch(self)),
RAWPOSTING);
RawPostingIVARS *post_ivars = RawPost_IVARS(posting);
- String *last_term_text
- = Str_new_from_utf8(post_ivars->blob, post_ivars->content_len);
- const char *last_text_buf = Str_Get_Ptr8(last_term_text);
- uint32_t last_text_size = Str_Get_Size(last_term_text);
+ CharBuf *last_term_text
+ = CB_new_from_trusted_utf8(post_ivars->blob, post_ivars->content_len);
+ const char *last_text_buf = CB_Get_Ptr8(last_term_text);
+ uint32_t last_text_size = CB_Get_Size(last_term_text);
SkipStepper_Set_ID_And_Filepos(skip_stepper, 0, 0);
// Initialize sentinel to be used on the last iter, using an empty string
@@ -413,7 +414,7 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
// If the term text changes, process the last term.
if (!same_text_as_last) {
// Hand off to LexiconWriter.
- LexWriter_Add_Term(lex_writer, last_term_text, tinfo);
+ LexWriter_Add_Term(lex_writer, (Obj*)last_term_text, tinfo);
// Start each term afresh.
TInfo_Reset(tinfo);
@@ -426,11 +427,10 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
last_skip_filepos = tinfo_ivars->post_filepos;
// Remember the term_text so we can write string diffs.
- DECREF(last_term_text);
- last_term_text
- = Str_new_from_utf8(post_ivars->blob, post_ivars->content_len);
- last_text_buf = Str_Get_Ptr8(last_term_text);
- last_text_size = Str_Get_Size(last_term_text);
+ CB_Mimic_Utf8(last_term_text, post_ivars->blob,
+ post_ivars->content_len);
+ last_text_buf = CB_Get_Ptr8(last_term_text);
+ last_text_size = CB_Get_Size(last_term_text);
}
// Bail on last iter before writing invalid posting data.
http://git-wip-us.apache.org/repos/asf/lucy/blob/3e074440/core/Lucy/Plan/TextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.c b/core/Lucy/Plan/TextType.c
index 487317c..675b51a 100644
--- a/core/Lucy/Plan/TextType.c
+++ b/core/Lucy/Plan/TextType.c
@@ -93,11 +93,12 @@ void
TextTermStepper_Write_Key_Frame_IMP(TextTermStepper *self,
OutStream *outstream, Obj *value) {
TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
- const char *buf = Str_Get_Ptr8((String*)value);
- size_t size = Str_Get_Size((String*)value);
+ CharBuf *charbuf = (CharBuf*)ivars->value;
+ CB_Mimic(charbuf, value);
+ const char *buf = CB_Get_Ptr8(charbuf);
+ size_t size = CB_Get_Size(charbuf);
OutStream_Write_C32(outstream, size);
OutStream_Write_Bytes(outstream, buf, size);
- Obj_Mimic(ivars->value, value);
// Invalidate string.
DECREF(ivars->string);
ivars->string = NULL;
@@ -107,12 +108,25 @@ void
TextTermStepper_Write_Delta_IMP(TextTermStepper *self, OutStream *outstream,
Obj *value) {
TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
- String *new_value = (String*)CERTIFY(value, STRING);
- CharBuf *last_value = (CharBuf*)ivars->value;
- const char *new_text = Str_Get_Ptr8(new_value);
- size_t new_size = Str_Get_Size(new_value);
- const char *last_text = CB_Get_Ptr8(last_value);
- size_t last_size = CB_Get_Size(last_value);
+ CharBuf *charbuf = (CharBuf*)ivars->value;
+ const char *last_text = CB_Get_Ptr8(charbuf);
+ size_t last_size = CB_Get_Size(charbuf);
+ const char *new_text = NULL;
+ size_t new_size = 0;
+
+ if (Obj_Is_A(value, STRING)) {
+ String *new_string = (String*)value;
+ new_text = Str_Get_Ptr8(new_string);
+ new_size = Str_Get_Size(new_string);
+ }
+ else if (Obj_Is_A(value, CHARBUF)) {
+ CharBuf *new_charbuf = (CharBuf*)value;
+ new_text = CB_Get_Ptr8(new_charbuf);
+ new_size = CB_Get_Size(new_charbuf);
+ }
+ else {
+ THROW(ERR, "'value' must be a String or CharBuf");
+ }
// Count how many bytes the strings share at the top.
const int32_t overlap = StrHelp_overlap(last_text, new_text,
@@ -125,7 +139,7 @@ TextTermStepper_Write_Delta_IMP(TextTermStepper *self, OutStream *outstream,
OutStream_Write_String(outstream, diff_start_str, diff_len);
// Update value.
- Obj_Mimic(ivars->value, value);
+ CB_Mimic_Utf8(charbuf, new_text, new_size);
// Invalidate string.
DECREF(ivars->string);
http://git-wip-us.apache.org/repos/asf/lucy/blob/3e074440/core/Lucy/Plan/TextType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.cfh b/core/Lucy/Plan/TextType.cfh
index 33b70ec..b2bf014 100644
--- a/core/Lucy/Plan/TextType.cfh
+++ b/core/Lucy/Plan/TextType.cfh
@@ -42,7 +42,7 @@ class Lucy::Index::TermStepper::TextTermStepper
Reset(TextTermStepper *self);
/**
- * @param value A String.
+ * @param value A String or CharBuf.
*/
public void
Set_Value(TextTermStepper *self, Obj *value = NULL);
[lucy-commits] [35/50] [abbrv] git commit: refs/heads/master - Fix Perl typemap for
non-const Strings
Posted by nw...@apache.org.
Fix Perl typemap for non-const Strings
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/5fcb13d9
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/5fcb13d9
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/5fcb13d9
Branch: refs/heads/master
Commit: 5fcb13d9321faf9816f6969b94ebb14e9d9904ab
Parents: be4e63b
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 17:08:15 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:19 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCPerlTypeMap.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/5fcb13d9/clownfish/compiler/src/CFCPerlTypeMap.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlTypeMap.c b/clownfish/compiler/src/CFCPerlTypeMap.c
index 6ce222f..32fbc53 100644
--- a/clownfish/compiler/src/CFCPerlTypeMap.c
+++ b/clownfish/compiler/src/CFCPerlTypeMap.c
@@ -275,10 +275,19 @@ CFCPerlTypeMap_write_xs_typemap(CFCHierarchy *hierarchy) {
start = CFCUtil_cat(start, full_struct_sym, "*\t", vtable_var, "_\n",
NULL);
+ const char *allocation;
+ if (strcmp(full_struct_sym, "cfish_String") == 0) {
+ // Share buffers rather than copy between Perl scalars and
+ // Clownfish string types.
+ allocation = "alloca(cfish_SStr_size())";
+ }
+ else {
+ allocation = "NULL";
+ }
input = CFCUtil_cat(input, vtable_var, "_\n"
" $var = (", full_struct_sym,
"*)XSBind_sv_to_cfish_obj($arg, ", vtable_var,
- ", NULL);\n\n", NULL);
+ ", ", allocation, ");\n\n", NULL);
output = CFCUtil_cat(output, vtable_var, "_\n"
" $arg = (SV*)CFISH_Obj_To_Host((cfish_Obj*)$var);\n"
[lucy-commits] [16/50] [abbrv] Rename _UTF8 and _Str to _Utf8
Posted by nw...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/SortReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortReader.c b/core/Lucy/Index/SortReader.c
index 7275621..2958422 100644
--- a/core/Lucy/Index/SortReader.c
+++ b/core/Lucy/Index/SortReader.c
@@ -63,12 +63,12 @@ DefSortReader_init(DefaultSortReader *self, Schema *schema, Folder *folder,
seg_tick);
DefaultSortReaderIVARS *const ivars = DefSortReader_IVARS(self);
Segment *segment = DefSortReader_Get_Segment(self);
- Hash *metadata = (Hash*)Seg_Fetch_Metadata_Str(segment, "sort", 4);
+ Hash *metadata = (Hash*)Seg_Fetch_Metadata_Utf8(segment, "sort", 4);
// Check format.
ivars->format = 0;
if (metadata) {
- Obj *format = Hash_Fetch_Str(metadata, "format", 6);
+ Obj *format = Hash_Fetch_Utf8(metadata, "format", 6);
if (!format) { THROW(ERR, "Missing 'format' var"); }
else {
ivars->format = (int32_t)Obj_To_I64(format);
@@ -86,9 +86,9 @@ DefSortReader_init(DefaultSortReader *self, Schema *schema, Folder *folder,
// hashes.
if (metadata) {
ivars->counts
- = (Hash*)INCREF(CERTIFY(Hash_Fetch_Str(metadata, "counts", 6),
+ = (Hash*)INCREF(CERTIFY(Hash_Fetch_Utf8(metadata, "counts", 6),
HASH));
- ivars->null_ords = (Hash*)Hash_Fetch_Str(metadata, "null_ords", 9);
+ ivars->null_ords = (Hash*)Hash_Fetch_Utf8(metadata, "null_ords", 9);
if (ivars->null_ords) {
CERTIFY(ivars->null_ords, HASH);
INCREF(ivars->null_ords);
@@ -96,7 +96,7 @@ DefSortReader_init(DefaultSortReader *self, Schema *schema, Folder *folder,
else {
ivars->null_ords = Hash_new(0);
}
- ivars->ord_widths = (Hash*)Hash_Fetch_Str(metadata, "ord_widths", 10);
+ ivars->ord_widths = (Hash*)Hash_Fetch_Utf8(metadata, "ord_widths", 10);
if (ivars->ord_widths) {
CERTIFY(ivars->ord_widths, HASH);
INCREF(ivars->ord_widths);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/SortWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortWriter.c b/core/Lucy/Index/SortWriter.c
index 3adf9de..fe1641c 100644
--- a/core/Lucy/Index/SortWriter.c
+++ b/core/Lucy/Index/SortWriter.c
@@ -236,8 +236,8 @@ SortWriter_Finish_IMP(SortWriter *self) {
VA_Clear(field_writers);
// Store metadata.
- Seg_Store_Metadata_Str(ivars->segment, "sort", 4,
- (Obj*)SortWriter_Metadata(self));
+ Seg_Store_Metadata_Utf8(ivars->segment, "sort", 4,
+ (Obj*)SortWriter_Metadata(self));
// Clean up.
Folder *folder = ivars->folder;
@@ -260,9 +260,9 @@ SortWriter_Metadata_IMP(SortWriter *self) {
= (SortWriter_Metadata_t)SUPER_METHOD_PTR(SORTWRITER,
LUCY_SortWriter_Metadata);
Hash *const metadata = super_meta(self);
- Hash_Store_Str(metadata, "counts", 6, INCREF(ivars->counts));
- Hash_Store_Str(metadata, "null_ords", 9, INCREF(ivars->null_ords));
- Hash_Store_Str(metadata, "ord_widths", 10, INCREF(ivars->ord_widths));
+ Hash_Store_Utf8(metadata, "counts", 6, INCREF(ivars->counts));
+ Hash_Store_Utf8(metadata, "null_ords", 9, INCREF(ivars->null_ords));
+ Hash_Store_Utf8(metadata, "ord_widths", 10, INCREF(ivars->ord_widths));
return metadata;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Plan/BlobType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/BlobType.c b/core/Lucy/Plan/BlobType.c
index 90ccc4f..5b94640 100644
--- a/core/Lucy/Plan/BlobType.c
+++ b/core/Lucy/Plan/BlobType.c
@@ -64,18 +64,18 @@ Hash*
BlobType_Dump_For_Schema_IMP(BlobType *self) {
BlobTypeIVARS *const ivars = BlobType_IVARS(self);
Hash *dump = Hash_new(0);
- Hash_Store_Str(dump, "type", 4, (Obj*)Str_newf("blob"));
+ Hash_Store_Utf8(dump, "type", 4, (Obj*)Str_newf("blob"));
// Store attributes that override the defaults -- even if they're
// meaningless.
if (ivars->boost != 1.0) {
- Hash_Store_Str(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
+ Hash_Store_Utf8(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
}
if (ivars->indexed) {
- Hash_Store_Str(dump, "indexed", 7, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(dump, "indexed", 7, (Obj*)CFISH_TRUE);
}
if (ivars->stored) {
- Hash_Store_Str(dump, "stored", 6, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(dump, "stored", 6, (Obj*)CFISH_TRUE);
}
return dump;
@@ -84,24 +84,24 @@ BlobType_Dump_For_Schema_IMP(BlobType *self) {
Hash*
BlobType_Dump_IMP(BlobType *self) {
Hash *dump = BlobType_Dump_For_Schema(self);
- Hash_Store_Str(dump, "_class", 6,
- (Obj*)Str_Clone(BlobType_Get_Class_Name(self)));
- DECREF(Hash_Delete_Str(dump, "type", 4));
+ Hash_Store_Utf8(dump, "_class", 6,
+ (Obj*)Str_Clone(BlobType_Get_Class_Name(self)));
+ DECREF(Hash_Delete_Utf8(dump, "type", 4));
return dump;
}
BlobType*
BlobType_Load_IMP(BlobType *self, Obj *dump) {
Hash *source = (Hash*)CERTIFY(dump, HASH);
- String *class_name = (String*)Hash_Fetch_Str(source, "_class", 6);
+ String *class_name = (String*)Hash_Fetch_Utf8(source, "_class", 6);
VTable *vtable
= (class_name != NULL && Obj_Is_A((Obj*)class_name, STRING))
? VTable_singleton(class_name, NULL)
: BLOBTYPE;
BlobType *loaded = (BlobType*)VTable_Make_Obj(vtable);
- Obj *boost_dump = Hash_Fetch_Str(source, "boost", 5);
- Obj *indexed_dump = Hash_Fetch_Str(source, "indexed", 7);
- Obj *stored_dump = Hash_Fetch_Str(source, "stored", 6);
+ Obj *boost_dump = Hash_Fetch_Utf8(source, "boost", 5);
+ Obj *indexed_dump = Hash_Fetch_Utf8(source, "indexed", 7);
+ Obj *stored_dump = Hash_Fetch_Utf8(source, "stored", 6);
UNUSED_VAR(self);
BlobType_init(loaded, false);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Plan/FullTextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/FullTextType.c b/core/Lucy/Plan/FullTextType.c
index 03fcb3e..30f2919 100644
--- a/core/Lucy/Plan/FullTextType.c
+++ b/core/Lucy/Plan/FullTextType.c
@@ -81,23 +81,23 @@ Hash*
FullTextType_Dump_For_Schema_IMP(FullTextType *self) {
FullTextTypeIVARS *const ivars = FullTextType_IVARS(self);
Hash *dump = Hash_new(0);
- Hash_Store_Str(dump, "type", 4, (Obj*)Str_newf("fulltext"));
+ Hash_Store_Utf8(dump, "type", 4, (Obj*)Str_newf("fulltext"));
// Store attributes that override the defaults.
if (ivars->boost != 1.0) {
- Hash_Store_Str(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
+ Hash_Store_Utf8(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
}
if (!ivars->indexed) {
- Hash_Store_Str(dump, "indexed", 7, (Obj*)CFISH_FALSE);
+ Hash_Store_Utf8(dump, "indexed", 7, (Obj*)CFISH_FALSE);
}
if (!ivars->stored) {
- Hash_Store_Str(dump, "stored", 6, (Obj*)CFISH_FALSE);
+ Hash_Store_Utf8(dump, "stored", 6, (Obj*)CFISH_FALSE);
}
if (ivars->sortable) {
- Hash_Store_Str(dump, "sortable", 8, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(dump, "sortable", 8, (Obj*)CFISH_TRUE);
}
if (ivars->highlightable) {
- Hash_Store_Str(dump, "highlightable", 13, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(dump, "highlightable", 13, (Obj*)CFISH_TRUE);
}
return dump;
@@ -107,11 +107,11 @@ Hash*
FullTextType_Dump_IMP(FullTextType *self) {
FullTextTypeIVARS *const ivars = FullTextType_IVARS(self);
Hash *dump = FullTextType_Dump_For_Schema(self);
- Hash_Store_Str(dump, "_class", 6,
- (Obj*)Str_Clone(FullTextType_Get_Class_Name(self)));
- Hash_Store_Str(dump, "analyzer", 8,
- (Obj*)Analyzer_Dump(ivars->analyzer));
- DECREF(Hash_Delete_Str(dump, "type", 4));
+ Hash_Store_Utf8(dump, "_class", 6,
+ (Obj*)Str_Clone(FullTextType_Get_Class_Name(self)));
+ Hash_Store_Utf8(dump, "analyzer", 8,
+ (Obj*)Analyzer_Dump(ivars->analyzer));
+ DECREF(Hash_Delete_Utf8(dump, "type", 4));
return dump;
}
@@ -120,7 +120,7 @@ FullTextType*
FullTextType_Load_IMP(FullTextType *self, Obj *dump) {
UNUSED_VAR(self);
Hash *source = (Hash*)CERTIFY(dump, HASH);
- String *class_name = (String*)Hash_Fetch_Str(source, "_class", 6);
+ String *class_name = (String*)Hash_Fetch_Utf8(source, "_class", 6);
VTable *vtable
= (class_name != NULL && Obj_Is_A((Obj*)class_name, STRING))
? VTable_singleton(class_name, NULL)
@@ -128,21 +128,21 @@ FullTextType_Load_IMP(FullTextType *self, Obj *dump) {
FullTextType *loaded = (FullTextType*)VTable_Make_Obj(vtable);
// Extract boost.
- Obj *boost_dump = Hash_Fetch_Str(source, "boost", 5);
+ Obj *boost_dump = Hash_Fetch_Utf8(source, "boost", 5);
float boost = boost_dump ? (float)Obj_To_F64(boost_dump) : 1.0f;
// Find boolean properties.
- Obj *indexed_dump = Hash_Fetch_Str(source, "indexed", 7);
- Obj *stored_dump = Hash_Fetch_Str(source, "stored", 6);
- Obj *sort_dump = Hash_Fetch_Str(source, "sortable", 8);
- Obj *hl_dump = Hash_Fetch_Str(source, "highlightable", 13);
+ Obj *indexed_dump = Hash_Fetch_Utf8(source, "indexed", 7);
+ Obj *stored_dump = Hash_Fetch_Utf8(source, "stored", 6);
+ Obj *sort_dump = Hash_Fetch_Utf8(source, "sortable", 8);
+ Obj *hl_dump = Hash_Fetch_Utf8(source, "highlightable", 13);
bool indexed = indexed_dump ? Obj_To_Bool(indexed_dump) : true;
bool stored = stored_dump ? Obj_To_Bool(stored_dump) : true;
bool sortable = sort_dump ? Obj_To_Bool(sort_dump) : false;
bool hl = hl_dump ? Obj_To_Bool(hl_dump) : false;
// Extract an Analyzer.
- Obj *analyzer_dump = Hash_Fetch_Str(source, "analyzer", 8);
+ Obj *analyzer_dump = Hash_Fetch_Utf8(source, "analyzer", 8);
Analyzer *analyzer = NULL;
if (analyzer_dump) {
if (Obj_Is_A(analyzer_dump, ANALYZER)) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Plan/NumericType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/NumericType.c b/core/Lucy/Plan/NumericType.c
index 6ccda7d..1d470d9 100644
--- a/core/Lucy/Plan/NumericType.c
+++ b/core/Lucy/Plan/NumericType.c
@@ -46,20 +46,20 @@ Hash*
NumType_Dump_For_Schema_IMP(NumericType *self) {
NumericTypeIVARS *const ivars = NumType_IVARS(self);
Hash *dump = Hash_new(0);
- Hash_Store_Str(dump, "type", 4, (Obj*)NumType_Specifier(self));
+ Hash_Store_Utf8(dump, "type", 4, (Obj*)NumType_Specifier(self));
// Store attributes that override the defaults.
if (ivars->boost != 1.0) {
- Hash_Store_Str(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
+ Hash_Store_Utf8(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
}
if (!ivars->indexed) {
- Hash_Store_Str(dump, "indexed", 7, (Obj*)CFISH_FALSE);
+ Hash_Store_Utf8(dump, "indexed", 7, (Obj*)CFISH_FALSE);
}
if (!ivars->stored) {
- Hash_Store_Str(dump, "stored", 6, (Obj*)CFISH_FALSE);
+ Hash_Store_Utf8(dump, "stored", 6, (Obj*)CFISH_FALSE);
}
if (ivars->sortable) {
- Hash_Store_Str(dump, "sortable", 8, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(dump, "sortable", 8, (Obj*)CFISH_TRUE);
}
return dump;
@@ -68,9 +68,9 @@ NumType_Dump_For_Schema_IMP(NumericType *self) {
Hash*
NumType_Dump_IMP(NumericType *self) {
Hash *dump = NumType_Dump_For_Schema(self);
- Hash_Store_Str(dump, "_class", 6,
- (Obj*)Str_Clone(NumType_Get_Class_Name(self)));
- DECREF(Hash_Delete_Str(dump, "type", 4));
+ Hash_Store_Utf8(dump, "_class", 6,
+ (Obj*)Str_Clone(NumType_Get_Class_Name(self)));
+ DECREF(Hash_Delete_Utf8(dump, "type", 4));
return dump;
}
@@ -80,23 +80,23 @@ NumType_Load_IMP(NumericType *self, Obj *dump) {
Hash *source = (Hash*)CERTIFY(dump, HASH);
// Get a VTable
- String *class_name = (String*)Hash_Fetch_Str(source, "_class", 6);
- String *type_spec = (String*)Hash_Fetch_Str(source, "type", 4);
+ String *class_name = (String*)Hash_Fetch_Utf8(source, "_class", 6);
+ String *type_spec = (String*)Hash_Fetch_Utf8(source, "type", 4);
VTable *vtable = NULL;
if (class_name != NULL && Obj_Is_A((Obj*)class_name, STRING)) {
vtable = VTable_singleton(class_name, NULL);
}
else if (type_spec != NULL && Obj_Is_A((Obj*)type_spec, STRING)) {
- if (Str_Equals_Str(type_spec, "i32_t", 5)) {
+ if (Str_Equals_Utf8(type_spec, "i32_t", 5)) {
vtable = INT32TYPE;
}
- else if (Str_Equals_Str(type_spec, "i64_t", 5)) {
+ else if (Str_Equals_Utf8(type_spec, "i64_t", 5)) {
vtable = INT64TYPE;
}
- else if (Str_Equals_Str(type_spec, "f32_t", 5)) {
+ else if (Str_Equals_Utf8(type_spec, "f32_t", 5)) {
vtable = FLOAT32TYPE;
}
- else if (Str_Equals_Str(type_spec, "f64_t", 5)) {
+ else if (Str_Equals_Utf8(type_spec, "f64_t", 5)) {
vtable = FLOAT64TYPE;
}
else {
@@ -107,13 +107,13 @@ NumType_Load_IMP(NumericType *self, Obj *dump) {
NumericType *loaded = (NumericType*)VTable_Make_Obj(vtable);
// Extract boost.
- Obj *boost_dump = Hash_Fetch_Str(source, "boost", 5);
+ Obj *boost_dump = Hash_Fetch_Utf8(source, "boost", 5);
float boost = boost_dump ? (float)Obj_To_F64(boost_dump) : 1.0f;
// Find boolean properties.
- Obj *indexed_dump = Hash_Fetch_Str(source, "indexed", 7);
- Obj *stored_dump = Hash_Fetch_Str(source, "stored", 6);
- Obj *sort_dump = Hash_Fetch_Str(source, "sortable", 8);
+ Obj *indexed_dump = Hash_Fetch_Utf8(source, "indexed", 7);
+ Obj *stored_dump = Hash_Fetch_Utf8(source, "stored", 6);
+ Obj *sort_dump = Hash_Fetch_Utf8(source, "sortable", 8);
bool indexed = indexed_dump ? Obj_To_Bool(indexed_dump) : true;
bool stored = stored_dump ? Obj_To_Bool(stored_dump) : true;
bool sortable = sort_dump ? Obj_To_Bool(sort_dump) : false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Plan/Schema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.c b/core/Lucy/Plan/Schema.c
index 8ce77d0..098a698 100644
--- a/core/Lucy/Plan/Schema.c
+++ b/core/Lucy/Plan/Schema.c
@@ -256,13 +256,13 @@ Schema_Dump_IMP(Schema *self) {
FieldType *type;
// Record class name, store dumps of unique Analyzers.
- Hash_Store_Str(dump, "_class", 6,
- (Obj*)Str_Clone(Schema_Get_Class_Name(self)));
- Hash_Store_Str(dump, "analyzers", 9,
- Freezer_dump((Obj*)ivars->uniq_analyzers));
+ Hash_Store_Utf8(dump, "_class", 6,
+ (Obj*)Str_Clone(Schema_Get_Class_Name(self)));
+ Hash_Store_Utf8(dump, "analyzers", 9,
+ Freezer_dump((Obj*)ivars->uniq_analyzers));
// Dump FieldTypes.
- Hash_Store_Str(dump, "fields", 6, (Obj*)type_dumps);
+ Hash_Store_Utf8(dump, "fields", 6, (Obj*)type_dumps);
Hash_Iterate(ivars->types);
while (Hash_Next(ivars->types, (Obj**)&field, (Obj**)&type)) {
VTable *type_vtable = FType_Get_VTable(type);
@@ -276,8 +276,8 @@ Schema_Dump_IMP(Schema *self) {
= S_find_in_array(ivars->uniq_analyzers, (Obj*)analyzer);
// Store the tick which references a unique analyzer.
- Hash_Store_Str(type_dump, "analyzer", 8,
- (Obj*)Str_newf("%u32", tick));
+ Hash_Store_Utf8(type_dump, "analyzer", 8,
+ (Obj*)Str_newf("%u32", tick));
Hash_Store(type_dumps, (Obj*)field, (Obj*)type_dump);
}
@@ -306,13 +306,13 @@ Schema*
Schema_Load_IMP(Schema *self, Obj *dump) {
Hash *source = (Hash*)CERTIFY(dump, HASH);
String *class_name
- = (String*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), STRING);
+ = (String*)CERTIFY(Hash_Fetch_Utf8(source, "_class", 6), STRING);
VTable *vtable = VTable_singleton(class_name, NULL);
Schema *loaded = (Schema*)VTable_Make_Obj(vtable);
Hash *type_dumps
- = (Hash*)CERTIFY(Hash_Fetch_Str(source, "fields", 6), HASH);
+ = (Hash*)CERTIFY(Hash_Fetch_Utf8(source, "fields", 6), HASH);
VArray *analyzer_dumps
- = (VArray*)CERTIFY(Hash_Fetch_Str(source, "analyzers", 9), VARRAY);
+ = (VArray*)CERTIFY(Hash_Fetch_Utf8(source, "analyzers", 9), VARRAY);
VArray *analyzers
= (VArray*)Freezer_load((Obj*)analyzer_dumps);
String *field;
@@ -328,56 +328,56 @@ Schema_Load_IMP(Schema *self, Obj *dump) {
while (Hash_Next(type_dumps, (Obj**)&field, (Obj**)&type_dump)) {
String *type_str;
CERTIFY(type_dump, HASH);
- type_str = (String*)Hash_Fetch_Str(type_dump, "type", 4);
+ type_str = (String*)Hash_Fetch_Utf8(type_dump, "type", 4);
if (type_str) {
- if (Str_Equals_Str(type_str, "fulltext", 8)) {
+ if (Str_Equals_Utf8(type_str, "fulltext", 8)) {
// Replace the "analyzer" tick with the real thing.
Obj *tick
- = CERTIFY(Hash_Fetch_Str(type_dump, "analyzer", 8), OBJ);
+ = CERTIFY(Hash_Fetch_Utf8(type_dump, "analyzer", 8), OBJ);
Analyzer *analyzer
= (Analyzer*)VA_Fetch(analyzers,
(uint32_t)Obj_To_I64(tick));
if (!analyzer) {
THROW(ERR, "Can't find analyzer for '%o'", field);
}
- Hash_Store_Str(type_dump, "analyzer", 8, INCREF(analyzer));
+ Hash_Store_Utf8(type_dump, "analyzer", 8, INCREF(analyzer));
FullTextType *type
= (FullTextType*)S_load_type(FULLTEXTTYPE,
(Obj*)type_dump);
Schema_Spec_Field(loaded, field, (FieldType*)type);
DECREF(type);
}
- else if (Str_Equals_Str(type_str, "string", 6)) {
+ else if (Str_Equals_Utf8(type_str, "string", 6)) {
StringType *type
= (StringType*)S_load_type(STRINGTYPE, (Obj*)type_dump);
Schema_Spec_Field(loaded, field, (FieldType*)type);
DECREF(type);
}
- else if (Str_Equals_Str(type_str, "blob", 4)) {
+ else if (Str_Equals_Utf8(type_str, "blob", 4)) {
BlobType *type
= (BlobType*)S_load_type(BLOBTYPE, (Obj*)type_dump);
Schema_Spec_Field(loaded, field, (FieldType*)type);
DECREF(type);
}
- else if (Str_Equals_Str(type_str, "i32_t", 5)) {
+ else if (Str_Equals_Utf8(type_str, "i32_t", 5)) {
Int32Type *type
= (Int32Type*)S_load_type(INT32TYPE, (Obj*)type_dump);
Schema_Spec_Field(loaded, field, (FieldType*)type);
DECREF(type);
}
- else if (Str_Equals_Str(type_str, "i64_t", 5)) {
+ else if (Str_Equals_Utf8(type_str, "i64_t", 5)) {
Int64Type *type
= (Int64Type*)S_load_type(INT64TYPE, (Obj*)type_dump);
Schema_Spec_Field(loaded, field, (FieldType*)type);
DECREF(type);
}
- else if (Str_Equals_Str(type_str, "f32_t", 5)) {
+ else if (Str_Equals_Utf8(type_str, "f32_t", 5)) {
Float32Type *type
= (Float32Type*)S_load_type(FLOAT32TYPE, (Obj*)type_dump);
Schema_Spec_Field(loaded, field, (FieldType*)type);
DECREF(type);
}
- else if (Str_Equals_Str(type_str, "f64_t", 5)) {
+ else if (Str_Equals_Utf8(type_str, "f64_t", 5)) {
Float64Type *type
= (Float64Type*)S_load_type(FLOAT64TYPE, (Obj*)type_dump);
Schema_Spec_Field(loaded, field, (FieldType*)type);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Plan/StringType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/StringType.c b/core/Lucy/Plan/StringType.c
index e87045e..087d743 100644
--- a/core/Lucy/Plan/StringType.c
+++ b/core/Lucy/Plan/StringType.c
@@ -58,20 +58,20 @@ Hash*
StringType_Dump_For_Schema_IMP(StringType *self) {
StringTypeIVARS *const ivars = StringType_IVARS(self);
Hash *dump = Hash_new(0);
- Hash_Store_Str(dump, "type", 4, (Obj*)Str_newf("string"));
+ Hash_Store_Utf8(dump, "type", 4, (Obj*)Str_newf("string"));
// Store attributes that override the defaults.
if (ivars->boost != 1.0) {
- Hash_Store_Str(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
+ Hash_Store_Utf8(dump, "boost", 5, (Obj*)Str_newf("%f64", ivars->boost));
}
if (!ivars->indexed) {
- Hash_Store_Str(dump, "indexed", 7, (Obj*)CFISH_FALSE);
+ Hash_Store_Utf8(dump, "indexed", 7, (Obj*)CFISH_FALSE);
}
if (!ivars->stored) {
- Hash_Store_Str(dump, "stored", 6, (Obj*)CFISH_FALSE);
+ Hash_Store_Utf8(dump, "stored", 6, (Obj*)CFISH_FALSE);
}
if (ivars->sortable) {
- Hash_Store_Str(dump, "sortable", 8, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(dump, "sortable", 8, (Obj*)CFISH_TRUE);
}
return dump;
@@ -80,25 +80,25 @@ StringType_Dump_For_Schema_IMP(StringType *self) {
Hash*
StringType_Dump_IMP(StringType *self) {
Hash *dump = StringType_Dump_For_Schema(self);
- Hash_Store_Str(dump, "_class", 6,
- (Obj*)Str_Clone(StringType_Get_Class_Name(self)));
- DECREF(Hash_Delete_Str(dump, "type", 4));
+ Hash_Store_Utf8(dump, "_class", 6,
+ (Obj*)Str_Clone(StringType_Get_Class_Name(self)));
+ DECREF(Hash_Delete_Utf8(dump, "type", 4));
return dump;
}
StringType*
StringType_Load_IMP(StringType *self, Obj *dump) {
Hash *source = (Hash*)CERTIFY(dump, HASH);
- String *class_name = (String*)Hash_Fetch_Str(source, "_class", 6);
+ String *class_name = (String*)Hash_Fetch_Utf8(source, "_class", 6);
VTable *vtable
= (class_name != NULL && Obj_Is_A((Obj*)class_name, STRING))
? VTable_singleton(class_name, NULL)
: STRINGTYPE;
StringType *loaded = (StringType*)VTable_Make_Obj(vtable);
- Obj *boost_dump = Hash_Fetch_Str(source, "boost", 5);
- Obj *indexed_dump = Hash_Fetch_Str(source, "indexed", 7);
- Obj *stored_dump = Hash_Fetch_Str(source, "stored", 6);
- Obj *sortable_dump = Hash_Fetch_Str(source, "sortable", 8);
+ Obj *boost_dump = Hash_Fetch_Utf8(source, "boost", 5);
+ Obj *indexed_dump = Hash_Fetch_Utf8(source, "indexed", 7);
+ Obj *stored_dump = Hash_Fetch_Utf8(source, "stored", 6);
+ Obj *sortable_dump = Hash_Fetch_Utf8(source, "sortable", 8);
UNUSED_VAR(self);
float boost = boost_dump ? (float)Obj_To_F64(boost_dump) : 1.0f;
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/ANDQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/ANDQuery.c b/core/Lucy/Search/ANDQuery.c
index 0ef378e..88bfe5a 100644
--- a/core/Lucy/Search/ANDQuery.c
+++ b/core/Lucy/Search/ANDQuery.c
@@ -55,10 +55,10 @@ ANDQuery_To_String_IMP(ANDQuery *self) {
CB_Cat(buf, kid_string);
DECREF(kid_string);
if (i == num_kids - 1) {
- CB_Cat_Trusted_UTF8(buf, ")", 1);
+ CB_Cat_Trusted_Utf8(buf, ")", 1);
}
else {
- CB_Cat_Trusted_UTF8(buf, " AND ", 5);
+ CB_Cat_Trusted_Utf8(buf, " AND ", 5);
}
}
String *retval = CB_Yield_String(buf);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/Compiler.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Compiler.c b/core/Lucy/Search/Compiler.c
index 4ffa29d..1ed904e 100644
--- a/core/Lucy/Search/Compiler.c
+++ b/core/Lucy/Search/Compiler.c
@@ -111,7 +111,7 @@ Compiler_To_String_IMP(Compiler *self) {
String *stringified_query = Query_To_String(ivars->parent);
CharBuf *buf = CB_new_from_trusted_utf8("compiler(", 9);
CB_Cat(buf, stringified_query);
- CB_Cat_Trusted_UTF8(buf, ")", 1);
+ CB_Cat_Trusted_Utf8(buf, ")", 1);
String *string = CB_Yield_String(buf);
DECREF(buf);
DECREF(stringified_query);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/LeafQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.c b/core/Lucy/Search/LeafQuery.c
index 9ff388c..52c2718 100644
--- a/core/Lucy/Search/LeafQuery.c
+++ b/core/Lucy/Search/LeafQuery.c
@@ -118,9 +118,9 @@ LeafQuery_Dump_IMP(LeafQuery *self) {
= SUPER_METHOD_PTR(LEAFQUERY, LUCY_LeafQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
if (ivars->field) {
- Hash_Store_Str(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
+ Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
}
- Hash_Store_Str(dump, "text", 4, Freezer_dump((Obj*)ivars->text));
+ Hash_Store_Utf8(dump, "text", 4, Freezer_dump((Obj*)ivars->text));
return (Obj*)dump;
}
@@ -131,12 +131,12 @@ LeafQuery_Load_IMP(LeafQuery *self, Obj *dump) {
= SUPER_METHOD_PTR(LEAFQUERY, LUCY_LeafQuery_Load);
LeafQuery *loaded = (LeafQuery*)super_load(self, dump);
LeafQueryIVARS *loaded_ivars = LeafQuery_IVARS(loaded);
- Obj *field = Hash_Fetch_Str(source, "field", 5);
+ Obj *field = Hash_Fetch_Utf8(source, "field", 5);
if (field) {
loaded_ivars->field
= (String*)CERTIFY(Freezer_load(field), STRING);
}
- Obj *text = CERTIFY(Hash_Fetch_Str(source, "text", 4), OBJ);
+ Obj *text = CERTIFY(Hash_Fetch_Utf8(source, "text", 4), OBJ);
loaded_ivars->text = (String*)CERTIFY(Freezer_load(text), STRING);
return (Obj*)loaded;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/NoMatchQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NoMatchQuery.c b/core/Lucy/Search/NoMatchQuery.c
index b46d460..bd9a045 100644
--- a/core/Lucy/Search/NoMatchQuery.c
+++ b/core/Lucy/Search/NoMatchQuery.c
@@ -83,8 +83,8 @@ NoMatchQuery_Dump_IMP(NoMatchQuery *self) {
NoMatchQuery_Dump_t super_dump
= SUPER_METHOD_PTR(NOMATCHQUERY, LUCY_NoMatchQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
- Hash_Store_Str(dump, "fails_to_match", 14,
- (Obj*)Bool_singleton(ivars->fails_to_match));
+ Hash_Store_Utf8(dump, "fails_to_match", 14,
+ (Obj*)Bool_singleton(ivars->fails_to_match));
return (Obj*)dump;
}
@@ -94,7 +94,7 @@ NoMatchQuery_Load_IMP(NoMatchQuery *self, Obj *dump) {
NoMatchQuery_Load_t super_load
= SUPER_METHOD_PTR(NOMATCHQUERY, LUCY_NoMatchQuery_Load);
NoMatchQuery *loaded = super_load(self, dump);
- Obj *fails = CFISH_Hash_Fetch_Str(source, "fails_to_match", 14);
+ Obj *fails = CFISH_Hash_Fetch_Utf8(source, "fails_to_match", 14);
NoMatchQuery_IVARS(loaded)->fails_to_match
= fails ? Obj_To_Bool(fails) : true;
return loaded;
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/ORQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/ORQuery.c b/core/Lucy/Search/ORQuery.c
index 3ee0cfd..5167d0c 100644
--- a/core/Lucy/Search/ORQuery.c
+++ b/core/Lucy/Search/ORQuery.c
@@ -71,10 +71,10 @@ ORQuery_To_String_IMP(ORQuery *self) {
CB_Cat(buf, kid_string);
DECREF(kid_string);
if (i == last_kid) {
- CB_Cat_Trusted_UTF8(buf, ")", 1);
+ CB_Cat_Trusted_Utf8(buf, ")", 1);
}
else {
- CB_Cat_Trusted_UTF8(buf, " OR ", 4);
+ CB_Cat_Trusted_Utf8(buf, " OR ", 4);
}
}
String *retval = CB_Yield_String(buf);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/PhraseQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c
index 4f02f61..7576401 100644
--- a/core/Lucy/Search/PhraseQuery.c
+++ b/core/Lucy/Search/PhraseQuery.c
@@ -98,8 +98,8 @@ PhraseQuery_Dump_IMP(PhraseQuery *self) {
PhraseQuery_Dump_t super_dump
= SUPER_METHOD_PTR(PHRASEQUERY, LUCY_PhraseQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
- Hash_Store_Str(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
- Hash_Store_Str(dump, "terms", 5, Freezer_dump((Obj*)ivars->terms));
+ Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
+ Hash_Store_Utf8(dump, "terms", 5, Freezer_dump((Obj*)ivars->terms));
return (Obj*)dump;
}
@@ -110,10 +110,10 @@ PhraseQuery_Load_IMP(PhraseQuery *self, Obj *dump) {
= SUPER_METHOD_PTR(PHRASEQUERY, LUCY_PhraseQuery_Load);
PhraseQuery *loaded = (PhraseQuery*)super_load(self, dump);
PhraseQueryIVARS *loaded_ivars = PhraseQuery_IVARS(loaded);
- Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+ Obj *field = CERTIFY(Hash_Fetch_Utf8(source, "field", 5), OBJ);
loaded_ivars->field
= (String*)CERTIFY(Freezer_load(field), STRING);
- Obj *terms = CERTIFY(Hash_Fetch_Str(source, "terms", 5), OBJ);
+ Obj *terms = CERTIFY(Hash_Fetch_Utf8(source, "terms", 5), OBJ);
loaded_ivars->terms
= (VArray*)CERTIFY(Freezer_load(terms), VARRAY);
return (Obj*)loaded;
@@ -140,17 +140,17 @@ PhraseQuery_To_String_IMP(PhraseQuery *self) {
PhraseQueryIVARS *const ivars = PhraseQuery_IVARS(self);
uint32_t num_terms = VA_Get_Size(ivars->terms);
CharBuf *buf = CB_new_from_str(ivars->field);
- CB_Cat_Trusted_UTF8(buf, ":\"", 2);
+ CB_Cat_Trusted_Utf8(buf, ":\"", 2);
for (uint32_t i = 0; i < num_terms; i++) {
Obj *term = VA_Fetch(ivars->terms, i);
String *term_string = Obj_To_String(term);
CB_Cat(buf, term_string);
DECREF(term_string);
if (i < num_terms - 1) {
- CB_Cat_Trusted_UTF8(buf, " ", 1);
+ CB_Cat_Trusted_Utf8(buf, " ", 1);
}
}
- CB_Cat_Trusted_UTF8(buf, "\"", 1);
+ CB_Cat_Trusted_Utf8(buf, "\"", 1);
String *retval = CB_Yield_String(buf);
DECREF(buf);
return retval;
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/PolyQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.c b/core/Lucy/Search/PolyQuery.c
index 5a36db0..8e85af9 100644
--- a/core/Lucy/Search/PolyQuery.c
+++ b/core/Lucy/Search/PolyQuery.c
@@ -98,7 +98,7 @@ PolyQuery_Dump_IMP(PolyQuery *self) {
PolyQuery_Dump_t super_dump
= SUPER_METHOD_PTR(POLYQUERY, LUCY_PolyQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
- Hash_Store_Str(dump, "children", 8, Freezer_dump((Obj*)ivars->children));
+ Hash_Store_Utf8(dump, "children", 8, Freezer_dump((Obj*)ivars->children));
return (Obj*)dump;
}
@@ -108,7 +108,7 @@ PolyQuery_Load_IMP(PolyQuery *self, Obj *dump) {
PolyQuery_Load_t super_load
= SUPER_METHOD_PTR(POLYQUERY, LUCY_PolyQuery_Load);
PolyQuery *loaded = (PolyQuery*)super_load(self, dump);
- Obj *children = CERTIFY(Hash_Fetch_Str(source, "children", 8), OBJ);
+ Obj *children = CERTIFY(Hash_Fetch_Utf8(source, "children", 8), OBJ);
PolyQuery_IVARS(loaded)->children
= (VArray*)CERTIFY(Freezer_load(children), VARRAY);
return (Obj*)loaded;
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/Query.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Query.c b/core/Lucy/Search/Query.c
index d3215fb..78ebea2 100644
--- a/core/Lucy/Search/Query.c
+++ b/core/Lucy/Search/Query.c
@@ -55,10 +55,10 @@ Obj*
Query_Dump_IMP(Query *self) {
QueryIVARS *ivars = Query_IVARS(self);
Hash *dump = Hash_new(0);
- Hash_Store_Str(dump, "_class", 6,
- (Obj*)Str_Clone(Obj_Get_Class_Name((Obj*)self)));
- Hash_Store_Str(dump, "boost", 5,
- (Obj*)Str_newf("%f64", (double)ivars->boost));
+ Hash_Store_Utf8(dump, "_class", 6,
+ (Obj*)Str_Clone(Obj_Get_Class_Name((Obj*)self)));
+ Hash_Store_Utf8(dump, "boost", 5,
+ (Obj*)Str_newf("%f64", (double)ivars->boost));
return (Obj*)dump;
}
@@ -67,10 +67,10 @@ Query_Load_IMP(Query *self, Obj *dump) {
CHY_UNUSED_VAR(self);
Hash *source = (Hash*)CERTIFY(dump, HASH);
String *class_name
- = (String*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), STRING);
+ = (String*)CERTIFY(Hash_Fetch_Utf8(source, "_class", 6), STRING);
VTable *vtable = VTable_singleton(class_name, NULL);
Query *loaded = (Query*)VTable_Make_Obj(vtable);
- Obj *boost = CERTIFY(Hash_Fetch_Str(source, "boost", 5), OBJ);
+ Obj *boost = CERTIFY(Hash_Fetch_Utf8(source, "boost", 5), OBJ);
Query_IVARS(loaded)->boost = (float)Obj_To_F64(boost);
return (Obj*)loaded;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/QueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c
index 21100d4..037d6b1 100644
--- a/core/Lucy/Search/QueryParser.c
+++ b/core/Lucy/Search/QueryParser.c
@@ -141,10 +141,10 @@ QParser_init(QueryParser *self, Schema *schema, Analyzer *analyzer,
VA_Sort(ivars->fields, NULL, NULL);
// Derive default "occur" from default boolean operator.
- if (Str_Equals_Str(ivars->default_boolop, "OR", 2)) {
+ if (Str_Equals_Utf8(ivars->default_boolop, "OR", 2)) {
ivars->default_occur = SHOULD;
}
- else if (Str_Equals_Str(ivars->default_boolop, "AND", 3)) {
+ else if (Str_Equals_Utf8(ivars->default_boolop, "AND", 3)) {
ivars->default_occur = MUST;
}
else {
@@ -876,11 +876,11 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
StringIterator *tail = Str_Tail(full_text);
StrIter_Skip_Next_Whitespace(top);
StrIter_Skip_Prev_Whitespace(tail);
- if (StrIter_Starts_With_UTF8(top, "\"", 1)) {
+ if (StrIter_Starts_With_Utf8(top, "\"", 1)) {
is_phrase = true;
StrIter_Advance(top, 1);
- if (StrIter_Ends_With_UTF8(tail, "\"", 1)
- && !StrIter_Ends_With_UTF8(tail, "\\\"", 2)
+ if (StrIter_Ends_With_Utf8(tail, "\"", 1)
+ && !StrIter_Ends_With_Utf8(tail, "\\\"", 2)
) {
StrIter_Recede(tail, 1);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/QueryParser/QueryLexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.c b/core/Lucy/Search/QueryParser/QueryLexer.c
index af07f5f..de9e66f 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.c
+++ b/core/Lucy/Search/QueryParser/QueryLexer.c
@@ -163,7 +163,7 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, const String *query_string) {
static ParserElem*
S_consume_keyword(StringIterator *iter, const char *keyword,
size_t keyword_len, int type) {
- if (!StrIter_Starts_With_UTF8(iter, keyword, keyword_len)) {
+ if (!StrIter_Starts_With_Utf8(iter, keyword, keyword_len)) {
return NULL;
}
StringIterator *temp = StrIter_Clone(iter);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/RangeQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.c b/core/Lucy/Search/RangeQuery.c
index a208213..d4c7174 100644
--- a/core/Lucy/Search/RangeQuery.c
+++ b/core/Lucy/Search/RangeQuery.c
@@ -166,19 +166,19 @@ RangeQuery_Dump_IMP(RangeQuery *self) {
RangeQuery_Dump_t super_dump
= SUPER_METHOD_PTR(RANGEQUERY, LUCY_RangeQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
- Hash_Store_Str(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
+ Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
if (ivars->lower_term) {
- Hash_Store_Str(dump, "lower_term", 10,
- Freezer_dump((Obj*)ivars->lower_term));
+ Hash_Store_Utf8(dump, "lower_term", 10,
+ Freezer_dump((Obj*)ivars->lower_term));
}
if (ivars->upper_term) {
- Hash_Store_Str(dump, "upper_term", 10,
- Freezer_dump((Obj*)ivars->upper_term));
+ Hash_Store_Utf8(dump, "upper_term", 10,
+ Freezer_dump((Obj*)ivars->upper_term));
}
- Hash_Store_Str(dump, "include_lower", 13,
- (Obj*)Bool_singleton(ivars->include_lower));
- Hash_Store_Str(dump, "include_upper", 13,
- (Obj*)Bool_singleton(ivars->include_upper));
+ Hash_Store_Utf8(dump, "include_lower", 13,
+ (Obj*)Bool_singleton(ivars->include_lower));
+ Hash_Store_Utf8(dump, "include_upper", 13,
+ (Obj*)Bool_singleton(ivars->include_upper));
return (Obj*)dump;
}
@@ -189,23 +189,23 @@ RangeQuery_Load_IMP(RangeQuery *self, Obj *dump) {
= SUPER_METHOD_PTR(RANGEQUERY, LUCY_RangeQuery_Load);
RangeQuery *loaded = (RangeQuery*)super_load(self, dump);
RangeQueryIVARS *loaded_ivars = RangeQuery_IVARS(loaded);
- Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+ Obj *field = CERTIFY(Hash_Fetch_Utf8(source, "field", 5), OBJ);
loaded_ivars->field = (String*)CERTIFY(Freezer_load(field), STRING);
- Obj *lower_term = Hash_Fetch_Str(source, "lower_term", 10);
+ Obj *lower_term = Hash_Fetch_Utf8(source, "lower_term", 10);
if (lower_term) {
loaded_ivars->lower_term
= (Obj*)CERTIFY(Freezer_load(lower_term), OBJ);
}
- Obj *upper_term = Hash_Fetch_Str(source, "upper_term", 10);
+ Obj *upper_term = Hash_Fetch_Utf8(source, "upper_term", 10);
if (upper_term) {
loaded_ivars->upper_term
= (Obj*)CERTIFY(Freezer_load(upper_term), OBJ);
}
Obj *include_lower
- = CERTIFY(Hash_Fetch_Str(source, "include_lower", 13), OBJ);
+ = CERTIFY(Hash_Fetch_Utf8(source, "include_lower", 13), OBJ);
loaded_ivars->include_lower = Obj_To_Bool(include_lower);
Obj *include_upper
- = CERTIFY(Hash_Fetch_Str(source, "include_upper", 13), OBJ);
+ = CERTIFY(Hash_Fetch_Utf8(source, "include_upper", 13), OBJ);
loaded_ivars->include_upper = Obj_To_Bool(include_upper);
return (Obj*)loaded;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Search/TermQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.c b/core/Lucy/Search/TermQuery.c
index 3644834..eeae547 100644
--- a/core/Lucy/Search/TermQuery.c
+++ b/core/Lucy/Search/TermQuery.c
@@ -80,8 +80,8 @@ TermQuery_Dump_IMP(TermQuery *self) {
TermQuery_Dump_t super_dump
= SUPER_METHOD_PTR(TERMQUERY, LUCY_TermQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
- Hash_Store_Str(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
- Hash_Store_Str(dump, "term", 4, Freezer_dump(ivars->term));
+ Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
+ Hash_Store_Utf8(dump, "term", 4, Freezer_dump(ivars->term));
return (Obj*)dump;
}
@@ -92,9 +92,9 @@ TermQuery_Load_IMP(TermQuery *self, Obj *dump) {
= SUPER_METHOD_PTR(TERMQUERY, LUCY_TermQuery_Load);
TermQuery *loaded = (TermQuery*)super_load(self, dump);
TermQueryIVARS *loaded_ivars = TermQuery_IVARS(loaded);
- Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+ Obj *field = CERTIFY(Hash_Fetch_Utf8(source, "field", 5), OBJ);
loaded_ivars->field = (String*)CERTIFY(Freezer_load(field), STRING);
- Obj *term = CERTIFY(Hash_Fetch_Str(source, "term", 4), OBJ);
+ Obj *term = CERTIFY(Hash_Fetch_Utf8(source, "term", 4), OBJ);
loaded_ivars->term = (Obj*)CERTIFY(Freezer_load(term), OBJ);
return (Obj*)loaded;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Store/CompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c
index 2ecf45c..8ee59c7 100644
--- a/core/Lucy/Store/CompoundFileReader.c
+++ b/core/Lucy/Store/CompoundFileReader.c
@@ -48,9 +48,9 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
Folder_Get_Path(folder)));
}
else {
- Obj *format = Hash_Fetch_Str(metadata, "format", 6);
+ Obj *format = Hash_Fetch_Utf8(metadata, "format", 6);
ivars->format = format ? (int32_t)Obj_To_I64(format) : 0;
- ivars->records = (Hash*)INCREF(Hash_Fetch_Str(metadata, "files", 5));
+ ivars->records = (Hash*)INCREF(Hash_Fetch_Utf8(metadata, "files", 5));
if (ivars->format < 1) {
error = Err_new(Str_newf("Corrupt %o file: Missing or invalid 'format'",
cfmeta_file));
@@ -194,8 +194,8 @@ CFReader_Local_Open_In_IMP(CompoundFileReader *self, const String *name) {
return instream;
}
else {
- Obj *len = Hash_Fetch_Str(entry, "length", 6);
- Obj *offset = Hash_Fetch_Str(entry, "offset", 6);
+ Obj *len = Hash_Fetch_Utf8(entry, "length", 6);
+ Obj *offset = Hash_Fetch_Utf8(entry, "offset", 6);
if (!len || !offset) {
Err_set_error(Err_new(Str_newf("Malformed entry for '%o' in '%o'",
name, Folder_Get_Path(ivars->real_folder))));
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Store/CompoundFileWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileWriter.c b/core/Lucy/Store/CompoundFileWriter.c
index 0cb9891..82e4178 100644
--- a/core/Lucy/Store/CompoundFileWriter.c
+++ b/core/Lucy/Store/CompoundFileWriter.c
@@ -105,15 +105,15 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
if (!outstream) { RETHROW(INCREF(Err_get_error())); }
// Start metadata.
- Hash_Store_Str(metadata, "files", 5, INCREF(sub_files));
- Hash_Store_Str(metadata, "format", 6,
- (Obj*)Str_newf("%i32", CFWriter_current_file_format));
+ Hash_Store_Utf8(metadata, "files", 5, INCREF(sub_files));
+ Hash_Store_Utf8(metadata, "format", 6,
+ (Obj*)Str_newf("%i32", CFWriter_current_file_format));
VA_Sort(files, NULL, NULL);
for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) {
String *infilename = (String*)VA_Fetch(files, i);
- if (!Str_Ends_With_Str(infilename, ".json", 5)) {
+ if (!Str_Ends_With_Utf8(infilename, ".json", 5)) {
InStream *instream = Folder_Open_In(folder, infilename);
Hash *file_data = Hash_new(2);
int64_t offset, len;
@@ -126,10 +126,10 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
len = OutStream_Tell(outstream) - offset;
// Record offset and length.
- Hash_Store_Str(file_data, "offset", 6,
- (Obj*)Str_newf("%i64", offset));
- Hash_Store_Str(file_data, "length", 6,
- (Obj*)Str_newf("%i64", len));
+ Hash_Store_Utf8(file_data, "offset", 6,
+ (Obj*)Str_newf("%i64", offset));
+ Hash_Store_Utf8(file_data, "length", 6,
+ (Obj*)Str_newf("%i64", len));
Hash_Store(sub_files, (Obj*)infilename, (Obj*)file_data);
VA_Push(merged, INCREF(infilename));
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index cdb353c..70522f3 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -229,7 +229,7 @@ FSFolder_Local_Find_Folder_IMP(FSFolder *self, const String *name) {
else if (!S_is_local_entry(name)) {
return NULL;
}
- else if (Str_Starts_With_Str(name, ".", 1)) {
+ else if (Str_Starts_With_Utf8(name, ".", 1)) {
// Don't allow access outside of the main dir.
return NULL;
}
@@ -302,7 +302,7 @@ S_create_dir(const String *path) {
static bool
S_is_local_entry(const String *path) {
- return Str_Find_Str(path, "/", 1) == -1;
+ return Str_Find_Utf8(path, "/", 1) == -1;
}
/***************************************************************************/
@@ -366,7 +366,7 @@ S_hard_link(String *from_path, String *to_path) {
static bool
S_is_absolute(const String *path) {
- return Str_Starts_With_Str(path, DIR_SEP, 1);
+ return Str_Starts_With_Utf8(path, DIR_SEP, 1);
}
static String*
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index 9d7bb46..c45169f 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -41,7 +41,7 @@ Folder_init(Folder *self, const String *path) {
}
else {
// Copy path, strip trailing slash or equivalent.
- if (Str_Ends_With_Str(path, DIR_SEP, strlen(DIR_SEP))) {
+ if (Str_Ends_With_Utf8(path, DIR_SEP, strlen(DIR_SEP))) {
ivars->path = Str_SubString(path, 0, Str_Length(path) - 1);
}
else {
@@ -209,7 +209,7 @@ Folder_Delete_Tree_IMP(Folder *self, const String *path) {
static bool
S_is_updir(String *path) {
- if (Str_Equals_Str(path, ".", 1) || Str_Equals_Str(path, "..", 2)) {
+ if (Str_Equals_Utf8(path, ".", 1) || Str_Equals_Utf8(path, "..", 2)) {
return true;
}
else {
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index 4d778d0..fc6efc7 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -168,10 +168,10 @@ LFLock_Request_IMP(LockFileLock *self) {
// Prepare to write pid, lock name, and host to the lock file as JSON.
file_data = Hash_new(3);
- Hash_Store_Str(file_data, "pid", 3,
- (Obj*)Str_newf("%i32", (int32_t)PID_getpid()));
- Hash_Store_Str(file_data, "host", 4, INCREF(ivars->host));
- Hash_Store_Str(file_data, "name", 4, INCREF(ivars->name));
+ Hash_Store_Utf8(file_data, "pid", 3,
+ (Obj*)Str_newf("%i32", (int32_t)PID_getpid()));
+ Hash_Store_Utf8(file_data, "host", 4, INCREF(ivars->host));
+ Hash_Store_Utf8(file_data, "name", 4, INCREF(ivars->name));
// Write to a temporary file, then use the creation of a hard link to
// ensure atomic but non-destructive creation of the lockfile with its
@@ -233,7 +233,7 @@ LFLock_Maybe_Delete_File_IMP(LockFileLock *self, const String *path,
bool success = false;
// Only delete locks that start with our lock name.
- if (!Str_Starts_With_Str(path, "locks", 5)) {
+ if (!Str_Starts_With_Utf8(path, "locks", 5)) {
return false;
}
StringIterator *iter = Str_Top(path);
@@ -248,10 +248,10 @@ LFLock_Maybe_Delete_File_IMP(LockFileLock *self, const String *path,
if (Folder_Exists(folder, path)) {
Hash *hash = (Hash*)Json_slurp_json(folder, path);
if (hash != NULL && Obj_Is_A((Obj*)hash, HASH)) {
- String *pid_buf = (String*)Hash_Fetch_Str(hash, "pid", 3);
- String *host = (String*)Hash_Fetch_Str(hash, "host", 4);
+ String *pid_buf = (String*)Hash_Fetch_Utf8(hash, "pid", 3);
+ String *host = (String*)Hash_Fetch_Utf8(hash, "host", 4);
String *name
- = (String*)Hash_Fetch_Str(hash, "name", 4);
+ = (String*)Hash_Fetch_Utf8(hash, "name", 4);
// Match hostname and lock name.
if (host != NULL
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Store/SharedLock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.c b/core/Lucy/Store/SharedLock.c
index 7ff1fc6..9d33b7b 100644
--- a/core/Lucy/Store/SharedLock.c
+++ b/core/Lucy/Store/SharedLock.c
@@ -61,7 +61,7 @@ ShLock_Request_IMP(SharedLock *self) {
// Empty lock_path indicates whether this particular instance is locked.
if (ivars->lock_path
- && !Str_Equals_Str(ivars->lock_path, "", 0)
+ && !Str_Equals_Utf8(ivars->lock_path, "", 0)
&& Folder_Exists(ivars->folder, ivars->lock_path)
) {
// Don't allow double obtain.
@@ -83,7 +83,7 @@ ShLock_Request_IMP(SharedLock *self) {
void
ShLock_Release_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- if (ivars->lock_path && !Str_Equals_Str(ivars->lock_path, "", 0)) {
+ if (ivars->lock_path && !Str_Equals_Utf8(ivars->lock_path, "", 0)) {
ShLock_Release_t super_release
= SUPER_METHOD_PTR(SHAREDLOCK, LUCY_ShLock_Release);
super_release(self);
@@ -111,7 +111,7 @@ ShLock_Clear_Stale_IMP(SharedLock *self) {
while (DH_Next(dh)) {
String *entry = DH_Get_Entry(dh);
if (Str_Starts_With(entry, ivars->name)
- && Str_Ends_With_Str(entry, ".lock", 5)
+ && Str_Ends_With_Utf8(entry, ".lock", 5)
) {
String *candidate = Str_newf("%o/%o", lock_dir_name, entry);
ShLock_Maybe_Delete_File(self, candidate, false, true);
@@ -149,7 +149,7 @@ ShLock_Is_Locked_IMP(SharedLock *self) {
if (!isdigit(code_point)) { break; }
}
if (code_point == '.'
- && StrIter_Starts_With_UTF8(iter, "lock", 4)
+ && StrIter_Starts_With_Utf8(iter, "lock", 4)
) {
StrIter_Advance(iter, 4);
if (!StrIter_Has_Next(iter)) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Analysis/TestNormalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestNormalizer.c b/core/Lucy/Test/Analysis/TestNormalizer.c
index 1fb45f4..b1fea5c 100644
--- a/core/Lucy/Test/Analysis/TestNormalizer.c
+++ b/core/Lucy/Test/Analysis/TestNormalizer.c
@@ -79,15 +79,15 @@ test_normalization(TestBatchRunner *runner) {
for (uint32_t i = 0, max = VA_Get_Size(tests); i < max; i++) {
Hash *test = (Hash*)VA_Fetch(tests, i);
- String *form = (String*)Hash_Fetch_Str(
+ String *form = (String*)Hash_Fetch_Utf8(
test, "normalization_form", 18);
- bool case_fold = Bool_Get_Value((BoolNum*)Hash_Fetch_Str(
+ bool case_fold = Bool_Get_Value((BoolNum*)Hash_Fetch_Utf8(
test, "case_fold", 9));
- bool strip_accents = Bool_Get_Value((BoolNum*)Hash_Fetch_Str(
+ bool strip_accents = Bool_Get_Value((BoolNum*)Hash_Fetch_Utf8(
test, "strip_accents", 13));
Normalizer *normalizer = Normalizer_new(form, case_fold, strip_accents);
- VArray *words = (VArray*)Hash_Fetch_Str(test, "words", 5);
- VArray *norms = (VArray*)Hash_Fetch_Str(test, "norms", 5);
+ VArray *words = (VArray*)Hash_Fetch_Utf8(test, "words", 5);
+ VArray *norms = (VArray*)Hash_Fetch_Utf8(test, "norms", 5);
for (uint32_t j = 0, max = VA_Get_Size(words); j < max; j++) {
String *word = (String*)VA_Fetch(words, j);
VArray *got = Normalizer_Split(normalizer, word);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Analysis/TestSnowballStemmer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestSnowballStemmer.c b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
index 894c6e4..3e6a44d 100644
--- a/core/Lucy/Test/Analysis/TestSnowballStemmer.c
+++ b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
@@ -71,8 +71,8 @@ test_stemming(TestBatchRunner *runner) {
Hash *lang_data;
Hash_Iterate(tests);
while (Hash_Next(tests, (Obj**)&iso, (Obj**)&lang_data)) {
- VArray *words = (VArray*)Hash_Fetch_Str(lang_data, "words", 5);
- VArray *stems = (VArray*)Hash_Fetch_Str(lang_data, "stems", 5);
+ VArray *words = (VArray*)Hash_Fetch_Utf8(lang_data, "words", 5);
+ VArray *stems = (VArray*)Hash_Fetch_Utf8(lang_data, "stems", 5);
SnowballStemmer *stemmer = SnowStemmer_new(iso);
for (uint32_t i = 0, max = VA_Get_Size(words); i < max; i++) {
String *word = (String*)VA_Fetch(words, i);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Analysis/TestSnowballStopFilter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestSnowballStopFilter.c b/core/Lucy/Test/Analysis/TestSnowballStopFilter.c
index 46f4cd5..44fe6dc 100644
--- a/core/Lucy/Test/Analysis/TestSnowballStopFilter.c
+++ b/core/Lucy/Test/Analysis/TestSnowballStopFilter.c
@@ -37,8 +37,8 @@ S_make_stopfilter(void *unused, ...) {
va_start(args, unused);
while (NULL != (stopword = va_arg(args, char*))) {
- Hash_Store_Str(stoplist, stopword, strlen(stopword),
- (Obj*)Str_newf(""));
+ Hash_Store_Utf8(stoplist, stopword, strlen(stopword),
+ (Obj*)Str_newf(""));
}
va_end(args);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Analysis/TestStandardTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestStandardTokenizer.c b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
index 837cb58..ab5f36e 100644
--- a/core/Lucy/Test/Analysis/TestStandardTokenizer.c
+++ b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
@@ -66,31 +66,31 @@ test_tokenizer(TestBatchRunner *runner) {
TEST_TRUE(runner,
token
&& Str_Is_A(token, STRING)
- && Str_Equals_Str(token, "tha\xcc\x82t's", 8),
+ && Str_Equals_Utf8(token, "tha\xcc\x82t's", 8),
"Token: %s", Str_Get_Ptr8(token));
token = (String*)VA_Fetch(got, 1);
TEST_TRUE(runner,
token
&& Str_Is_A(token, STRING)
- && Str_Equals_Str(token, "1,02\xC2\xADZ4.38", 11),
+ && Str_Equals_Utf8(token, "1,02\xC2\xADZ4.38", 11),
"Token: %s", Str_Get_Ptr8(token));
token = (String*)VA_Fetch(got, 2);
TEST_TRUE(runner,
token
&& Str_Is_A(token, STRING)
- && Str_Equals_Str(token, "\xE0\xB8\x81\xC2\xAD\xC2\xAD", 7),
+ && Str_Equals_Utf8(token, "\xE0\xB8\x81\xC2\xAD\xC2\xAD", 7),
"Token: %s", Str_Get_Ptr8(token));
token = (String*)VA_Fetch(got, 3);
TEST_TRUE(runner,
token
&& Str_Is_A(token, STRING)
- && Str_Equals_Str(token, "\xF0\xA0\x80\x80", 4),
+ && Str_Equals_Utf8(token, "\xF0\xA0\x80\x80", 4),
"Token: %s", Str_Get_Ptr8(token));
token = (String*)VA_Fetch(got, 4);
TEST_TRUE(runner,
token
&& Str_Is_A(token, STRING)
- && Str_Equals_Str(token, "a", 1),
+ && Str_Equals_Utf8(token, "a", 1),
"Token: %s", Str_Get_Ptr8(token));
DECREF(got);
@@ -101,8 +101,8 @@ test_tokenizer(TestBatchRunner *runner) {
for (uint32_t i = 0, max = VA_Get_Size(tests); i < max; i++) {
Hash *test = (Hash*)VA_Fetch(tests, i);
- String *text = (String*)Hash_Fetch_Str(test, "text", 4);
- VArray *wanted = (VArray*)Hash_Fetch_Str(test, "words", 5);
+ String *text = (String*)Hash_Fetch_Utf8(test, "text", 4);
+ VArray *wanted = (VArray*)Hash_Fetch_Utf8(test, "words", 5);
VArray *got = StandardTokenizer_Split(tokenizer, text);
TEST_TRUE(runner, VA_Equals(wanted, (Obj*)got), "UCD test #%d", i + 1);
DECREF(got);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Highlight/TestHighlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Highlight/TestHighlighter.c b/core/Lucy/Test/Highlight/TestHighlighter.c
index 2539ad0..706cd2a 100644
--- a/core/Lucy/Test/Highlight/TestHighlighter.c
+++ b/core/Lucy/Test/Highlight/TestHighlighter.c
@@ -72,7 +72,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
raw_excerpt = Highlighter_Raw_Excerpt(highlighter, field_val, &top,
heat_map);
TEST_TRUE(runner,
- Str_Equals_Str(raw_excerpt, "Ook.", 4),
+ Str_Equals_Utf8(raw_excerpt, "Ook.", 4),
"Raw_Excerpt at top %s", Str_Get_Ptr8(raw_excerpt));
TEST_TRUE(runner,
top == 0,
@@ -87,7 +87,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
raw_excerpt = Highlighter_Raw_Excerpt(highlighter, field_val, &top,
heat_map);
TEST_TRUE(runner,
- Str_Equals_Str(raw_excerpt, "Urk.", 4),
+ Str_Equals_Utf8(raw_excerpt, "Urk.", 4),
"Raw_Excerpt in middle, with 2 bounds");
TEST_TRUE(runner,
top == 6,
@@ -103,7 +103,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
raw_excerpt = Highlighter_Raw_Excerpt(highlighter, field_val, &top,
heat_map);
TEST_TRUE(runner,
- Str_Equals_Str(raw_excerpt, ELLIPSIS " i.", 6),
+ Str_Equals_Utf8(raw_excerpt, ELLIPSIS " i.", 6),
"Ellipsis at top");
TEST_TRUE(runner,
top == 10,
@@ -119,7 +119,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
raw_excerpt = Highlighter_Raw_Excerpt(highlighter, field_val, &top,
heat_map);
TEST_TRUE(runner,
- Str_Equals_Str(raw_excerpt, "Iz no" ELLIPSIS, 8),
+ Str_Equals_Utf8(raw_excerpt, "Iz no" ELLIPSIS, 8),
"Ellipsis at end");
TEST_TRUE(runner,
top == 6,
@@ -138,7 +138,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
raw_excerpt = Highlighter_Raw_Excerpt(highlighter, field_val, &top,
heat_map);
TEST_TRUE(runner,
- Str_Equals_Str(raw_excerpt, "abc/d" ELLIPSIS, 8),
+ Str_Equals_Utf8(raw_excerpt, "abc/d" ELLIPSIS, 8),
"Long word at top");
DECREF(heat_map);
DECREF(raw_excerpt);
@@ -150,7 +150,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
raw_excerpt = Highlighter_Raw_Excerpt(highlighter, field_val, &top,
heat_map);
TEST_TRUE(runner,
- Str_Equals_Str(raw_excerpt, ELLIPSIS " f/g" ELLIPSIS, 10),
+ Str_Equals_Utf8(raw_excerpt, ELLIPSIS " f/g" ELLIPSIS, 10),
"Long word in middle");
DECREF(heat_map);
DECREF(raw_excerpt);
@@ -170,7 +170,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
- Str_Equals_Str(highlighted, "a <strong>b</strong> c", 22),
+ Str_Equals_Utf8(highlighted, "a <strong>b</strong> c", 22),
"basic Highlight_Excerpt");
DECREF(highlighted);
DECREF(spans);
@@ -182,7 +182,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
- Str_Equals_Str(highlighted, "<strong>Φ</strong>", 23),
+ Str_Equals_Utf8(highlighted, "<strong>Φ</strong>", 23),
"don't surround spans off end of raw excerpt.");
DECREF(highlighted);
DECREF(spans);
@@ -193,7 +193,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 1);
TEST_TRUE(runner,
- Str_Equals_Str(highlighted,
+ Str_Equals_Utf8(highlighted,
"Φ <strong>Φ</strong> Φ", 37),
"Highlight_Excerpt pays attention to offset");
DECREF(highlighted);
@@ -208,7 +208,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
- Str_Equals_Str(highlighted,
+ Str_Equals_Utf8(highlighted,
"Φ <strong>Oook. Urk. Ick.</strong> Φ",
46),
"Highlight_Excerpt works with overlapping spans");
@@ -227,7 +227,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
HitDoc *hit = Hits_Next(hits);
String *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Str(excerpt,
+ Str_Find_Utf8(excerpt,
"<strong>Φ</strong> a b c d <strong>x y z</strong>",
54) >= 0,
"highlighter tagged phrase and single term");
@@ -239,7 +239,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
Highlighter_Set_Post_Tag(highlighter, post_tag);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Str(excerpt,
+ Str_Find_Utf8(excerpt,
"\x1B[1mΦ\x1B[0m a b c d \x1B[1mx y z\x1B[0m",
36) >= 0,
"set_pre_tag and set_post_tag");
@@ -249,7 +249,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Str(excerpt, "x", 1) >= 0,
+ Str_Find_Utf8(excerpt, "x", 1) >= 0,
"excerpt field with partial hit doesn't cause highlighter freakout");
DECREF(excerpt);
DECREF(hit);
@@ -261,7 +261,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Str(excerpt,
+ Str_Find_Utf8(excerpt,
"<strong>b</strong> c d <strong>x y z</strong>",
45) >= 0,
"query with same word in both phrase and term doesn't cause freakout");
@@ -276,7 +276,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Str(excerpt, """, 6) >= 0,
+ Str_Find_Utf8(excerpt, """, 6) >= 0,
"HTML entity encoded properly");
DECREF(excerpt);
DECREF(hit);
@@ -289,7 +289,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Str(excerpt, "Φ", 6) == -1,
+ Str_Find_Utf8(excerpt, "Φ", 6) == -1,
"no ellipsis for short excerpt");
DECREF(excerpt);
DECREF(hit);
@@ -303,7 +303,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
highlighter = Highlighter_new(searcher, query, content, 200);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Str(excerpt, "strong", 5) >= 0,
+ Str_Find_Utf8(excerpt, "strong", 5) >= 0,
"specify field highlights correct field...");
DECREF(excerpt);
DECREF(highlighter);
@@ -311,7 +311,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
highlighter = Highlighter_new(searcher, query, alt, 200);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Str(excerpt, "strong", 5) == -1,
+ Str_Find_Utf8(excerpt, "strong", 5) == -1,
"... but not another field");
DECREF(excerpt);
DECREF(highlighter);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Index/TestSegment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSegment.c b/core/Lucy/Test/Index/TestSegment.c
index bd83256..e0e9b6b 100644
--- a/core/Lucy/Test/Index/TestSegment.c
+++ b/core/Lucy/Test/Index/TestSegment.c
@@ -63,12 +63,12 @@ test_metadata_storage(TestBatchRunner *runner) {
Segment *segment = Seg_new(1);
String *got;
- Seg_Store_Metadata_Str(segment, "foo", 3, (Obj*)Str_newf("bar"));
- got = (String*)Seg_Fetch_Metadata_Str(segment, "foo", 3);
+ Seg_Store_Metadata_Utf8(segment, "foo", 3, (Obj*)Str_newf("bar"));
+ got = (String*)Seg_Fetch_Metadata_Utf8(segment, "foo", 3);
TEST_TRUE(runner,
got
&& Str_Is_A(got, STRING)
- && Str_Equals_Str(got, "bar", 3),
+ && Str_Equals_Utf8(got, "bar", 3),
"metadata round trip"
);
DECREF(segment);
@@ -79,9 +79,9 @@ test_seg_name_and_num(TestBatchRunner *runner) {
Segment *segment_z = Seg_new(35);
String *seg_z_name = Seg_num_to_name(35);
TEST_TRUE(runner, Seg_Get_Number(segment_z) == INT64_C(35), "Get_Number");
- TEST_TRUE(runner, Str_Equals_Str(Seg_Get_Name(segment_z), "seg_z", 5),
+ TEST_TRUE(runner, Str_Equals_Utf8(Seg_Get_Name(segment_z), "seg_z", 5),
"Get_Name");
- TEST_TRUE(runner, Str_Equals_Str(seg_z_name, "seg_z", 5),
+ TEST_TRUE(runner, Str_Equals_Utf8(seg_z_name, "seg_z", 5),
"num_to_name");
DECREF(seg_z_name);
DECREF(segment_z);
@@ -130,7 +130,7 @@ test_Write_File_and_Read_File(TestBatchRunner *runner) {
String *jetsam = (String*)SSTR_WRAP_STR("jetsam", 6);
Seg_Set_Count(segment, 111);
- Seg_Store_Metadata_Str(segment, "foo", 3, (Obj*)Str_newf("bar"));
+ Seg_Store_Metadata_Utf8(segment, "foo", 3, (Obj*)Str_newf("bar"));
Seg_Add_Field(segment, flotsam);
Seg_Add_Field(segment, jetsam);
@@ -143,11 +143,11 @@ test_Write_File_and_Read_File(TestBatchRunner *runner) {
TEST_TRUE(runner,
Seg_Field_Num(got, jetsam) == Seg_Field_Num(segment, jetsam),
"Round trip field names through file");
- meta = (String*)Seg_Fetch_Metadata_Str(got, "foo", 3);
+ meta = (String*)Seg_Fetch_Metadata_Utf8(got, "foo", 3);
TEST_TRUE(runner,
meta
&& Str_Is_A(meta, STRING)
- && Str_Equals_Str(meta, "bar", 3),
+ && Str_Equals_Utf8(meta, "bar", 3),
"Round trip metadata through file");
DECREF(got);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Plan/TestFullTextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFullTextType.c b/core/Lucy/Test/Plan/TestFullTextType.c
index 0a4436e..243dd69 100644
--- a/core/Lucy/Test/Plan/TestFullTextType.c
+++ b/core/Lucy/Test/Plan/TestFullTextType.c
@@ -52,7 +52,7 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
FullTextType_Set_Highlightable(highlightable, true);
// (This step is normally performed by Schema_Load() internally.)
- Hash_Store_Str((Hash*)another_dump, "analyzer", 8, INCREF(tokenizer));
+ Hash_Store_Utf8((Hash*)another_dump, "analyzer", 8, INCREF(tokenizer));
FullTextType *another_clone = FullTextType_Load(type, another_dump);
TEST_FALSE(runner, FullTextType_Equals(type, (Obj*)boost_differs),
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Search/TestQueryParserSyntax.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserSyntax.c b/core/Lucy/Test/Search/TestQueryParserSyntax.c
index d2aab4e..6a074b3 100644
--- a/core/Lucy/Test/Search/TestQueryParserSyntax.c
+++ b/core/Lucy/Test/Search/TestQueryParserSyntax.c
@@ -68,7 +68,7 @@ build_index() {
RegexTokenizer *word_tokenizer = RegexTokenizer_new(word_pattern);
Hash *stop_list = Hash_new(0);
- Hash_Store_Str(stop_list, "x", 1, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(stop_list, "x", 1, (Obj*)CFISH_TRUE);
SnowballStopFilter *stop_filter = SnowStop_new(NULL, stop_list);
VArray *analyzers = VA_new(0);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index ed6b945..6401f27 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -465,7 +465,7 @@ test_sort_spec(TestBatchRunner *runner) {
error = Err_trap(S_attempt_sorted_search, &sort_ctx);
TEST_TRUE(runner, error != NULL
&& Err_Is_A(error, ERR)
- && Str_Find_Str(Err_Get_Mess(error), "sortable", 8) != -1,
+ && Str_Find_Utf8(Err_Get_Mess(error), "sortable", 8) != -1,
"sorting on a non-sortable field throws an error");
DECREF(error);
@@ -473,7 +473,7 @@ test_sort_spec(TestBatchRunner *runner) {
error = Err_trap(S_attempt_sorted_search, &sort_ctx);
TEST_TRUE(runner, error != NULL
&& Err_Is_A(error, ERR)
- && Str_Find_Str(Err_Get_Mess(error), "sortable", 8) != -1,
+ && Str_Find_Utf8(Err_Get_Mess(error), "sortable", 8) != -1,
"sorting on an unknown field throws an error");
DECREF(error);
#endif
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Store/TestCompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestCompoundFileReader.c b/core/Lucy/Test/Store/TestCompoundFileReader.c
index bb7eb89..f493762 100644
--- a/core/Lucy/Test/Store/TestCompoundFileReader.c
+++ b/core/Lucy/Test/Store/TestCompoundFileReader.c
@@ -112,7 +112,7 @@ test_open(TestBatchRunner *runner) {
Err_set_error(NULL);
real_folder = S_folder_with_contents();
metadata = (Hash*)Json_slurp_json(real_folder, cfmeta_file);
- Hash_Store_Str(metadata, "format", 6, (Obj*)Str_newf("%i32", -1));
+ Hash_Store_Utf8(metadata, "format", 6, (Obj*)Str_newf("%i32", -1));
Folder_Delete(real_folder, cfmeta_file);
Json_spew_json((Obj*)metadata, real_folder, cfmeta_file);
cf_reader = CFReader_open(real_folder);
@@ -122,7 +122,7 @@ test_open(TestBatchRunner *runner) {
"Set Err_error when format is invalid");
Err_set_error(NULL);
- Hash_Store_Str(metadata, "format", 6, (Obj*)Str_newf("%i32", 1000));
+ Hash_Store_Utf8(metadata, "format", 6, (Obj*)Str_newf("%i32", 1000));
Folder_Delete(real_folder, cfmeta_file);
Json_spew_json((Obj*)metadata, real_folder, cfmeta_file);
cf_reader = CFReader_open(real_folder);
@@ -132,7 +132,7 @@ test_open(TestBatchRunner *runner) {
"Set Err_error when format too recent");
Err_set_error(NULL);
- DECREF(Hash_Delete_Str(metadata, "format", 6));
+ DECREF(Hash_Delete_Utf8(metadata, "format", 6));
Folder_Delete(real_folder, cfmeta_file);
Json_spew_json((Obj*)metadata, real_folder, cfmeta_file);
cf_reader = CFReader_open(real_folder);
@@ -141,9 +141,9 @@ test_open(TestBatchRunner *runner) {
TEST_TRUE(runner, Err_get_error() != NULL,
"Set Err_error when format key is missing");
- Hash_Store_Str(metadata, "format", 6,
- (Obj*)Str_newf("%i32", CFWriter_current_file_format));
- DECREF(Hash_Delete_Str(metadata, "files", 5));
+ Hash_Store_Utf8(metadata, "format", 6,
+ (Obj*)Str_newf("%i32", CFWriter_current_file_format));
+ DECREF(Hash_Delete_Utf8(metadata, "files", 5));
Folder_Delete(real_folder, cfmeta_file);
Json_spew_json((Obj*)metadata, real_folder, cfmeta_file);
cf_reader = CFReader_open(real_folder);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Store/TestCompoundFileWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestCompoundFileWriter.c b/core/Lucy/Test/Store/TestCompoundFileWriter.c
index 5ed0565..3918ca8 100644
--- a/core/Lucy/Test/Store/TestCompoundFileWriter.c
+++ b/core/Lucy/Test/Store/TestCompoundFileWriter.c
@@ -114,7 +114,7 @@ test_offsets(TestBatchRunner *runner) {
cf_metadata = (Hash*)CERTIFY(
Json_slurp_json(folder, cfmeta_file), HASH);
files = (Hash*)CERTIFY(
- Hash_Fetch_Str(cf_metadata, "files", 5), HASH);
+ Hash_Fetch_Utf8(cf_metadata, "files", 5), HASH);
String *file;
Obj *filestats;
@@ -125,7 +125,7 @@ test_offsets(TestBatchRunner *runner) {
Hash_Iterate(files);
while (Hash_Next(files, (Obj**)&file, &filestats)) {
Hash *stats = (Hash*)CERTIFY(filestats, HASH);
- Obj *offset = CERTIFY(Hash_Fetch_Str(stats, "offset", 6), OBJ);
+ Obj *offset = CERTIFY(Hash_Fetch_Utf8(stats, "offset", 6), OBJ);
int64_t offs = Obj_To_I64(offset);
if (offs % 8 != 0) {
offsets_ok = false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Store/TestFSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFolder.c b/core/Lucy/Test/Store/TestFSFolder.c
index 6c66f10..689bfa0 100644
--- a/core/Lucy/Test/Store/TestFSFolder.c
+++ b/core/Lucy/Test/Store/TestFSFolder.c
@@ -119,7 +119,7 @@ test_protect_symlinks(TestBatchRunner *runner) {
bool saw_bazooka_boffo = false;
for (uint32_t i = 0, max = VA_Get_Size(list); i < max; i++) {
String *entry = (String*)VA_Fetch(list, i);
- if (Str_Ends_With_Str(entry, "bazooka/boffo", 13)) {
+ if (Str_Ends_With_Utf8(entry, "bazooka/boffo", 13)) {
saw_bazooka_boffo = true;
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Store/TestFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFileHandle.c b/core/Lucy/Test/Store/TestFileHandle.c
index 3d1e94b..4942d35 100644
--- a/core/Lucy/Test/Store/TestFileHandle.c
+++ b/core/Lucy/Test/Store/TestFileHandle.c
@@ -56,7 +56,7 @@ TestFH_Run_IMP(TestFileHandle *self, TestBatchRunner *runner) {
FileHandle *fh = S_new_filehandle();
StackString *foo = SSTR_WRAP_STR("foo", 3);
- TEST_TRUE(runner, Str_Equals_Str(FH_Get_Path(fh), "", 0), "Get_Path");
+ TEST_TRUE(runner, Str_Equals_Utf8(FH_Get_Path(fh), "", 0), "Get_Path");
FH_Set_Path(fh, (String*)foo);
TEST_TRUE(runner, Str_Equals(FH_Get_Path(fh), (Obj*)foo), "Set_Path");
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Store/TestRAMFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestRAMFileHandle.c b/core/Lucy/Test/Store/TestRAMFileHandle.c
index c8a57b9..d276d5d 100644
--- a/core/Lucy/Test/Store/TestRAMFileHandle.c
+++ b/core/Lucy/Test/Store/TestRAMFileHandle.c
@@ -55,7 +55,7 @@ test_Read_Write(TestBatchRunner *runner) {
char buffer[12];
char *buf = buffer;
- TEST_TRUE(runner, Str_Equals_Str(RAMFH_Get_Path(fh), "", 0),
+ TEST_TRUE(runner, Str_Equals_Utf8(RAMFH_Get_Path(fh), "", 0),
"NULL arg as filepath yields empty string");
TEST_TRUE(runner, RAMFH_Write(fh, foo, 3), "Write returns success");
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Store/TestRAMFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestRAMFolder.c b/core/Lucy/Test/Store/TestRAMFolder.c
index 13aeb9d..c173897 100644
--- a/core/Lucy/Test/Store/TestRAMFolder.c
+++ b/core/Lucy/Test/Store/TestRAMFolder.c
@@ -159,7 +159,7 @@ test_Local_Find_Folder(TestBatchRunner *runner) {
TEST_TRUE(runner,
local
&& RAMFolder_Is_A(local, RAMFOLDER)
- && Str_Equals_Str(RAMFolder_Get_Path(local), "foo", 3),
+ && Str_Equals_Utf8(RAMFolder_Get_Path(local), "foo", 3),
"Find local directory");
DECREF(folder);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Util/TestIndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestIndexFileNames.c b/core/Lucy/Test/Util/TestIndexFileNames.c
index c2b55ee..c5b2a18 100644
--- a/core/Lucy/Test/Util/TestIndexFileNames.c
+++ b/core/Lucy/Test/Util/TestIndexFileNames.c
@@ -32,7 +32,7 @@ S_test_local_part(TestBatchRunner *runner, const char *source,
const char *wanted, const char *test_name) {
StackString *source_str = SSTR_WRAP_STR(source, strlen(source));
String *got = IxFileNames_local_part((String*)source_str);
- TEST_TRUE(runner, Str_Equals_Str(got, wanted, strlen(wanted)), test_name);
+ TEST_TRUE(runner, Str_Equals_Utf8(got, wanted, strlen(wanted)), test_name);
DECREF(got);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Test/Util/TestJson.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestJson.c b/core/Lucy/Test/Util/TestJson.c
index 3b17a6d..2fa7e32 100644
--- a/core/Lucy/Test/Util/TestJson.c
+++ b/core/Lucy/Test/Util/TestJson.c
@@ -35,8 +35,8 @@ TestJson_new() {
static Obj*
S_make_dump() {
Hash *dump = Hash_new(0);
- Hash_Store_Str(dump, "foo", 3, (Obj*)Str_newf("foo"));
- Hash_Store_Str(dump, "stuff", 5, (Obj*)VA_new(0));
+ Hash_Store_Utf8(dump, "foo", 3, (Obj*)Str_newf("foo"));
+ Hash_Store_Utf8(dump, "stuff", 5, (Obj*)VA_new(0));
return (Obj*)dump;
}
@@ -163,7 +163,7 @@ test_numbers(TestBatchRunner *runner) {
Integer64 *i64 = Int64_new(33);
String *json = Json_to_json((Obj*)i64);
String *trimmed = Str_Trim(json);
- TEST_TRUE(runner, Str_Equals_Str(trimmed, "33", 2), "Integer");
+ TEST_TRUE(runner, Str_Equals_Utf8(trimmed, "33", 2), "Integer");
DECREF(json);
DECREF(trimmed);
@@ -326,14 +326,14 @@ test_floats(TestBatchRunner *runner) {
static void
test_max_depth(TestBatchRunner *runner) {
Hash *circular = Hash_new(0);
- Hash_Store_Str(circular, "circular", 8, INCREF(circular));
+ Hash_Store_Utf8(circular, "circular", 8, INCREF(circular));
Err_set_error(NULL);
String *not_json = Json_to_json((Obj*)circular);
TEST_TRUE(runner, not_json == NULL,
"to_json returns NULL when fed recursing data");
TEST_TRUE(runner, Err_get_error() != NULL,
"to_json sets Err_error when fed recursing data");
- DECREF(Hash_Delete_Str(circular, "circular", 8));
+ DECREF(Hash_Delete_Utf8(circular, "circular", 8));
DECREF(circular);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Util/Freezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c
index e492962..521ea03 100644
--- a/core/Lucy/Util/Freezer.c
+++ b/core/Lucy/Util/Freezer.c
@@ -455,7 +455,7 @@ S_load_via_load_method(VTable *vtable, Obj *dump) {
static Obj*
S_load_from_hash(Hash *dump) {
- String *class_name = (String*)Hash_Fetch_Str(dump, "_class", 6);
+ String *class_name = (String*)Hash_Fetch_Utf8(dump, "_class", 6);
// Assume that the presence of the "_class" key paired with a valid class
// name indicates the output of a dump() rather than an ordinary Hash.
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Util/IndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/IndexFileNames.c b/core/Lucy/Util/IndexFileNames.c
index e3b7bf7..ee5d237 100644
--- a/core/Lucy/Util/IndexFileNames.c
+++ b/core/Lucy/Util/IndexFileNames.c
@@ -32,8 +32,8 @@ IxFileNames_latest_snapshot(Folder *folder) {
while (DH_Next(dh)) {
String *entry = DH_Get_Entry(dh);
- if (Str_Starts_With_Str(entry, "snapshot_", 9)
- && Str_Ends_With_Str(entry, ".json", 5)
+ if (Str_Starts_With_Utf8(entry, "snapshot_", 9)
+ && Str_Ends_With_Utf8(entry, ".json", 5)
) {
uint64_t gen = IxFileNames_extract_gen(entry);
if (gen > latest_gen) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index b5e7f57..c564c55 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -159,7 +159,7 @@ Json_to_json(Obj *dump) {
}
else {
// Append newline.
- CB_Cat_Trusted_UTF8(buf, "\n", 1);
+ CB_Cat_Trusted_Utf8(buf, "\n", 1);
json = CB_Yield_String(buf);
}
@@ -177,7 +177,7 @@ static const int32_t MAX_DEPTH = 200;
static void
S_append_json_string(String *dump, CharBuf *buf) {
// Append opening quote.
- CB_Cat_Trusted_UTF8(buf, "\"", 1);
+ CB_Cat_Trusted_Utf8(buf, "\"", 1);
// Process string data.
StringIterator *iter = Str_Top(dump);
@@ -241,12 +241,12 @@ S_append_json_string(String *dump, CharBuf *buf) {
buffer[0] = (char)code_point;
len = 1;
}
- CB_Cat_Trusted_UTF8(buf, buffer, len);
+ CB_Cat_Trusted_Utf8(buf, buffer, len);
}
}
// Append closing quote.
- CB_Cat_Trusted_UTF8(buf, "\"", 1);
+ CB_Cat_Trusted_Utf8(buf, "\"", 1);
DECREF(iter);
}
@@ -254,7 +254,7 @@ S_append_json_string(String *dump, CharBuf *buf) {
static void
S_cat_whitespace(CharBuf *buf, int32_t depth) {
while (depth--) {
- CB_Cat_Trusted_UTF8(buf, indentation, INDENTATION_LEN);
+ CB_Cat_Trusted_Utf8(buf, indentation, INDENTATION_LEN);
}
}
@@ -268,13 +268,13 @@ S_to_json(Obj *dump, CharBuf *buf, int32_t depth) {
}
if (!dump) {
- CB_Cat_Trusted_UTF8(buf, "null", 4);
+ CB_Cat_Trusted_Utf8(buf, "null", 4);
}
else if (dump == (Obj*)CFISH_TRUE) {
- CB_Cat_Trusted_UTF8(buf, "true", 4);
+ CB_Cat_Trusted_Utf8(buf, "true", 4);
}
else if (dump == (Obj*)CFISH_FALSE) {
- CB_Cat_Trusted_UTF8(buf, "false", 5);
+ CB_Cat_Trusted_Utf8(buf, "false", 5);
}
else if (Obj_Is_A(dump, STRING)) {
S_append_json_string((String*)dump, buf);
@@ -290,36 +290,36 @@ S_to_json(Obj *dump, CharBuf *buf, int32_t depth) {
size_t size = VA_Get_Size(array);
if (size == 0) {
// Put empty array on single line.
- CB_Cat_Trusted_UTF8(buf, "[]", 2);
+ CB_Cat_Trusted_Utf8(buf, "[]", 2);
return true;
}
else if (size == 1) {
Obj *elem = VA_Fetch(array, 0);
if (!(Obj_Is_A(elem, HASH) || Obj_Is_A(elem, VARRAY))) {
// Put array containing single scalar element on one line.
- CB_Cat_Trusted_UTF8(buf, "[", 1);
+ CB_Cat_Trusted_Utf8(buf, "[", 1);
if (!S_to_json(elem, buf, depth + 1)) {
return false;
}
- CB_Cat_Trusted_UTF8(buf, "]", 1);
+ CB_Cat_Trusted_Utf8(buf, "]", 1);
return true;
}
}
// Fall back to spreading elements across multiple lines.
- CB_Cat_Trusted_UTF8(buf, "[", 1);
+ CB_Cat_Trusted_Utf8(buf, "[", 1);
for (size_t i = 0; i < size; i++) {
- CB_Cat_Trusted_UTF8(buf, "\n", 1);
+ CB_Cat_Trusted_Utf8(buf, "\n", 1);
S_cat_whitespace(buf, depth + 1);
if (!S_to_json(VA_Fetch(array, i), buf, depth + 1)) {
return false;
}
if (i + 1 < size) {
- CB_Cat_Trusted_UTF8(buf, ",", 1);
+ CB_Cat_Trusted_Utf8(buf, ",", 1);
}
}
- CB_Cat_Trusted_UTF8(buf, "\n", 1);
+ CB_Cat_Trusted_Utf8(buf, "\n", 1);
S_cat_whitespace(buf, depth);
- CB_Cat_Trusted_UTF8(buf, "]", 1);
+ CB_Cat_Trusted_Utf8(buf, "]", 1);
}
else if (Obj_Is_A(dump, HASH)) {
Hash *hash = (Hash*)dump;
@@ -327,7 +327,7 @@ S_to_json(Obj *dump, CharBuf *buf, int32_t depth) {
// Put empty hash on single line.
if (size == 0) {
- CB_Cat_Trusted_UTF8(buf, "{}", 2);
+ CB_Cat_Trusted_Utf8(buf, "{}", 2);
return true;
}
@@ -346,24 +346,24 @@ S_to_json(Obj *dump, CharBuf *buf, int32_t depth) {
VA_Sort(keys, NULL, NULL);
// Spread pairs across multiple lines.
- CB_Cat_Trusted_UTF8(buf, "{", 1);
+ CB_Cat_Trusted_Utf8(buf, "{", 1);
for (size_t i = 0; i < size; i++) {
Obj *key = VA_Fetch(keys, i);
- CB_Cat_Trusted_UTF8(buf, "\n", 1);
+ CB_Cat_Trusted_Utf8(buf, "\n", 1);
S_cat_whitespace(buf, depth + 1);
S_append_json_string((String*)key, buf);
- CB_Cat_Trusted_UTF8(buf, ": ", 2);
+ CB_Cat_Trusted_Utf8(buf, ": ", 2);
if (!S_to_json(Hash_Fetch(hash, key), buf, depth + 1)) {
DECREF(keys);
return false;
}
if (i + 1 < size) {
- CB_Cat_Trusted_UTF8(buf, ",", 1);
+ CB_Cat_Trusted_Utf8(buf, ",", 1);
}
}
- CB_Cat_Trusted_UTF8(buf, "\n", 1);
+ CB_Cat_Trusted_Utf8(buf, "\n", 1);
S_cat_whitespace(buf, depth);
- CB_Cat_Trusted_UTF8(buf, "}", 1);
+ CB_Cat_Trusted_Utf8(buf, "}", 1);
DECREF(keys);
}
[lucy-commits] [03/50] [abbrv] git commit: refs/heads/master - Eliminate
Str_Mimic_Str in PostingPool
Posted by nw...@apache.org.
Eliminate Str_Mimic_Str in PostingPool
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f5219475
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f5219475
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f5219475
Branch: refs/heads/master
Commit: f5219475b7d3d3e4f8022ca2e0f7167f79d65ac2
Parents: f042ed3
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 9 22:43:37 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:13 2013 +0200
----------------------------------------------------------------------
core/Lucy/Index/PostingPool.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/f5219475/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index 0794bc4..86eab72 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -363,7 +363,6 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
TermInfo *const skip_tinfo = TInfo_new(0);
TermInfoIVARS *const tinfo_ivars = TInfo_IVARS(tinfo);
TermInfoIVARS *const skip_tinfo_ivars = TInfo_IVARS(skip_tinfo);
- String *const last_term_text = Str_new(0);
LexiconWriter *const lex_writer = ivars->lex_writer;
SkipStepper *const skip_stepper = ivars->skip_stepper;
SkipStepperIVARS *const skip_stepper_ivars
@@ -378,7 +377,8 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
(*(RawPosting**)PostPool_Fetch(self)),
RAWPOSTING);
RawPostingIVARS *post_ivars = RawPost_IVARS(posting);
- Str_Mimic_Str(last_term_text, post_ivars->blob, post_ivars->content_len);
+ String *last_term_text
+ = Str_new_from_utf8(post_ivars->blob, post_ivars->content_len);
char *last_text_buf = (char*)Str_Get_Ptr8(last_term_text);
uint32_t last_text_size = Str_Get_Size(last_term_text);
SkipStepper_Set_ID_And_Filepos(skip_stepper, 0, 0);
@@ -426,8 +426,9 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
last_skip_filepos = tinfo_ivars->post_filepos;
// Remember the term_text so we can write string diffs.
- Str_Mimic_Str(last_term_text, post_ivars->blob,
- post_ivars->content_len);
+ DECREF(last_term_text);
+ last_term_text
+ = Str_new_from_utf8(post_ivars->blob, post_ivars->content_len);
last_text_buf = (char*)Str_Get_Ptr8(last_term_text);
last_text_size = Str_Get_Size(last_term_text);
}
[lucy-commits] [37/50] [abbrv] Convert "const String" to "String"
Posted by nw...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/Segment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c
index 511b15a..cda56c4 100644
--- a/core/Lucy/Index/Segment.c
+++ b/core/Lucy/Index/Segment.c
@@ -64,7 +64,7 @@ Seg_num_to_name(int64_t number) {
}
bool
-Seg_valid_seg_name(const String *name) {
+Seg_valid_seg_name(String *name) {
if (Str_Starts_With_Utf8(name, "seg_", 4)) {
StringIterator *iter = Str_Top(name);
StrIter_Advance(iter, 4);
@@ -158,7 +158,7 @@ Seg_Write_File_IMP(Segment *self, Folder *folder) {
}
int32_t
-Seg_Add_Field_IMP(Segment *self, const String *field) {
+Seg_Add_Field_IMP(Segment *self, String *field) {
SegmentIVARS *const ivars = Seg_IVARS(self);
Integer32 *num = (Integer32*)Hash_Fetch(ivars->by_name, (Obj*)field);
if (num) {
@@ -200,7 +200,7 @@ Seg_Increment_Count_IMP(Segment *self, int64_t increment) {
}
void
-Seg_Store_Metadata_IMP(Segment *self, const String *key, Obj *value) {
+Seg_Store_Metadata_IMP(Segment *self, String *key, Obj *value) {
SegmentIVARS *const ivars = Seg_IVARS(self);
if (Hash_Fetch(ivars->metadata, (Obj*)key)) {
THROW(ERR, "Metadata key '%o' already registered", key);
@@ -216,7 +216,7 @@ Seg_Store_Metadata_Utf8_IMP(Segment *self, const char *key, size_t key_len,
}
Obj*
-Seg_Fetch_Metadata_IMP(Segment *self, const String *key) {
+Seg_Fetch_Metadata_IMP(Segment *self, String *key) {
SegmentIVARS *const ivars = Seg_IVARS(self);
return Hash_Fetch(ivars->metadata, (Obj*)key);
}
@@ -251,7 +251,7 @@ Seg_Field_Name_IMP(Segment *self, int32_t field_num) {
}
int32_t
-Seg_Field_Num_IMP(Segment *self, const String *field) {
+Seg_Field_Num_IMP(Segment *self, String *field) {
if (field == NULL) {
return 0;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/Segment.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Segment.cfh b/core/Lucy/Index/Segment.cfh
index 43ca509..a1438a3 100644
--- a/core/Lucy/Index/Segment.cfh
+++ b/core/Lucy/Index/Segment.cfh
@@ -55,7 +55,7 @@ public class Lucy::Index::Segment cnick Seg inherits Clownfish::Obj {
* pattern: /^seg_\w+$/
*/
inert bool
- valid_seg_name(const String *name);
+ valid_seg_name(String *name);
/** Register a new field and assign it a field number. If the field was
* already known, nothing happens.
@@ -64,7 +64,7 @@ public class Lucy::Index::Segment cnick Seg inherits Clownfish::Obj {
* @return the field's field number, which is a positive integer.
*/
public int32_t
- Add_Field(Segment *self, const String *field);
+ Add_Field(Segment *self, String *field);
/** Store arbitrary information in the segment's metadata Hash, to be
* serialized later. Throws an error if <code>key</code> is used twice.
@@ -73,7 +73,7 @@ public class Lucy::Index::Segment cnick Seg inherits Clownfish::Obj {
* @param metadata JSON-izable data structure.
*/
public void
- Store_Metadata(Segment *self, const String *key,
+ Store_Metadata(Segment *self, String *key,
decremented Obj *metadata);
void
@@ -83,7 +83,7 @@ public class Lucy::Index::Segment cnick Seg inherits Clownfish::Obj {
/** Fetch a value from the Segment's metadata hash.
*/
public nullable Obj*
- Fetch_Metadata(Segment *self, const String *key);
+ Fetch_Metadata(Segment *self, String *key);
nullable Obj*
Fetch_Metadata_Utf8(Segment *self, const char *key, size_t len);
@@ -95,7 +95,7 @@ public class Lucy::Index::Segment cnick Seg inherits Clownfish::Obj {
* @param field Field name.
*/
public int32_t
- Field_Num(Segment *self, const String *field);
+ Field_Num(Segment *self, String *field);
/** Given a field number, return the name of its field, or NULL if the
* field name can't be found.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/Snapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Snapshot.c b/core/Lucy/Index/Snapshot.c
index 3f32465..1728e6b 100644
--- a/core/Lucy/Index/Snapshot.c
+++ b/core/Lucy/Index/Snapshot.c
@@ -60,13 +60,13 @@ Snapshot_Destroy_IMP(Snapshot *self) {
}
void
-Snapshot_Add_Entry_IMP(Snapshot *self, const String *entry) {
+Snapshot_Add_Entry_IMP(Snapshot *self, String *entry) {
SnapshotIVARS *const ivars = Snapshot_IVARS(self);
Hash_Store(ivars->entries, (Obj*)entry, (Obj*)CFISH_TRUE);
}
bool
-Snapshot_Delete_Entry_IMP(Snapshot *self, const String *entry) {
+Snapshot_Delete_Entry_IMP(Snapshot *self, String *entry) {
SnapshotIVARS *const ivars = Snapshot_IVARS(self);
Obj *val = Hash_Delete(ivars->entries, (Obj*)entry);
if (val) {
@@ -91,7 +91,7 @@ Snapshot_Num_Entries_IMP(Snapshot *self) {
}
void
-Snapshot_Set_Path_IMP(Snapshot *self, const String *path) {
+Snapshot_Set_Path_IMP(Snapshot *self, String *path) {
SnapshotIVARS *const ivars = Snapshot_IVARS(self);
DECREF(ivars->path);
ivars->path = path ? Str_Clone(path) : NULL;
@@ -103,7 +103,7 @@ Snapshot_Get_Path_IMP(Snapshot *self) {
}
Snapshot*
-Snapshot_Read_File_IMP(Snapshot *self, Folder *folder, const String *path) {
+Snapshot_Read_File_IMP(Snapshot *self, Folder *folder, String *path) {
SnapshotIVARS *const ivars = Snapshot_IVARS(self);
// Eliminate all prior data. Pick a snapshot file.
@@ -170,7 +170,7 @@ S_clean_segment_contents(VArray *orig) {
void
-Snapshot_Write_File_IMP(Snapshot *self, Folder *folder, const String *path) {
+Snapshot_Write_File_IMP(Snapshot *self, Folder *folder, String *path) {
SnapshotIVARS *const ivars = Snapshot_IVARS(self);
Hash *all_data = Hash_new(0);
VArray *list = Snapshot_List(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/Snapshot.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Snapshot.cfh b/core/Lucy/Index/Snapshot.cfh
index 01bff99..c7d69b7 100644
--- a/core/Lucy/Index/Snapshot.cfh
+++ b/core/Lucy/Index/Snapshot.cfh
@@ -55,7 +55,7 @@ public class Lucy::Index::Snapshot inherits Clownfish::Obj {
/** Add a filepath to the snapshot.
*/
public void
- Add_Entry(Snapshot *self, const String *entry);
+ Add_Entry(Snapshot *self, String *entry);
/** Delete a filepath from the snapshot.
*
@@ -63,7 +63,7 @@ public class Lucy::Index::Snapshot inherits Clownfish::Obj {
* otherwise.
*/
public bool
- Delete_Entry(Snapshot *self, const String *entry);
+ Delete_Entry(Snapshot *self, String *entry);
/** Decode a snapshot file and initialize the object to reflect its
* contents.
@@ -74,7 +74,7 @@ public class Lucy::Index::Snapshot inherits Clownfish::Obj {
* @return the object, allowing an assignment idiom.
*/
public Snapshot*
- Read_File(Snapshot *self, Folder *folder, const String *path = NULL);
+ Read_File(Snapshot *self, Folder *folder, String *path = NULL);
/** Write a snapshot file. The caller must lock the index while this
* operation takes place, and the operation will fail if the snapshot file
@@ -86,13 +86,13 @@ public class Lucy::Index::Snapshot inherits Clownfish::Obj {
* folder.
*/
public void
- Write_File(Snapshot *self, Folder *folder, const String *path = NULL);
+ Write_File(Snapshot *self, Folder *folder, String *path = NULL);
/** Set the path to the file that the Snapshot object serves as a proxy
* for.
*/
public void
- Set_Path(Snapshot *self, const String *path);
+ Set_Path(Snapshot *self, String *path);
/** Get the path to the snapshot file. Initially NULL; updated by
* Read_File(), Write_File(), and Set_Path().
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache.c b/core/Lucy/Index/SortCache.c
index 446ced2..3fe006f 100644
--- a/core/Lucy/Index/SortCache.c
+++ b/core/Lucy/Index/SortCache.c
@@ -21,7 +21,7 @@
#include "Lucy/Plan/FieldType.h"
SortCache*
-SortCache_init(SortCache *self, const String *field, FieldType *type,
+SortCache_init(SortCache *self, String *field, FieldType *type,
void *ords, int32_t cardinality, int32_t doc_max, int32_t null_ord,
int32_t ord_width) {
SortCacheIVARS *const ivars = SortCache_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortCache.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache.cfh b/core/Lucy/Index/SortCache.cfh
index f16b78f..380c28d 100644
--- a/core/Lucy/Index/SortCache.cfh
+++ b/core/Lucy/Index/SortCache.cfh
@@ -30,7 +30,7 @@ class Lucy::Index::SortCache inherits Clownfish::Obj {
bool native_ords;
public inert SortCache*
- init(SortCache *self, const String *field, FieldType *type,
+ init(SortCache *self, String *field, FieldType *type,
void *ords, int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortCache/NumericSortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/NumericSortCache.c b/core/Lucy/Index/SortCache/NumericSortCache.c
index fe35359..1fba4f1 100644
--- a/core/Lucy/Index/SortCache/NumericSortCache.c
+++ b/core/Lucy/Index/SortCache/NumericSortCache.c
@@ -30,7 +30,7 @@
#include "Lucy/Store/Folder.h"
NumericSortCache*
-NumSortCache_init(NumericSortCache *self, const String *field,
+NumSortCache_init(NumericSortCache *self, String *field,
FieldType *type, int32_t cardinality, int32_t doc_max,
int32_t null_ord, int32_t ord_width, InStream *ord_in,
InStream *dat_in) {
@@ -82,7 +82,7 @@ NumSortCache_Destroy_IMP(NumericSortCache *self) {
/***************************************************************************/
Float64SortCache*
-F64SortCache_new(const String *field, FieldType *type, int32_t cardinality,
+F64SortCache_new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord, int32_t ord_width,
InStream *ord_in, InStream *dat_in) {
Float64SortCache *self
@@ -92,7 +92,7 @@ F64SortCache_new(const String *field, FieldType *type, int32_t cardinality,
}
Float64SortCache*
-F64SortCache_init(Float64SortCache *self, const String *field,
+F64SortCache_init(Float64SortCache *self, String *field,
FieldType *type, int32_t cardinality, int32_t doc_max,
int32_t null_ord, int32_t ord_width, InStream *ord_in,
InStream *dat_in) {
@@ -120,7 +120,7 @@ F64SortCache_Value_IMP(Float64SortCache *self, int32_t ord) {
/***************************************************************************/
Float32SortCache*
-F32SortCache_new(const String *field, FieldType *type, int32_t cardinality,
+F32SortCache_new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord, int32_t ord_width,
InStream *ord_in, InStream *dat_in) {
Float32SortCache *self
@@ -130,7 +130,7 @@ F32SortCache_new(const String *field, FieldType *type, int32_t cardinality,
}
Float32SortCache*
-F32SortCache_init(Float32SortCache *self, const String *field,
+F32SortCache_init(Float32SortCache *self, String *field,
FieldType *type, int32_t cardinality, int32_t doc_max,
int32_t null_ord, int32_t ord_width, InStream *ord_in,
InStream *dat_in) {
@@ -158,7 +158,7 @@ F32SortCache_Value_IMP(Float32SortCache *self, int32_t ord) {
/***************************************************************************/
Int32SortCache*
-I32SortCache_new(const String *field, FieldType *type, int32_t cardinality,
+I32SortCache_new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord, int32_t ord_width,
InStream *ord_in, InStream *dat_in) {
Int32SortCache *self
@@ -168,7 +168,7 @@ I32SortCache_new(const String *field, FieldType *type, int32_t cardinality,
}
Int32SortCache*
-I32SortCache_init(Int32SortCache *self, const String *field,
+I32SortCache_init(Int32SortCache *self, String *field,
FieldType *type, int32_t cardinality, int32_t doc_max,
int32_t null_ord, int32_t ord_width, InStream *ord_in,
InStream *dat_in) {
@@ -196,7 +196,7 @@ I32SortCache_Value_IMP(Int32SortCache *self, int32_t ord) {
/***************************************************************************/
Int64SortCache*
-I64SortCache_new(const String *field, FieldType *type, int32_t cardinality,
+I64SortCache_new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord, int32_t ord_width,
InStream *ord_in, InStream *dat_in) {
Int64SortCache *self
@@ -206,7 +206,7 @@ I64SortCache_new(const String *field, FieldType *type, int32_t cardinality,
}
Int64SortCache*
-I64SortCache_init(Int64SortCache *self, const String *field,
+I64SortCache_init(Int64SortCache *self, String *field,
FieldType *type, int32_t cardinality, int32_t doc_max,
int32_t null_ord, int32_t ord_width, InStream *ord_in,
InStream *dat_in) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortCache/NumericSortCache.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/NumericSortCache.cfh b/core/Lucy/Index/SortCache/NumericSortCache.cfh
index 4b6de04..3d23200 100644
--- a/core/Lucy/Index/SortCache/NumericSortCache.cfh
+++ b/core/Lucy/Index/SortCache/NumericSortCache.cfh
@@ -23,7 +23,7 @@ class Lucy::Index::SortCache::NumericSortCache cnick NumSortCache
InStream *dat_in;
inert NumericSortCache*
- init(NumericSortCache *self, const String *field, FieldType *type,
+ init(NumericSortCache *self, String *field, FieldType *type,
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *dat_in);
@@ -35,12 +35,12 @@ class Lucy::Index::SortCache::Float64SortCache cnick F64SortCache
inherits Lucy::Index::SortCache::NumericSortCache {
public inert incremented Float64SortCache*
- new(const String *field, FieldType *type, int32_t cardinality,
+ new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
InStream *ord_in, InStream *dat_in);
public inert Float64SortCache*
- init(Float64SortCache *self, const String *field, FieldType *type,
+ init(Float64SortCache *self, String *field, FieldType *type,
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *dat_in);
@@ -52,12 +52,12 @@ class Lucy::Index::SortCache::Float32SortCache cnick F32SortCache
inherits Lucy::Index::SortCache::NumericSortCache {
public inert incremented Float32SortCache*
- new(const String *field, FieldType *type, int32_t cardinality,
+ new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
InStream *ord_in, InStream *dat_in);
public inert Float32SortCache*
- init(Float32SortCache *self, const String *field, FieldType *type,
+ init(Float32SortCache *self, String *field, FieldType *type,
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *dat_in);
@@ -69,12 +69,12 @@ class Lucy::Index::SortCache::Int32SortCache cnick I32SortCache
inherits Lucy::Index::SortCache::NumericSortCache {
public inert incremented Int32SortCache*
- new(const String *field, FieldType *type, int32_t cardinality,
+ new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
InStream *ord_in, InStream *dat_in);
public inert Int32SortCache*
- init(Int32SortCache *self, const String *field, FieldType *type,
+ init(Int32SortCache *self, String *field, FieldType *type,
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *dat_in);
@@ -86,12 +86,12 @@ class Lucy::Index::SortCache::Int64SortCache cnick I64SortCache
inherits Lucy::Index::SortCache::NumericSortCache {
public inert incremented Int64SortCache*
- new(const String *field, FieldType *type, int32_t cardinality,
+ new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
InStream *ord_in, InStream *dat_in);
public inert Int64SortCache*
- init(Int64SortCache *self, const String *field, FieldType *type,
+ init(Int64SortCache *self, String *field, FieldType *type,
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *dat_in);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortCache/TextSortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/TextSortCache.c b/core/Lucy/Index/SortCache/TextSortCache.c
index b96c49f..19fa3df 100644
--- a/core/Lucy/Index/SortCache/TextSortCache.c
+++ b/core/Lucy/Index/SortCache/TextSortCache.c
@@ -25,7 +25,7 @@
#include "Lucy/Store/Folder.h"
TextSortCache*
-TextSortCache_new(const String *field, FieldType *type, int32_t cardinality,
+TextSortCache_new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord, int32_t ord_width,
InStream *ord_in, InStream *ix_in, InStream *dat_in) {
TextSortCache *self = (TextSortCache*)VTable_Make_Obj(TEXTSORTCACHE);
@@ -34,7 +34,7 @@ TextSortCache_new(const String *field, FieldType *type, int32_t cardinality,
}
TextSortCache*
-TextSortCache_init(TextSortCache *self, const String *field,
+TextSortCache_init(TextSortCache *self, String *field,
FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord, int32_t ord_width,
InStream *ord_in, InStream *ix_in, InStream *dat_in) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortCache/TextSortCache.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/TextSortCache.cfh b/core/Lucy/Index/SortCache/TextSortCache.cfh
index 66b73c1..a933e05 100644
--- a/core/Lucy/Index/SortCache/TextSortCache.cfh
+++ b/core/Lucy/Index/SortCache/TextSortCache.cfh
@@ -26,12 +26,12 @@ class Lucy::Index::SortCache::TextSortCache
InStream *dat_in;
inert incremented TextSortCache*
- new(const String *field, FieldType *type, int32_t cardinality,
+ new(String *field, FieldType *type, int32_t cardinality,
int32_t doc_max, int32_t null_ord = -1, int32_t ord_width,
InStream *ord_in, InStream *ix_in, InStream *dat_in);
inert TextSortCache*
- init(TextSortCache *self, const String *field, FieldType *type,
+ init(TextSortCache *self, String *field, FieldType *type,
int32_t cardinality, int32_t doc_max, int32_t null_ord = -1,
int32_t ord_width, InStream *ord_in, InStream *ix_in,
InStream *dat_in);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 18ace6a..e7d35cf 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -57,7 +57,7 @@ typedef struct lucy_SFWriterElem {
SortFieldWriter*
SortFieldWriter_new(Schema *schema, Snapshot *snapshot, Segment *segment,
- PolyReader *polyreader, const String *field,
+ PolyReader *polyreader, String *field,
MemoryPool *memory_pool, size_t mem_thresh,
OutStream *temp_ord_out, OutStream *temp_ix_out,
OutStream *temp_dat_out) {
@@ -71,7 +71,7 @@ SortFieldWriter_new(Schema *schema, Snapshot *snapshot, Segment *segment,
SortFieldWriter*
SortFieldWriter_init(SortFieldWriter *self, Schema *schema,
Snapshot *snapshot, Segment *segment,
- PolyReader *polyreader, const String *field,
+ PolyReader *polyreader, String *field,
MemoryPool *memory_pool, size_t mem_thresh,
OutStream *temp_ord_out, OutStream *temp_ix_out,
OutStream *temp_dat_out) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortFieldWriter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.cfh b/core/Lucy/Index/SortFieldWriter.cfh
index 274961c..ac25515 100644
--- a/core/Lucy/Index/SortFieldWriter.cfh
+++ b/core/Lucy/Index/SortFieldWriter.cfh
@@ -55,13 +55,13 @@ class Lucy::Index::SortFieldWriter
inert incremented SortFieldWriter*
new(Schema *schema, Snapshot *snapshot, Segment *segment,
- PolyReader *polyreader, const String *field, MemoryPool *memory_pool,
+ PolyReader *polyreader, String *field, MemoryPool *memory_pool,
size_t mem_thresh, OutStream *temp_ord_out, OutStream *temp_ix_out,
OutStream *temp_dat_out);
inert SortFieldWriter*
init(SortFieldWriter *self, Schema *schema, Snapshot *snapshot,
- Segment *segment, PolyReader *polyreader, const String *field,
+ Segment *segment, PolyReader *polyreader, String *field,
MemoryPool *memory_pool, size_t mem_thresh, OutStream *temp_ord_out,
OutStream *temp_ix_out, OutStream *temp_dat_out);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortReader.c b/core/Lucy/Index/SortReader.c
index efbd994..af337e2 100644
--- a/core/Lucy/Index/SortReader.c
+++ b/core/Lucy/Index/SortReader.c
@@ -155,7 +155,7 @@ S_calc_ord_width(int32_t cardinality) {
}
static SortCache*
-S_lazy_init_sort_cache(DefaultSortReader *self, const String *field) {
+S_lazy_init_sort_cache(DefaultSortReader *self, String *field) {
DefaultSortReaderIVARS *const ivars = DefSortReader_IVARS(self);
// See if we have any values.
@@ -257,7 +257,7 @@ S_lazy_init_sort_cache(DefaultSortReader *self, const String *field) {
SortCache*
DefSortReader_Fetch_Sort_Cache_IMP(DefaultSortReader *self,
- const String *field) {
+ String *field) {
SortCache *cache = NULL;
if (field) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/SortReader.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortReader.cfh b/core/Lucy/Index/SortReader.cfh
index ec57b22..db433c0 100644
--- a/core/Lucy/Index/SortReader.cfh
+++ b/core/Lucy/Index/SortReader.cfh
@@ -27,7 +27,7 @@ abstract class Lucy::Index::SortReader
int32_t seg_tick = -1);
abstract nullable SortCache*
- Fetch_Sort_Cache(SortReader *self, const String *field);
+ Fetch_Sort_Cache(SortReader *self, String *field);
/** Returns NULL, since multi-segment sort caches cannot be produced by
* the default implementation.
@@ -55,7 +55,7 @@ class Lucy::Index::DefaultSortReader cnick DefSortReader
Snapshot *snapshot, VArray *segments, int32_t seg_tick);
nullable SortCache*
- Fetch_Sort_Cache(DefaultSortReader *self, const String *field);
+ Fetch_Sort_Cache(DefaultSortReader *self, String *field);
public void
Close(DefaultSortReader *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/TermVector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/TermVector.c b/core/Lucy/Index/TermVector.c
index 79dd977..edf8a8b 100644
--- a/core/Lucy/Index/TermVector.c
+++ b/core/Lucy/Index/TermVector.c
@@ -24,14 +24,14 @@
#include "Lucy/Util/Freezer.h"
TermVector*
-TV_new(const String *field, const String *text, I32Array *positions,
+TV_new(String *field, String *text, I32Array *positions,
I32Array *start_offsets, I32Array *end_offsets) {
TermVector *self = (TermVector*)VTable_Make_Obj(TERMVECTOR);
return TV_init(self, field, text, positions, start_offsets, end_offsets);
}
TermVector*
-TV_init(TermVector *self, const String *field, const String *text,
+TV_init(TermVector *self, String *field, String *text,
I32Array *positions, I32Array *start_offsets, I32Array *end_offsets) {
TermVectorIVARS *const ivars = TV_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Index/TermVector.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/TermVector.cfh b/core/Lucy/Index/TermVector.cfh
index 554602a..aed47df 100644
--- a/core/Lucy/Index/TermVector.cfh
+++ b/core/Lucy/Index/TermVector.cfh
@@ -33,11 +33,11 @@ class Lucy::Index::TermVector cnick TV
* start_offsets, and end_offsets arrays.
*/
inert incremented TermVector*
- new(const String *field, const String *text, I32Array *positions,
+ new(String *field, String *text, I32Array *positions,
I32Array *start_offsets, I32Array *end_offsets);
inert TermVector*
- init(TermVector *self, const String *field, const String *text,
+ init(TermVector *self, String *field, String *text,
I32Array *positions, I32Array *start_offsets, I32Array *end_offsets);
I32Array*
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Plan/Schema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.c b/core/Lucy/Plan/Schema.c
index 070d6ce..4173145 100644
--- a/core/Lucy/Plan/Schema.c
+++ b/core/Lucy/Plan/Schema.c
@@ -38,13 +38,13 @@ static void
S_add_unique(VArray *array, Obj *elem);
static void
-S_add_text_field(Schema *self, const String *field, FieldType *type);
+S_add_text_field(Schema *self, String *field, FieldType *type);
static void
-S_add_string_field(Schema *self, const String *field, FieldType *type);
+S_add_string_field(Schema *self, String *field, FieldType *type);
static void
-S_add_blob_field(Schema *self, const String *field, FieldType *type);
+S_add_blob_field(Schema *self, String *field, FieldType *type);
static void
-S_add_numeric_field(Schema *self, const String *field, FieldType *type);
+S_add_numeric_field(Schema *self, String *field, FieldType *type);
Schema*
Schema_new() {
@@ -114,7 +114,7 @@ Schema_Architecture_IMP(Schema *self) {
}
void
-Schema_Spec_Field_IMP(Schema *self, const String *field, FieldType *type) {
+Schema_Spec_Field_IMP(Schema *self, String *field, FieldType *type) {
FieldType *existing = Schema_Fetch_Type(self, field);
// If the field already has an association, verify pairing and return.
@@ -141,7 +141,7 @@ Schema_Spec_Field_IMP(Schema *self, const String *field, FieldType *type) {
}
static void
-S_add_text_field(Schema *self, const String *field, FieldType *type) {
+S_add_text_field(Schema *self, String *field, FieldType *type) {
SchemaIVARS *const ivars = Schema_IVARS(self);
FullTextType *fttype = (FullTextType*)CERTIFY(type, FULLTEXTTYPE);
Similarity *sim = FullTextType_Make_Similarity(fttype);
@@ -157,7 +157,7 @@ S_add_text_field(Schema *self, const String *field, FieldType *type) {
}
static void
-S_add_string_field(Schema *self, const String *field, FieldType *type) {
+S_add_string_field(Schema *self, String *field, FieldType *type) {
SchemaIVARS *const ivars = Schema_IVARS(self);
StringType *string_type = (StringType*)CERTIFY(type, STRINGTYPE);
Similarity *sim = StringType_Make_Similarity(string_type);
@@ -170,27 +170,27 @@ S_add_string_field(Schema *self, const String *field, FieldType *type) {
}
static void
-S_add_blob_field(Schema *self, const String *field, FieldType *type) {
+S_add_blob_field(Schema *self, String *field, FieldType *type) {
SchemaIVARS *const ivars = Schema_IVARS(self);
BlobType *blob_type = (BlobType*)CERTIFY(type, BLOBTYPE);
Hash_Store(ivars->types, (Obj*)field, INCREF(blob_type));
}
static void
-S_add_numeric_field(Schema *self, const String *field, FieldType *type) {
+S_add_numeric_field(Schema *self, String *field, FieldType *type) {
SchemaIVARS *const ivars = Schema_IVARS(self);
NumericType *num_type = (NumericType*)CERTIFY(type, NUMERICTYPE);
Hash_Store(ivars->types, (Obj*)field, INCREF(num_type));
}
FieldType*
-Schema_Fetch_Type_IMP(Schema *self, const String *field) {
+Schema_Fetch_Type_IMP(Schema *self, String *field) {
SchemaIVARS *const ivars = Schema_IVARS(self);
return (FieldType*)Hash_Fetch(ivars->types, (Obj*)field);
}
Analyzer*
-Schema_Fetch_Analyzer_IMP(Schema *self, const String *field) {
+Schema_Fetch_Analyzer_IMP(Schema *self, String *field) {
SchemaIVARS *const ivars = Schema_IVARS(self);
return field
? (Analyzer*)Hash_Fetch(ivars->analyzers, (Obj*)field)
@@ -198,7 +198,7 @@ Schema_Fetch_Analyzer_IMP(Schema *self, const String *field) {
}
Similarity*
-Schema_Fetch_Sim_IMP(Schema *self, const String *field) {
+Schema_Fetch_Sim_IMP(Schema *self, String *field) {
SchemaIVARS *const ivars = Schema_IVARS(self);
Similarity *sim = NULL;
if (field != NULL) {
@@ -418,7 +418,7 @@ Schema_Eat_IMP(Schema *self, Schema *other) {
}
void
-Schema_Write_IMP(Schema *self, Folder *folder, const String *filename) {
+Schema_Write_IMP(Schema *self, Folder *folder, String *filename) {
Hash *dump = Schema_Dump(self);
StackString *schema_temp = SSTR_WRAP_UTF8("schema.temp", 11);
bool success;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Plan/Schema.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.cfh b/core/Lucy/Plan/Schema.cfh
index 527b68f..9767d85 100644
--- a/core/Lucy/Plan/Schema.cfh
+++ b/core/Lucy/Plan/Schema.cfh
@@ -57,24 +57,24 @@ public class Lucy::Plan::Schema inherits Clownfish::Obj {
* @param type A FieldType.
*/
public void
- Spec_Field(Schema *self, const String *name, FieldType *type);
+ Spec_Field(Schema *self, String *name, FieldType *type);
/** Return the FieldType for the specified field. If the field can't be
* found, return NULL.
*/
public nullable FieldType*
- Fetch_Type(Schema *self, const String *field);
+ Fetch_Type(Schema *self, String *field);
/** Return the Analyzer for the specified field.
*/
nullable Analyzer*
- Fetch_Analyzer(Schema *self, const String *field = NULL);
+ Fetch_Analyzer(Schema *self, String *field = NULL);
/** Return the Similarity for the specified field, or NULL if either the
* field can't be found or it isn't associated with a Similarity.
*/
public nullable Similarity*
- Fetch_Sim(Schema *self, const String *field = NULL);
+ Fetch_Sim(Schema *self, String *field = NULL);
/** Return the number of fields currently defined.
*/
@@ -108,7 +108,7 @@ public class Lucy::Plan::Schema inherits Clownfish::Obj {
Eat(Schema *self, Schema *other);
void
- Write(Schema *self, Folder *folder, const String *filename = NULL);
+ Write(Schema *self, Folder *folder, String *filename = NULL);
public void
Destroy(Schema *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/Compiler.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Compiler.c b/core/Lucy/Search/Compiler.c
index 1ed904e..d8dd55e 100644
--- a/core/Lucy/Search/Compiler.c
+++ b/core/Lucy/Search/Compiler.c
@@ -97,7 +97,7 @@ Compiler_Normalize_IMP(Compiler *self) {
VArray*
Compiler_Highlight_Spans_IMP(Compiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field) {
+ DocVector *doc_vec, String *field) {
UNUSED_VAR(self);
UNUSED_VAR(searcher);
UNUSED_VAR(doc_vec);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/Compiler.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Compiler.cfh b/core/Lucy/Search/Compiler.cfh
index 8a1144f..4f490cf 100644
--- a/core/Lucy/Search/Compiler.cfh
+++ b/core/Lucy/Search/Compiler.cfh
@@ -149,7 +149,7 @@ public class Lucy::Search::Compiler inherits Lucy::Search::Query {
*/
public incremented VArray*
Highlight_Spans(Compiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field);
+ DocVector *doc_vec, String *field);
public void
Serialize(Compiler *self, OutStream *outstream);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/IndexSearcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/IndexSearcher.c b/core/Lucy/Search/IndexSearcher.c
index dc4fc0d..b631bf0 100644
--- a/core/Lucy/Search/IndexSearcher.c
+++ b/core/Lucy/Search/IndexSearcher.c
@@ -103,7 +103,7 @@ IxSearcher_Doc_Max_IMP(IndexSearcher *self) {
}
uint32_t
-IxSearcher_Doc_Freq_IMP(IndexSearcher *self, const String *field, Obj *term) {
+IxSearcher_Doc_Freq_IMP(IndexSearcher *self, String *field, Obj *term) {
IndexSearcherIVARS *const ivars = IxSearcher_IVARS(self);
LexiconReader *lex_reader
= (LexiconReader*)IxReader_Fetch(ivars->reader,
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/IndexSearcher.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/IndexSearcher.cfh b/core/Lucy/Search/IndexSearcher.cfh
index fce1910..18f5ab1 100644
--- a/core/Lucy/Search/IndexSearcher.cfh
+++ b/core/Lucy/Search/IndexSearcher.cfh
@@ -51,7 +51,7 @@ public class Lucy::Search::IndexSearcher cnick IxSearcher
Doc_Max(IndexSearcher *self);
public uint32_t
- Doc_Freq(IndexSearcher *self, const String *field, Obj *term);
+ Doc_Freq(IndexSearcher *self, String *field, Obj *term);
public void
Collect(IndexSearcher *self, Query *query, Collector *collector);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/LeafQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.c b/core/Lucy/Search/LeafQuery.c
index 52c2718..189ae2c 100644
--- a/core/Lucy/Search/LeafQuery.c
+++ b/core/Lucy/Search/LeafQuery.c
@@ -25,13 +25,13 @@
#include "Lucy/Util/Freezer.h"
LeafQuery*
-LeafQuery_new(const String *field, const String *text) {
+LeafQuery_new(String *field, String *text) {
LeafQuery *self = (LeafQuery*)VTable_Make_Obj(LEAFQUERY);
return LeafQuery_init(self, field, text);
}
LeafQuery*
-LeafQuery_init(LeafQuery *self, const String *field, const String *text) {
+LeafQuery_init(LeafQuery *self, String *field, String *text) {
LeafQueryIVARS *const ivars = LeafQuery_IVARS(self);
Query_init((Query*)self, 1.0f);
ivars->field = field ? Str_Clone(field) : NULL;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/LeafQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.cfh b/core/Lucy/Search/LeafQuery.cfh
index 4c7d09c..63dea2f 100644
--- a/core/Lucy/Search/LeafQuery.cfh
+++ b/core/Lucy/Search/LeafQuery.cfh
@@ -31,14 +31,14 @@ public class Lucy::Search::LeafQuery inherits Lucy::Search::Query {
String *text;
inert incremented LeafQuery*
- new(const String *field = NULL, const String *text);
+ new(String *field = NULL, String *text);
/**
* @param field Optional field name.
* @param text Raw query text.
*/
public inert LeafQuery*
- init(LeafQuery *self, const String *field = NULL, const String *text);
+ init(LeafQuery *self, String *field = NULL, String *text);
/** Accessor for object's <code>field</code> attribute.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/NOTQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NOTQuery.c b/core/Lucy/Search/NOTQuery.c
index eb9baf4..0daa62e 100644
--- a/core/Lucy/Search/NOTQuery.c
+++ b/core/Lucy/Search/NOTQuery.c
@@ -105,7 +105,7 @@ NOTCompiler_Sum_Of_Squared_Weights_IMP(NOTCompiler *self) {
VArray*
NOTCompiler_Highlight_Spans_IMP(NOTCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field) {
+ DocVector *doc_vec, String *field) {
UNUSED_VAR(self);
UNUSED_VAR(searcher);
UNUSED_VAR(doc_vec);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/NOTQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NOTQuery.cfh b/core/Lucy/Search/NOTQuery.cfh
index 8e38d85..a9f10ad 100644
--- a/core/Lucy/Search/NOTQuery.cfh
+++ b/core/Lucy/Search/NOTQuery.cfh
@@ -78,7 +78,7 @@ class Lucy::Search::NOTCompiler
public incremented VArray*
Highlight_Spans(NOTCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field);
+ DocVector *doc_vec, String *field);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/PhraseQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c
index 7576401..19abb78 100644
--- a/core/Lucy/Search/PhraseQuery.c
+++ b/core/Lucy/Search/PhraseQuery.c
@@ -46,13 +46,13 @@ static PhraseQuery*
S_do_init(PhraseQuery *self, String *field, VArray *terms, float boost);
PhraseQuery*
-PhraseQuery_new(const String *field, VArray *terms) {
+PhraseQuery_new(String *field, VArray *terms) {
PhraseQuery *self = (PhraseQuery*)VTable_Make_Obj(PHRASEQUERY);
return PhraseQuery_init(self, field, terms);
}
PhraseQuery*
-PhraseQuery_init(PhraseQuery *self, const String *field, VArray *terms) {
+PhraseQuery_init(PhraseQuery *self, String *field, VArray *terms) {
return S_do_init(self, Str_Clone(field), VA_Clone(terms), 1.0f);
}
@@ -343,7 +343,7 @@ PhraseCompiler_Make_Matcher_IMP(PhraseCompiler *self, SegReader *reader,
VArray*
PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field) {
+ DocVector *doc_vec, String *field) {
PhraseCompilerIVARS *const ivars = PhraseCompiler_IVARS(self);
PhraseQueryIVARS *const parent_ivars
= PhraseQuery_IVARS((PhraseQuery*)ivars->parent);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/PhraseQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.cfh b/core/Lucy/Search/PhraseQuery.cfh
index c8609f2..0f78399 100644
--- a/core/Lucy/Search/PhraseQuery.cfh
+++ b/core/Lucy/Search/PhraseQuery.cfh
@@ -28,14 +28,14 @@ public class Lucy::Search::PhraseQuery inherits Lucy::Search::Query {
VArray *terms;
inert incremented PhraseQuery*
- new(const String *field, VArray *terms);
+ new(String *field, VArray *terms);
/**
* @param field The field that the phrase must occur in.
* @param terms The ordered array of terms that must match.
*/
public inert PhraseQuery*
- init(PhraseQuery *self, const String *field, VArray *terms);
+ init(PhraseQuery *self, String *field, VArray *terms);
/** Accessor for object's field attribute.
*/
@@ -102,7 +102,7 @@ class Lucy::Search::PhraseCompiler
public incremented VArray*
Highlight_Spans(PhraseCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field);
+ DocVector *doc_vec, String *field);
public bool
Equals(PhraseCompiler *self, Obj *other);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/PolyQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.c b/core/Lucy/Search/PolyQuery.c
index 6d74c35..df0395f 100644
--- a/core/Lucy/Search/PolyQuery.c
+++ b/core/Lucy/Search/PolyQuery.c
@@ -185,7 +185,7 @@ PolyCompiler_Apply_Norm_Factor_IMP(PolyCompiler *self, float factor) {
VArray*
PolyCompiler_Highlight_Spans_IMP(PolyCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field) {
+ DocVector *doc_vec, String *field) {
PolyCompilerIVARS *const ivars = PolyCompiler_IVARS(self);
VArray *spans = VA_new(0);
for (uint32_t i = 0, max = VA_Get_Size(ivars->children); i < max; i++) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/PolyQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.cfh b/core/Lucy/Search/PolyQuery.cfh
index 5208f92..25c465b 100644
--- a/core/Lucy/Search/PolyQuery.cfh
+++ b/core/Lucy/Search/PolyQuery.cfh
@@ -88,7 +88,7 @@ class Lucy::Search::PolyCompiler inherits Lucy::Search::Compiler {
public incremented VArray*
Highlight_Spans(PolyCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field);
+ DocVector *doc_vec, String *field);
public void
Destroy(PolyCompiler *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/PolySearcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolySearcher.c b/core/Lucy/Search/PolySearcher.c
index 54f7565..48ec3d3 100644
--- a/core/Lucy/Search/PolySearcher.c
+++ b/core/Lucy/Search/PolySearcher.c
@@ -105,7 +105,7 @@ PolySearcher_Doc_Max_IMP(PolySearcher *self) {
}
uint32_t
-PolySearcher_Doc_Freq_IMP(PolySearcher *self, const String *field, Obj *term) {
+PolySearcher_Doc_Freq_IMP(PolySearcher *self, String *field, Obj *term) {
PolySearcherIVARS *const ivars = PolySearcher_IVARS(self);
uint32_t doc_freq = 0;
for (uint32_t i = 0, max = VA_Get_Size(ivars->searchers); i < max; i++) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/PolySearcher.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolySearcher.cfh b/core/Lucy/Search/PolySearcher.cfh
index 18bc489..2c4a82e 100644
--- a/core/Lucy/Search/PolySearcher.cfh
+++ b/core/Lucy/Search/PolySearcher.cfh
@@ -46,7 +46,7 @@ public class Lucy::Search::PolySearcher
Doc_Max(PolySearcher *self);
public uint32_t
- Doc_Freq(PolySearcher *self, const String *field, Obj *term);
+ Doc_Freq(PolySearcher *self, String *field, Obj *term);
public void
Collect(PolySearcher *self, Query *query, Collector *collector);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/QueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c
index 4d4c86d..1a27965 100644
--- a/core/Lucy/Search/QueryParser.c
+++ b/core/Lucy/Search/QueryParser.c
@@ -97,7 +97,7 @@ static Query*
S_compose_subquery(QueryParser *self, VArray *elems, bool enclosed);
QueryParser*
-QParser_new(Schema *schema, Analyzer *analyzer, const String *default_boolop,
+QParser_new(Schema *schema, Analyzer *analyzer, String *default_boolop,
VArray *fields) {
QueryParser *self = (QueryParser*)VTable_Make_Obj(QUERYPARSER);
return QParser_init(self, schema, analyzer, default_boolop, fields);
@@ -105,7 +105,7 @@ QParser_new(Schema *schema, Analyzer *analyzer, const String *default_boolop,
QueryParser*
QParser_init(QueryParser *self, Schema *schema, Analyzer *analyzer,
- const String *default_boolop, VArray *fields) {
+ String *default_boolop, VArray *fields) {
QueryParserIVARS *const ivars = QParser_IVARS(self);
// Init.
ivars->heed_colons = false;
@@ -199,7 +199,7 @@ QParser_Set_Heed_Colons_IMP(QueryParser *self, bool heed_colons) {
Query*
-QParser_Parse_IMP(QueryParser *self, const String *query_string) {
+QParser_Parse_IMP(QueryParser *self, String *query_string) {
String *qstring = query_string
? Str_Clone(query_string)
: Str_new_from_trusted_utf8("", 0);
@@ -213,7 +213,7 @@ QParser_Parse_IMP(QueryParser *self, const String *query_string) {
}
Query*
-QParser_Tree_IMP(QueryParser *self, const String *query_string) {
+QParser_Tree_IMP(QueryParser *self, String *query_string) {
QueryParserIVARS *const ivars = QParser_IVARS(self);
VArray *elems = QueryLexer_Tokenize(ivars->lexer, query_string);
S_balance_parens(self, elems);
@@ -376,7 +376,7 @@ S_compose_inner_queries(QueryParser *self, VArray *elems,
}
if (ParserElem_Get_Type(elem) == TOKEN_STRING) {
- const String *text = (String*)ParserElem_As(elem, STRING);
+ String *text = (String*)ParserElem_As(elem, STRING);
LeafQuery *query = LeafQuery_new(field, text);
ParserElem *new_elem
= ParserElem_new(TOKEN_QUERY, (Obj*)query);
@@ -972,14 +972,14 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
}
Query*
-QParser_Make_Term_Query_IMP(QueryParser *self, const String *field,
+QParser_Make_Term_Query_IMP(QueryParser *self, String *field,
Obj *term) {
UNUSED_VAR(self);
return (Query*)TermQuery_new(field, term);
}
Query*
-QParser_Make_Phrase_Query_IMP(QueryParser *self, const String *field,
+QParser_Make_Phrase_Query_IMP(QueryParser *self, String *field,
VArray *terms) {
UNUSED_VAR(self);
return (Query*)PhraseQuery_new(field, terms);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/QueryParser.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.cfh b/core/Lucy/Search/QueryParser.cfh
index d89c44f..50329fa 100644
--- a/core/Lucy/Search/QueryParser.cfh
+++ b/core/Lucy/Search/QueryParser.cfh
@@ -53,7 +53,7 @@ public class Lucy::Search::QueryParser cnick QParser
inert incremented QueryParser*
new(Schema *schema, Analyzer *analyzer = NULL,
- const String *default_boolop = NULL, VArray *fields = NULL);
+ String *default_boolop = NULL, VArray *fields = NULL);
/** Constructor.
*
@@ -73,7 +73,7 @@ public class Lucy::Search::QueryParser cnick QParser
*/
public inert QueryParser*
init(QueryParser *self, Schema *schema, Analyzer *analyzer = NULL,
- const String *default_boolop = NULL, VArray *fields = NULL);
+ String *default_boolop = NULL, VArray *fields = NULL);
/** Build a Query object from the contents of a query string. At present,
* implemented internally by calling Tree(), Expand(), and Prune().
@@ -82,7 +82,7 @@ public class Lucy::Search::QueryParser cnick QParser
* @return a Query.
*/
public incremented Query*
- Parse(QueryParser *self, const String *query_string = NULL);
+ Parse(QueryParser *self, String *query_string = NULL);
/** Parse the logical structure of a query string, building a tree
* comprised of Query objects. Leaf nodes in the tree will most often be
@@ -97,7 +97,7 @@ public class Lucy::Search::QueryParser cnick QParser
* @return a Query.
*/
public incremented Query*
- Tree(QueryParser *self, const String *query_string);
+ Tree(QueryParser *self, String *query_string);
/** Walk the hierarchy of a Query tree, descending through all PolyQuery
* nodes and calling Expand_Leaf() on any LeafQuery nodes encountered.
@@ -157,7 +157,7 @@ public class Lucy::Search::QueryParser cnick QParser
* @return A Query.
*/
public incremented Query*
- Make_Term_Query(QueryParser *self, const String *field, Obj *term);
+ Make_Term_Query(QueryParser *self, String *field, Obj *term);
/** Factory method creating a PhraseQuery.
*
@@ -166,7 +166,7 @@ public class Lucy::Search::QueryParser cnick QParser
* @return A Query.
*/
public incremented Query*
- Make_Phrase_Query(QueryParser *self, const String *field, VArray *terms);
+ Make_Phrase_Query(QueryParser *self, String *field, VArray *terms);
/** Factory method creating an ORQuery.
*
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/QueryParser/QueryLexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.c b/core/Lucy/Search/QueryParser/QueryLexer.c
index 1f819d6..f3827dd 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.c
+++ b/core/Lucy/Search/QueryParser/QueryLexer.c
@@ -71,7 +71,7 @@ QueryLexer_Set_Heed_Colons_IMP(QueryLexer *self, bool heed_colons) {
}
VArray*
-QueryLexer_Tokenize_IMP(QueryLexer *self, const String *query_string) {
+QueryLexer_Tokenize_IMP(QueryLexer *self, String *query_string) {
QueryLexerIVARS *const ivars = QueryLexer_IVARS(self);
VArray *elems = VA_new(0);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/QueryParser/QueryLexer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.cfh b/core/Lucy/Search/QueryParser/QueryLexer.cfh
index 5069cd4..5c345f9 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.cfh
+++ b/core/Lucy/Search/QueryParser/QueryLexer.cfh
@@ -32,7 +32,7 @@ class Lucy::Search::QueryParser::QueryLexer inherits Clownfish::Obj {
* @return an array of ParserElems.
*/
incremented VArray*
- Tokenize(QueryLexer *self, const String *query_string = NULL);
+ Tokenize(QueryLexer *self, String *query_string = NULL);
bool
Heed_Colons(QueryLexer *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/RangeQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.c b/core/Lucy/Search/RangeQuery.c
index d4c7174..f42d2e3 100644
--- a/core/Lucy/Search/RangeQuery.c
+++ b/core/Lucy/Search/RangeQuery.c
@@ -41,7 +41,7 @@ static int32_t
S_find_upper_bound(RangeCompiler *self, SortCache *sort_cache);
RangeQuery*
-RangeQuery_new(const String *field, Obj *lower_term, Obj *upper_term,
+RangeQuery_new(String *field, Obj *lower_term, Obj *upper_term,
bool include_lower, bool include_upper) {
RangeQuery *self = (RangeQuery*)VTable_Make_Obj(RANGEQUERY);
return RangeQuery_init(self, field, lower_term, upper_term,
@@ -49,7 +49,7 @@ RangeQuery_new(const String *field, Obj *lower_term, Obj *upper_term,
}
RangeQuery*
-RangeQuery_init(RangeQuery *self, const String *field, Obj *lower_term,
+RangeQuery_init(RangeQuery *self, String *field, Obj *lower_term,
Obj *upper_term, bool include_lower, bool include_upper) {
Query_init((Query*)self, 0.0f);
RangeQueryIVARS *const ivars = RangeQuery_IVARS(self);
@@ -240,7 +240,7 @@ Matcher*
RangeCompiler_Make_Matcher_IMP(RangeCompiler *self, SegReader *reader,
bool need_score) {
RangeQuery *parent = (RangeQuery*)RangeCompiler_IVARS(self)->parent;
- const String *field = RangeQuery_IVARS(parent)->field;
+ String *field = RangeQuery_IVARS(parent)->field;
SortReader *sort_reader
= (SortReader*)SegReader_Fetch(reader, VTable_Get_Name(SORTREADER));
SortCache *sort_cache = sort_reader
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/RangeQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.cfh b/core/Lucy/Search/RangeQuery.cfh
index a013905..fc83382 100644
--- a/core/Lucy/Search/RangeQuery.cfh
+++ b/core/Lucy/Search/RangeQuery.cfh
@@ -31,7 +31,7 @@ public class Lucy::Search::RangeQuery inherits Lucy::Search::Query {
bool include_upper;
inert incremented RangeQuery*
- new(const String *field, Obj *lower_term = NULL, Obj *upper_term = NULL,
+ new(String *field, Obj *lower_term = NULL, Obj *upper_term = NULL,
bool include_lower = true, bool include_upper = true);
/** Takes 5 parameters; <code>field</code> is required, as
@@ -49,7 +49,7 @@ public class Lucy::Search::RangeQuery inherits Lucy::Search::Query {
* <code>upper_term</code> should be included in the results.
*/
public inert RangeQuery*
- init(RangeQuery *self, const String *field,
+ init(RangeQuery *self, String *field,
Obj *lower_term = NULL, Obj *upper_term = NULL,
bool include_lower = true, bool include_upper = true);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/Searcher.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Searcher.cfh b/core/Lucy/Search/Searcher.cfh
index d81ed54..49c950e 100644
--- a/core/Lucy/Search/Searcher.cfh
+++ b/core/Lucy/Search/Searcher.cfh
@@ -53,7 +53,7 @@ public class Lucy::Search::Searcher inherits Clownfish::Obj {
* @param term The term to look up.
*/
public abstract uint32_t
- Doc_Freq(Searcher *self, const String *field, Obj *term);
+ Doc_Freq(Searcher *self, String *field, Obj *term);
/** If the supplied object is a Query, return it; if it's a query string,
* create a QueryParser and parse it to produce a query against all
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/SortRule.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/SortRule.c b/core/Lucy/Search/SortRule.c
index b129df7..2d4a653 100644
--- a/core/Lucy/Search/SortRule.c
+++ b/core/Lucy/Search/SortRule.c
@@ -27,13 +27,13 @@ int32_t SortRule_SCORE = 1;
int32_t SortRule_DOC_ID = 2;
SortRule*
-SortRule_new(int32_t type, const String *field, bool reverse) {
+SortRule_new(int32_t type, String *field, bool reverse) {
SortRule *self = (SortRule*)VTable_Make_Obj(SORTRULE);
return SortRule_init(self, type, field, reverse);
}
SortRule*
-SortRule_init(SortRule *self, int32_t type, const String *field,
+SortRule_init(SortRule *self, int32_t type, String *field,
bool reverse) {
SortRuleIVARS *ivars = SortRule_IVARS(self);
ivars->field = field ? Str_Clone(field) : NULL;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/SortRule.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/SortRule.cfh b/core/Lucy/Search/SortRule.cfh
index 01c119e..cd2eba0 100644
--- a/core/Lucy/Search/SortRule.cfh
+++ b/core/Lucy/Search/SortRule.cfh
@@ -34,7 +34,7 @@ public class Lucy::Search::SortRule inherits Clownfish::Obj {
inert int32_t DOC_ID;
public inert incremented SortRule*
- new(int32_t type = 0, const String *field = NULL,
+ new(int32_t type = 0, String *field = NULL,
bool reverse = false);
/**
@@ -44,7 +44,7 @@ public class Lucy::Search::SortRule inherits Clownfish::Obj {
* @param reverse If true, reverse the order of the sort for this rule.
*/
public inert incremented SortRule*
- init(SortRule *self, int32_t type = 0, const String *field = NULL,
+ init(SortRule *self, int32_t type = 0, String *field = NULL,
bool reverse = false);
/** Accessor for "field" member.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/TermQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.c b/core/Lucy/Search/TermQuery.c
index eeae547..913d6a5 100644
--- a/core/Lucy/Search/TermQuery.c
+++ b/core/Lucy/Search/TermQuery.c
@@ -35,13 +35,13 @@
#include "Lucy/Util/Freezer.h"
TermQuery*
-TermQuery_new(const String *field, const Obj *term) {
+TermQuery_new(String *field, const Obj *term) {
TermQuery *self = (TermQuery*)VTable_Make_Obj(TERMQUERY);
return TermQuery_init(self, field, term);
}
TermQuery*
-TermQuery_init(TermQuery *self, const String *field, const Obj *term) {
+TermQuery_init(TermQuery *self, String *field, const Obj *term) {
Query_init((Query*)self, 1.0f);
TermQueryIVARS *const ivars = TermQuery_IVARS(self);
ivars->field = Str_Clone(field);
@@ -284,7 +284,7 @@ TermCompiler_Make_Matcher_IMP(TermCompiler *self, SegReader *reader,
VArray*
TermCompiler_Highlight_Spans_IMP(TermCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field) {
+ DocVector *doc_vec, String *field) {
TermCompilerIVARS *const ivars = TermCompiler_IVARS(self);
TermQueryIVARS *const parent_ivars
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Search/TermQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.cfh b/core/Lucy/Search/TermQuery.cfh
index a52437d..a59b4c6 100644
--- a/core/Lucy/Search/TermQuery.cfh
+++ b/core/Lucy/Search/TermQuery.cfh
@@ -29,14 +29,14 @@ public class Lucy::Search::TermQuery inherits Lucy::Search::Query {
Obj *term;
inert incremented TermQuery*
- new(const String *field, const Obj *term);
+ new(String *field, const Obj *term);
/**
* @param field Field name.
* @param term Term text.
*/
public inert TermQuery*
- init(TermQuery *self, const String *field, const Obj *term);
+ init(TermQuery *self, String *field, const Obj *term);
/** Accessor for object's <code>field</code> member.
*/
@@ -101,7 +101,7 @@ class Lucy::Search::TermCompiler inherits Lucy::Search::Compiler {
public incremented VArray*
Highlight_Spans(TermCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field);
+ DocVector *doc_vec, String *field);
public bool
Equals(TermCompiler *self, Obj *other);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/CompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c
index 79ca64a..e24064d 100644
--- a/core/Lucy/Store/CompoundFileReader.c
+++ b/core/Lucy/Store/CompoundFileReader.c
@@ -124,7 +124,7 @@ CFReader_Get_Real_Folder_IMP(CompoundFileReader *self) {
}
void
-CFReader_Set_Path_IMP(CompoundFileReader *self, const String *path) {
+CFReader_Set_Path_IMP(CompoundFileReader *self, String *path) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
Folder_Set_Path(ivars->real_folder, path);
CFReader_Set_Path_t super_set_path
@@ -135,7 +135,7 @@ CFReader_Set_Path_IMP(CompoundFileReader *self, const String *path) {
FileHandle*
CFReader_Local_Open_FileHandle_IMP(CompoundFileReader *self,
- const String *name, uint32_t flags) {
+ String *name, uint32_t flags) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
Hash *entry = (Hash*)Hash_Fetch(ivars->records, (Obj*)name);
FileHandle *fh = NULL;
@@ -155,7 +155,7 @@ CFReader_Local_Open_FileHandle_IMP(CompoundFileReader *self,
}
bool
-CFReader_Local_Delete_IMP(CompoundFileReader *self, const String *name) {
+CFReader_Local_Delete_IMP(CompoundFileReader *self, String *name) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
Hash *record = (Hash*)Hash_Delete(ivars->records, (Obj*)name);
DECREF(record);
@@ -182,7 +182,7 @@ CFReader_Local_Delete_IMP(CompoundFileReader *self, const String *name) {
}
InStream*
-CFReader_Local_Open_In_IMP(CompoundFileReader *self, const String *name) {
+CFReader_Local_Open_In_IMP(CompoundFileReader *self, String *name) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
Hash *entry = (Hash*)Hash_Fetch(ivars->records, (Obj*)name);
@@ -216,7 +216,7 @@ CFReader_Local_Open_In_IMP(CompoundFileReader *self, const String *name) {
}
bool
-CFReader_Local_Exists_IMP(CompoundFileReader *self, const String *name) {
+CFReader_Local_Exists_IMP(CompoundFileReader *self, String *name) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
if (Hash_Fetch(ivars->records, (Obj*)name)) { return true; }
if (Folder_Local_Exists(ivars->real_folder, name)) { return true; }
@@ -225,7 +225,7 @@ CFReader_Local_Exists_IMP(CompoundFileReader *self, const String *name) {
bool
CFReader_Local_Is_Directory_IMP(CompoundFileReader *self,
- const String *name) {
+ String *name) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
if (Hash_Fetch(ivars->records, (Obj*)name)) { return false; }
if (Folder_Local_Is_Directory(ivars->real_folder, name)) { return true; }
@@ -239,7 +239,7 @@ CFReader_Close_IMP(CompoundFileReader *self) {
}
bool
-CFReader_Local_MkDir_IMP(CompoundFileReader *self, const String *name) {
+CFReader_Local_MkDir_IMP(CompoundFileReader *self, String *name) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
if (Hash_Fetch(ivars->records, (Obj*)name)) {
Err_set_error(Err_new(Str_newf("Can't MkDir: '%o' exists", name)));
@@ -254,7 +254,7 @@ CFReader_Local_MkDir_IMP(CompoundFileReader *self, const String *name) {
Folder*
CFReader_Local_Find_Folder_IMP(CompoundFileReader *self,
- const String *name) {
+ String *name) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
if (Hash_Fetch(ivars->records, (Obj*)name)) { return false; }
return Folder_Local_Find_Folder(ivars->real_folder, name);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/CompoundFileReader.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.cfh b/core/Lucy/Store/CompoundFileReader.cfh
index 0876856..e7cafc4 100644
--- a/core/Lucy/Store/CompoundFileReader.cfh
+++ b/core/Lucy/Store/CompoundFileReader.cfh
@@ -52,7 +52,7 @@ class Lucy::Store::CompoundFileReader cnick CFReader
Get_Real_Folder(CompoundFileReader *self);
void
- Set_Path(CompoundFileReader *self, const String *path);
+ Set_Path(CompoundFileReader *self, String *path);
public void
Close(CompoundFileReader *self);
@@ -61,26 +61,26 @@ class Lucy::Store::CompoundFileReader cnick CFReader
Destroy(CompoundFileReader *self);
bool
- Local_Delete(CompoundFileReader *self, const String *name);
+ Local_Delete(CompoundFileReader *self, String *name);
bool
- Local_Exists(CompoundFileReader *self, const String *name);
+ Local_Exists(CompoundFileReader *self, String *name);
bool
- Local_Is_Directory(CompoundFileReader *self, const String *name);
+ Local_Is_Directory(CompoundFileReader *self, String *name);
incremented nullable FileHandle*
- Local_Open_FileHandle(CompoundFileReader *self, const String *name,
+ Local_Open_FileHandle(CompoundFileReader *self, String *name,
uint32_t flags);
incremented nullable InStream*
- Local_Open_In(CompoundFileReader *self, const String *name);
+ Local_Open_In(CompoundFileReader *self, String *name);
bool
- Local_MkDir(CompoundFileReader *self, const String *name);
+ Local_MkDir(CompoundFileReader *self, String *name);
nullable Folder*
- Local_Find_Folder(CompoundFileReader *self, const String *name);
+ Local_Find_Folder(CompoundFileReader *self, String *name);
incremented nullable DirHandle*
Local_Open_Dir(CompoundFileReader *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/DirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/DirHandle.c b/core/Lucy/Store/DirHandle.c
index 3a47e34..3271db8 100644
--- a/core/Lucy/Store/DirHandle.c
+++ b/core/Lucy/Store/DirHandle.c
@@ -19,7 +19,7 @@
#include "Lucy/Store/DirHandle.h"
DirHandle*
-DH_init(DirHandle *self, const String *dir) {
+DH_init(DirHandle *self, String *dir) {
DirHandleIVARS *const ivars = DH_IVARS(self);
ivars->dir = Str_Clone(dir);
ivars->entry = NULL;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/DirHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/DirHandle.cfh b/core/Lucy/Store/DirHandle.cfh
index 341c0aa..436c450 100644
--- a/core/Lucy/Store/DirHandle.cfh
+++ b/core/Lucy/Store/DirHandle.cfh
@@ -29,7 +29,7 @@ abstract class Lucy::Store::DirHandle cnick DH
* @param dir The path to the directory.
*/
inert DirHandle*
- init(DirHandle *self, const String *dir);
+ init(DirHandle *self, String *dir);
/** Proceed to the next entry in the directory.
*
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/FSDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSDirHandle.c b/core/Lucy/Store/FSDirHandle.c
index 5f1a23f..506042f 100644
--- a/core/Lucy/Store/FSDirHandle.c
+++ b/core/Lucy/Store/FSDirHandle.c
@@ -31,7 +31,7 @@
#endif
FSDirHandle*
-FSDH_open(const String *dir) {
+FSDH_open(String *dir) {
FSDirHandle *self = (FSDirHandle*)VTable_Make_Obj(FSDIRHANDLE);
return FSDH_do_open(self, dir);
}
@@ -64,7 +64,7 @@ SI_is_updir(const char *name, size_t len) {
#include <windows.h>
FSDirHandle*
-FSDH_do_open(FSDirHandle *self, const String *dir) {
+FSDH_do_open(FSDirHandle *self, String *dir) {
size_t dir_path_size = Str_Get_Size(dir);
const char *dir_path_ptr = Str_Get_Ptr8(dir);
char search_string[MAX_PATH + 1];
@@ -207,7 +207,7 @@ FSDH_Next_IMP(FSDirHandle *self) {
#include <dirent.h>
FSDirHandle*
-FSDH_do_open(FSDirHandle *self, const String *dir) {
+FSDH_do_open(FSDirHandle *self, String *dir) {
DH_init((DirHandle*)self, dir);
FSDirHandleIVARS *const ivars = FSDH_IVARS(self);
ivars->sys_dir_entry = NULL;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/FSDirHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSDirHandle.cfh b/core/Lucy/Store/FSDirHandle.cfh
index dc4a640..e0e2d61 100644
--- a/core/Lucy/Store/FSDirHandle.cfh
+++ b/core/Lucy/Store/FSDirHandle.cfh
@@ -27,10 +27,10 @@ class Lucy::Store::FSDirHandle cnick FSDH
bool delayed_iter;
inert incremented nullable FSDirHandle*
- open(const String *path);
+ open(String *path);
inert nullable FSDirHandle*
- do_open(FSDirHandle *self, const String *path);
+ do_open(FSDirHandle *self, String *path);
bool
Next(FSDirHandle *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/FSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFileHandle.c b/core/Lucy/Store/FSFileHandle.c
index 1f8b831..a183c65 100644
--- a/core/Lucy/Store/FSFileHandle.c
+++ b/core/Lucy/Store/FSFileHandle.c
@@ -83,13 +83,13 @@ SI_close_win_handles(FSFileHandle *self);
#endif
FSFileHandle*
-FSFH_open(const String *path, uint32_t flags) {
+FSFH_open(String *path, uint32_t flags) {
FSFileHandle *self = (FSFileHandle*)VTable_Make_Obj(FSFILEHANDLE);
return FSFH_do_open(self, path, flags);
}
FSFileHandle*
-FSFH_do_open(FSFileHandle *self, const String *path, uint32_t flags) {
+FSFH_do_open(FSFileHandle *self, String *path, uint32_t flags) {
FH_do_open((FileHandle*)self, path, flags);
FSFileHandleIVARS *const ivars = FSFH_IVARS(self);
if (!path || !Str_Get_Size(path)) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/FSFileHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFileHandle.cfh b/core/Lucy/Store/FSFileHandle.cfh
index 1507fff..cbe6a7d 100644
--- a/core/Lucy/Store/FSFileHandle.cfh
+++ b/core/Lucy/Store/FSFileHandle.cfh
@@ -35,10 +35,10 @@ class Lucy::Store::FSFileHandle cnick FSFH
* @param flags FileHandle constructor flags.
*/
inert incremented nullable FSFileHandle*
- open(const String *path = NULL, uint32_t flags);
+ open(String *path = NULL, uint32_t flags);
inert nullable FSFileHandle*
- do_open(FSFileHandle *self, const String *path = NULL, uint32_t flags);
+ do_open(FSFileHandle *self, String *path = NULL, uint32_t flags);
bool
Window(FSFileHandle *self, FileWindow *window, int64_t offset, int64_t len);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index b37fe6b..7a535d8 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -48,44 +48,44 @@
// Return a String containing a platform-specific absolute filepath.
static String*
-S_fullpath(FSFolder *self, const String *path);
+S_fullpath(FSFolder *self, String *path);
// Return a String containing a platform-specific absolute filepath.
static char*
-S_fullpath_ptr(FSFolder *self, const String *path);
+S_fullpath_ptr(FSFolder *self, String *path);
// Return true if the supplied path is a directory.
static bool
-S_dir_ok(const String *path);
+S_dir_ok(String *path);
// Create a directory, or set Err_error and return false.
static bool
-S_create_dir(const String *path);
+S_create_dir(String *path);
// Return true unless the supplied path contains a slash.
static bool
-S_is_local_entry(const String *path);
+S_is_local_entry(String *path);
// Return true if the supplied path is absolute.
static bool
-S_is_absolute(const String *path);
+S_is_absolute(String *path);
// Transform a possibly relative path into an absolute path.
static String*
-S_absolutify(const String *path);
+S_absolutify(String *path);
// Create a hard link.
static bool
S_hard_link(char *from_path, char *to_path);
FSFolder*
-FSFolder_new(const String *path) {
+FSFolder_new(String *path) {
FSFolder *self = (FSFolder*)VTable_Make_Obj(FSFOLDER);
return FSFolder_init(self, path);
}
FSFolder*
-FSFolder_init(FSFolder *self, const String *path) {
+FSFolder_init(FSFolder *self, String *path) {
String *abs_path = S_absolutify(path);
Folder_init((Folder*)self, abs_path);
DECREF(abs_path);
@@ -109,7 +109,7 @@ FSFolder_Check_IMP(FSFolder *self) {
}
FileHandle*
-FSFolder_Local_Open_FileHandle_IMP(FSFolder *self, const String *name,
+FSFolder_Local_Open_FileHandle_IMP(FSFolder *self, String *name,
uint32_t flags) {
String *fullpath = S_fullpath(self, name);
FSFileHandle *fh = FSFH_open(fullpath, flags);
@@ -119,7 +119,7 @@ FSFolder_Local_Open_FileHandle_IMP(FSFolder *self, const String *name,
}
bool
-FSFolder_Local_MkDir_IMP(FSFolder *self, const String *name) {
+FSFolder_Local_MkDir_IMP(FSFolder *self, String *name) {
String *dir = S_fullpath(self, name);
bool result = S_create_dir(dir);
if (!result) { ERR_ADD_FRAME(Err_get_error()); }
@@ -136,7 +136,7 @@ FSFolder_Local_Open_Dir_IMP(FSFolder *self) {
}
bool
-FSFolder_Local_Exists_IMP(FSFolder *self, const String *name) {
+FSFolder_Local_Exists_IMP(FSFolder *self, String *name) {
FSFolderIVARS *const ivars = FSFolder_IVARS(self);
if (Hash_Fetch(ivars->entries, (Obj*)name)) {
return true;
@@ -157,7 +157,7 @@ FSFolder_Local_Exists_IMP(FSFolder *self, const String *name) {
}
bool
-FSFolder_Local_Is_Directory_IMP(FSFolder *self, const String *name) {
+FSFolder_Local_Is_Directory_IMP(FSFolder *self, String *name) {
FSFolderIVARS *const ivars = FSFolder_IVARS(self);
// Check for a cached object, then fall back to a system call.
@@ -174,7 +174,7 @@ FSFolder_Local_Is_Directory_IMP(FSFolder *self, const String *name) {
}
bool
-FSFolder_Rename_IMP(FSFolder *self, const String* from, const String *to) {
+FSFolder_Rename_IMP(FSFolder *self, String* from, String *to) {
char *from_path = S_fullpath_ptr(self, from);
char *to_path = S_fullpath_ptr(self, to);
bool retval = !rename(from_path, to_path);
@@ -188,8 +188,8 @@ FSFolder_Rename_IMP(FSFolder *self, const String* from, const String *to) {
}
bool
-FSFolder_Hard_Link_IMP(FSFolder *self, const String *from,
- const String *to) {
+FSFolder_Hard_Link_IMP(FSFolder *self, String *from,
+ String *to) {
char *from_path_ptr = S_fullpath_ptr(self, from);
char *to_path_ptr = S_fullpath_ptr(self, to);
bool retval = S_hard_link(from_path_ptr, to_path_ptr);
@@ -199,7 +199,7 @@ FSFolder_Hard_Link_IMP(FSFolder *self, const String *from,
}
bool
-FSFolder_Local_Delete_IMP(FSFolder *self, const String *name) {
+FSFolder_Local_Delete_IMP(FSFolder *self, String *name) {
FSFolderIVARS *const ivars = FSFolder_IVARS(self);
char *path_ptr = S_fullpath_ptr(self, name);
@@ -220,7 +220,7 @@ FSFolder_Close_IMP(FSFolder *self) {
}
Folder*
-FSFolder_Local_Find_Folder_IMP(FSFolder *self, const String *name) {
+FSFolder_Local_Find_Folder_IMP(FSFolder *self, String *name) {
FSFolderIVARS *const ivars = FSFolder_IVARS(self);
Folder *subfolder = NULL;
@@ -269,7 +269,7 @@ FSFolder_Local_Find_Folder_IMP(FSFolder *self, const String *name) {
}
static String*
-S_fullpath(FSFolder *self, const String *path) {
+S_fullpath(FSFolder *self, String *path) {
FSFolderIVARS *const ivars = FSFolder_IVARS(self);
String *fullpath = Str_newf("%o%s%o", ivars->path, DIR_SEP, path);
String *retval;
@@ -284,7 +284,7 @@ S_fullpath(FSFolder *self, const String *path) {
}
static char*
-S_fullpath_ptr(FSFolder *self, const String *path) {
+S_fullpath_ptr(FSFolder *self, String *path) {
FSFolderIVARS *const ivars = FSFolder_IVARS(self);
size_t folder_size = Str_Get_Size(ivars->path);
size_t path_size = Str_Get_Size(path);
@@ -308,7 +308,7 @@ S_fullpath_ptr(FSFolder *self, const String *path) {
}
static bool
-S_dir_ok(const String *path) {
+S_dir_ok(String *path) {
bool retval = false;
char *path_ptr = Str_To_Utf8(path);
struct stat stat_buf;
@@ -320,7 +320,7 @@ S_dir_ok(const String *path) {
}
static bool
-S_create_dir(const String *path) {
+S_create_dir(String *path) {
bool retval = true;
char *path_ptr = Str_To_Utf8(path);
if (-1 == chy_makedir(path_ptr, 0777)) {
@@ -333,7 +333,7 @@ S_create_dir(const String *path) {
}
static bool
-S_is_local_entry(const String *path) {
+S_is_local_entry(String *path) {
return Str_Find_Utf8(path, "/", 1) == -1;
}
@@ -349,7 +349,7 @@ S_is_local_entry(const String *path) {
#include <windows.h>
static bool
-S_is_absolute(const String *path) {
+S_is_absolute(String *path) {
int32_t code_point = Str_Code_Point_At(path, 0);
if (isalpha(code_point)) {
@@ -362,7 +362,7 @@ S_is_absolute(const String *path) {
}
static String*
-S_absolutify(const String *path) {
+S_absolutify(String *path) {
if (S_is_absolute(path)) { return Str_Clone(path); }
DWORD cwd_len = GetCurrentDirectory(0, NULL);
@@ -394,12 +394,12 @@ S_hard_link(char *from8, char *to8) {
#elif (defined(CHY_HAS_UNISTD_H))
static bool
-S_is_absolute(const String *path) {
+S_is_absolute(String *path) {
return Str_Starts_With_Utf8(path, DIR_SEP, 1);
}
static String*
-S_absolutify(const String *path) {
+S_absolutify(String *path) {
if (S_is_absolute(path)) { return Str_Clone(path); }
char *cwd = getcwd(NULL, 0);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/FSFolder.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.cfh b/core/Lucy/Store/FSFolder.cfh
index c806aac..b4a7428 100644
--- a/core/Lucy/Store/FSFolder.cfh
+++ b/core/Lucy/Store/FSFolder.cfh
@@ -25,7 +25,7 @@ parcel Lucy;
public class Lucy::Store::FSFolder inherits Lucy::Store::Folder {
inert incremented FSFolder*
- new(const String *path);
+ new(String *path);
/**
* @param path Location of the index. If the specified directory does
@@ -34,7 +34,7 @@ public class Lucy::Store::FSFolder inherits Lucy::Store::Folder {
* be necessary to create the directory yourself.
*/
public inert FSFolder*
- init(FSFolder *self, const String *path);
+ init(FSFolder *self, String *path);
/** Attempt to create the directory specified by <code>path</code>.
*/
@@ -51,32 +51,32 @@ public class Lucy::Store::FSFolder inherits Lucy::Store::Folder {
Close(FSFolder *self);
incremented nullable FileHandle*
- Local_Open_FileHandle(FSFolder *self, const String *name,
+ Local_Open_FileHandle(FSFolder *self, String *name,
uint32_t flags);
incremented nullable DirHandle*
Local_Open_Dir(FSFolder *self);
bool
- Local_MkDir(FSFolder *self, const String *name);
+ Local_MkDir(FSFolder *self, String *name);
bool
- Local_Exists(FSFolder *self, const String *name);
+ Local_Exists(FSFolder *self, String *name);
bool
- Local_Is_Directory(FSFolder *self, const String *name);
+ Local_Is_Directory(FSFolder *self, String *name);
nullable Folder*
- Local_Find_Folder(FSFolder *self, const String *name);
+ Local_Find_Folder(FSFolder *self, String *name);
bool
- Local_Delete(FSFolder *self, const String *name);
+ Local_Delete(FSFolder *self, String *name);
public bool
- Rename(FSFolder *self, const String* from, const String *to);
+ Rename(FSFolder *self, String* from, String *to);
public bool
- Hard_Link(FSFolder *self, const String *from, const String *to);
+ Hard_Link(FSFolder *self, String *from, String *to);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/FileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FileHandle.c b/core/Lucy/Store/FileHandle.c
index afb8035..97618d5 100644
--- a/core/Lucy/Store/FileHandle.c
+++ b/core/Lucy/Store/FileHandle.c
@@ -22,7 +22,7 @@
int32_t FH_object_count = 0;
FileHandle*
-FH_do_open(FileHandle *self, const String *path, uint32_t flags) {
+FH_do_open(FileHandle *self, String *path, uint32_t flags) {
FileHandleIVARS *const ivars = FH_IVARS(self);
ivars->path = path ? Str_Clone(path) : Str_new_from_trusted_utf8("", 0);
ivars->flags = flags;
@@ -53,7 +53,7 @@ FH_Grow_IMP(FileHandle *self, int64_t length) {
}
void
-FH_Set_Path_IMP(FileHandle *self, const String *path) {
+FH_Set_Path_IMP(FileHandle *self, String *path) {
FileHandleIVARS *const ivars = FH_IVARS(self);
DECREF(ivars->path);
ivars->path = Str_Clone(path);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/FileHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FileHandle.cfh b/core/Lucy/Store/FileHandle.cfh
index 75f849a..01b3691 100644
--- a/core/Lucy/Store/FileHandle.cfh
+++ b/core/Lucy/Store/FileHandle.cfh
@@ -52,7 +52,7 @@ abstract class Lucy::Store::FileHandle cnick FH
* behaviors.
*/
inert nullable FileHandle*
- do_open(FileHandle *self, const String *path = NULL, uint32_t flags);
+ do_open(FileHandle *self, String *path = NULL, uint32_t flags);
/** Ensure that the FileWindow's buffer provides access to file data for
* <code>len</code> bytes starting at <code>offset</code>.
@@ -118,7 +118,7 @@ abstract class Lucy::Store::FileHandle cnick FH
/** Set the object's <code>path</code> attribute.
*/
void
- Set_Path(FileHandle *self, const String *path);
+ Set_Path(FileHandle *self, String *path);
/** Return the object's <code>path</code> attribute.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index 935c794..86776a8 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -29,7 +29,7 @@
#include "Lucy/Util/IndexFileNames.h"
Folder*
-Folder_init(Folder *self, const String *path) {
+Folder_init(Folder *self, String *path) {
FolderIVARS *const ivars = Folder_IVARS(self);
// Init.
@@ -62,7 +62,7 @@ Folder_Destroy_IMP(Folder *self) {
}
InStream*
-Folder_Open_In_IMP(Folder *self, const String *path) {
+Folder_Open_In_IMP(Folder *self, String *path) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
InStream *instream = NULL;
@@ -85,7 +85,7 @@ Folder_Open_In_IMP(Folder *self, const String *path) {
* necessary because calling CFReader_Local_Open_FileHandle() won't find
* virtual files. No other class should need to override it. */
InStream*
-Folder_Local_Open_In_IMP(Folder *self, const String *name) {
+Folder_Local_Open_In_IMP(Folder *self, String *name) {
FileHandle *fh = Folder_Local_Open_FileHandle(self, name, FH_READ_ONLY);
InStream *instream = NULL;
if (fh) {
@@ -102,7 +102,7 @@ Folder_Local_Open_In_IMP(Folder *self, const String *name) {
}
OutStream*
-Folder_Open_Out_IMP(Folder *self, const String *path) {
+Folder_Open_Out_IMP(Folder *self, String *path) {
const uint32_t flags = FH_WRITE_ONLY | FH_CREATE | FH_EXCLUSIVE;
FileHandle *fh = Folder_Open_FileHandle(self, path, flags);
OutStream *outstream = NULL;
@@ -120,7 +120,7 @@ Folder_Open_Out_IMP(Folder *self, const String *path) {
}
FileHandle*
-Folder_Open_FileHandle_IMP(Folder *self, const String *path,
+Folder_Open_FileHandle_IMP(Folder *self, String *path,
uint32_t flags) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
FileHandle *fh = NULL;
@@ -141,7 +141,7 @@ Folder_Open_FileHandle_IMP(Folder *self, const String *path,
}
bool
-Folder_Delete_IMP(Folder *self, const String *path) {
+Folder_Delete_IMP(Folder *self, String *path) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
if (enclosing_folder) {
String *name = IxFileNames_local_part(path);
@@ -155,7 +155,7 @@ Folder_Delete_IMP(Folder *self, const String *path) {
}
bool
-Folder_Delete_Tree_IMP(Folder *self, const String *path) {
+Folder_Delete_Tree_IMP(Folder *self, String *path) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
// Don't allow Folder to delete itself.
@@ -219,7 +219,7 @@ S_is_updir(String *path) {
static void
S_add_to_file_list(Folder *self, VArray *list, String *dir,
- const String *path) {
+ String *path) {
DirHandle *dh = Folder_Open_Dir(self, dir);
if (!dh) {
@@ -255,7 +255,7 @@ S_add_to_file_list(Folder *self, VArray *list, String *dir,
}
DirHandle*
-Folder_Open_Dir_IMP(Folder *self, const String *path) {
+Folder_Open_Dir_IMP(Folder *self, String *path) {
DirHandle *dh = NULL;
Folder *folder;
if (path) {
@@ -278,7 +278,7 @@ Folder_Open_Dir_IMP(Folder *self, const String *path) {
}
bool
-Folder_MkDir_IMP(Folder *self, const String *path) {
+Folder_MkDir_IMP(Folder *self, String *path) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
bool result = false;
@@ -302,7 +302,7 @@ Folder_MkDir_IMP(Folder *self, const String *path) {
}
bool
-Folder_Exists_IMP(Folder *self, const String *path) {
+Folder_Exists_IMP(Folder *self, String *path) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
bool retval = false;
if (enclosing_folder) {
@@ -316,7 +316,7 @@ Folder_Exists_IMP(Folder *self, const String *path) {
}
bool
-Folder_Is_Directory_IMP(Folder *self, const String *path) {
+Folder_Is_Directory_IMP(Folder *self, String *path) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
bool retval = false;
if (enclosing_folder) {
@@ -330,7 +330,7 @@ Folder_Is_Directory_IMP(Folder *self, const String *path) {
}
VArray*
-Folder_List_IMP(Folder *self, const String *path) {
+Folder_List_IMP(Folder *self, String *path) {
Folder *local_folder = Folder_Find_Folder(self, path);
VArray *list = NULL;
DirHandle *dh = Folder_Local_Open_Dir(local_folder);
@@ -350,7 +350,7 @@ Folder_List_IMP(Folder *self, const String *path) {
}
VArray*
-Folder_List_R_IMP(Folder *self, const String *path) {
+Folder_List_R_IMP(Folder *self, String *path) {
Folder *local_folder = Folder_Find_Folder(self, path);
VArray *list = VA_new(0);
if (local_folder) {
@@ -362,7 +362,7 @@ Folder_List_R_IMP(Folder *self, const String *path) {
}
ByteBuf*
-Folder_Slurp_File_IMP(Folder *self, const String *path) {
+Folder_Slurp_File_IMP(Folder *self, String *path) {
InStream *instream = Folder_Open_In(self, path);
ByteBuf *retval = NULL;
@@ -398,14 +398,14 @@ Folder_Get_Path_IMP(Folder *self) {
}
void
-Folder_Set_Path_IMP(Folder *self, const String *path) {
+Folder_Set_Path_IMP(Folder *self, String *path) {
FolderIVARS *const ivars = Folder_IVARS(self);
DECREF(ivars->path);
ivars->path = Str_Clone(path);
}
void
-Folder_Consolidate_IMP(Folder *self, const String *path) {
+Folder_Consolidate_IMP(Folder *self, String *path) {
Folder *folder = Folder_Find_Folder(self, path);
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
if (!folder) {
@@ -465,7 +465,7 @@ S_enclosing_folder(Folder *self, StringIterator *path) {
}
Folder*
-Folder_Enclosing_Folder_IMP(Folder *self, const String *path) {
+Folder_Enclosing_Folder_IMP(Folder *self, String *path) {
StringIterator *iter = Str_Top(path);
Folder *folder = S_enclosing_folder(self, iter);
DECREF(iter);
@@ -473,7 +473,7 @@ Folder_Enclosing_Folder_IMP(Folder *self, const String *path) {
}
Folder*
-Folder_Find_Folder_IMP(Folder *self, const String *path) {
+Folder_Find_Folder_IMP(Folder *self, String *path) {
if (!path || !Str_Get_Size(path)) {
return self;
}
[lucy-commits] [12/50] [abbrv] git commit: refs/heads/master - Use Str_To_Utf8 to
get NULL-terminated C strings
Posted by nw...@apache.org.
Use Str_To_Utf8 to get NULL-terminated C strings
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/62993728
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/62993728
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/62993728
Branch: refs/heads/master
Commit: 6299372837c5771bbee3f4a9460beb799b239ea7
Parents: c3b1106
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 14 18:28:53 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:16 2013 +0200
----------------------------------------------------------------------
c/sample/getting_started.c | 4 +-
c/src/Lucy/Analysis/RegexTokenizer.c | 7 +-
clownfish/runtime/c/src/Clownfish/Err.c | 9 +-
.../core/Clownfish/TestHarness/TestFormatter.c | 5 +-
clownfish/runtime/perl/xs/XSBind.c | 2 +
core/Lucy/Store/FSDirHandle.c | 12 ++-
core/Lucy/Store/FSFileHandle.c | 12 ++-
core/Lucy/Store/FSFolder.c | 100 ++++++++++++-------
8 files changed, 101 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/62993728/c/sample/getting_started.c
----------------------------------------------------------------------
diff --git a/c/sample/getting_started.c b/c/sample/getting_started.c
index 2816a30..f7bbcfe 100644
--- a/c/sample/getting_started.c
+++ b/c/sample/getting_started.c
@@ -175,9 +175,11 @@ S_search(IndexSearcher *searcher, const char *query) {
// Loop over search results.
while (NULL != (hit = Hits_Next(hits))) {
String *value_str = (String*)HitDoc_Extract(hit, field_str);
+ char *value = Str_To_Utf8(value_str);
- printf("Result %d: %s\n", i, Str_Get_Ptr8(value_str));
+ printf("Result %d: %s\n", i, value);
+ DECREF(value);
DECREF(value_str);
DECREF(hit);
i++;
http://git-wip-us.apache.org/repos/asf/lucy/blob/62993728/c/src/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Analysis/RegexTokenizer.c b/c/src/Lucy/Analysis/RegexTokenizer.c
index bb3f96b..62085cb 100644
--- a/c/src/Lucy/Analysis/RegexTokenizer.c
+++ b/c/src/Lucy/Analysis/RegexTokenizer.c
@@ -48,10 +48,12 @@ RegexTokenizer_init(RegexTokenizer *self, const String *pattern) {
Analyzer_init((Analyzer*)self);
RegexTokenizerIVARS *const ivars = RegexTokenizer_IVARS(self);
+ char *pattern_buf = NULL;
const char *pattern_ptr;
if (pattern) {
ivars->pattern = Str_Clone(pattern);
- pattern_ptr = (char*)Str_Get_Ptr8(ivars->pattern);
+ pattern_buf = Str_To_Utf8(ivars->pattern);
+ pattern_ptr = pattern_buf;
}
else {
pattern_ptr = "\\w+(?:['\\x{2019}]\\w+)*";
@@ -71,6 +73,9 @@ RegexTokenizer_init(RegexTokenizer *self, const String *pattern) {
const char *err_ptr;
int err_offset;
pcre *re = pcre_compile(pattern_ptr, options, &err_ptr, &err_offset, NULL);
+ if (pattern_buf) {
+ FREEMEM(pattern_buf);
+ }
if (!re) {
THROW(ERR, "%s", err_ptr);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/62993728/clownfish/runtime/c/src/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/Err.c b/clownfish/runtime/c/src/Clownfish/Err.c
index ae13494..b360d5a 100644
--- a/clownfish/runtime/c/src/Clownfish/Err.c
+++ b/clownfish/runtime/c/src/Clownfish/Err.c
@@ -26,6 +26,7 @@
#include "Clownfish/Err.h"
#include "Clownfish/String.h"
+#include "Clownfish/Util/Memory.h"
#include "Clownfish/VTable.h"
/* TODO: Thread safety */
@@ -58,7 +59,9 @@ Err_do_throw(Err *error) {
}
else {
String *message = Err_Get_Mess(error);
- fprintf(stderr, "%s", Str_Get_Ptr8(message));
+ char *utf8 = Str_To_Utf8(message);
+ fprintf(stderr, "%s", utf8);
+ FREEMEM(utf8);
exit(EXIT_FAILURE);
}
}
@@ -78,7 +81,9 @@ Err_throw_mess(VTable *vtable, String *message) {
void
Err_warn_mess(String *message) {
- fprintf(stderr, "%s", Str_Get_Ptr8(message));
+ char *utf8 = Str_To_Utf8(message);
+ fprintf(stderr, "%s", utf8);
+ FREEMEM(utf8);
DECREF(message);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/62993728/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.c b/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.c
index 6088c89..c5016be 100644
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.c
+++ b/clownfish/runtime/core/Clownfish/TestHarness/TestFormatter.c
@@ -28,6 +28,7 @@
#include "Clownfish/Err.h"
#include "Clownfish/TestHarness/TestBatch.h"
#include "Clownfish/TestHarness/TestSuiteRunner.h"
+#include "Clownfish/Util/Memory.h"
#include "Clownfish/VTable.h"
TestFormatter*
@@ -79,7 +80,9 @@ TestFormatterCF_Batch_Prologue_IMP(TestFormatterCF *self, TestBatch *batch,
UNUSED_VAR(self);
UNUSED_VAR(num_planned);
String *class_name = TestBatch_Get_Class_Name(batch);
- printf("Running %s...\n", Str_Get_Ptr8(class_name));
+ char *utf8 = Str_To_Utf8(class_name);
+ printf("Running %s...\n", utf8);
+ FREEMEM(utf8);
}
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/62993728/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 379bc7d..0f21e50 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -85,6 +85,8 @@ cfish_Obj*
XSBind_maybe_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable, void *allocation) {
cfish_Obj *retval = NULL;
if (XSBind_sv_defined(sv)) {
+ // Assume that the class name is always NULL-terminated. Somewhat
+ // dangerous but should be safe.
if (sv_isobject(sv)
&& sv_derived_from(sv, (char*)CFISH_Str_Get_Ptr8(CFISH_VTable_Get_Name(vtable)))
) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/62993728/core/Lucy/Store/FSDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSDirHandle.c b/core/Lucy/Store/FSDirHandle.c
index 631f2f6..6fcf793 100644
--- a/core/Lucy/Store/FSDirHandle.c
+++ b/core/Lucy/Store/FSDirHandle.c
@@ -208,13 +208,13 @@ FSDH_Next_IMP(FSDirHandle *self) {
FSDirHandle*
FSDH_do_open(FSDirHandle *self, const String *dir) {
- char *dir_path_ptr = (char*)Str_Get_Ptr8(dir);
-
DH_init((DirHandle*)self, dir);
FSDirHandleIVARS *const ivars = FSDH_IVARS(self);
ivars->sys_dir_entry = NULL;
+ char *dir_path_ptr = Str_To_Utf8(dir);
ivars->sys_dirhandle = opendir(dir_path_ptr);
+ FREEMEM(dir_path_ptr);
if (!ivars->sys_dirhandle) {
Err_set_error(Err_new(Str_newf("Failed to opendir '%o'", dir)));
DECREF(self);
@@ -272,9 +272,11 @@ FSDH_Entry_Is_Dir_IMP(FSDirHandle *self) {
struct stat stat_buf;
String *fullpath = Str_newf("%o%s%o", ivars->dir, CHY_DIR_SEP,
ivars->entry);
- if (stat((char*)Str_Get_Ptr8(fullpath), &stat_buf) != -1) {
+ char *fullpath_ptr = Str_To_Utf8(fullpath);
+ if (stat(fullpath_ptr, &stat_buf) != -1) {
if (stat_buf.st_mode & S_IFDIR) { retval = true; }
}
+ FREEMEM(fullpath_ptr);
DECREF(fullpath);
return retval;
}
@@ -293,9 +295,11 @@ FSDH_Entry_Is_Symlink_IMP(FSDirHandle *self) {
struct stat stat_buf;
String *fullpath = Str_newf("%o%s%o", ivars->dir, CHY_DIR_SEP,
ivars->entry);
- if (stat((char*)Str_Get_Ptr8(fullpath), &stat_buf) != -1) {
+ char *fullpath_ptr = Str_To_Utf8(fullpath);
+ if (stat(fullpath_ptr, &stat_buf) != -1) {
if (stat_buf.st_mode & S_IFLNK) { retval = true; }
}
+ FREEMEM(fullpath_ptr);
DECREF(fullpath);
return retval;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/62993728/core/Lucy/Store/FSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFileHandle.c b/core/Lucy/Store/FSFileHandle.c
index 020eb9f..1f8b831 100644
--- a/core/Lucy/Store/FSFileHandle.c
+++ b/core/Lucy/Store/FSFileHandle.c
@@ -100,7 +100,9 @@ FSFH_do_open(FSFileHandle *self, const String *path, uint32_t flags) {
// Attempt to open file.
if (flags & FH_WRITE_ONLY) {
- ivars->fd = open((char*)Str_Get_Ptr8(path), SI_posix_flags(flags), 0666);
+ char *path_ptr = Str_To_Utf8(path);
+ ivars->fd = open(path_ptr, SI_posix_flags(flags), 0666);
+ FREEMEM(path_ptr);
if (ivars->fd == -1) {
ivars->fd = 0;
Err_set_error(Err_new(Str_newf("Attempt to open '%o' failed: %s",
@@ -330,8 +332,9 @@ SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
UNUSED_VAR(self);
// Open.
- ivars->fd = open((char*)Str_Get_Ptr8(ivars->path),
- SI_posix_flags(ivars->flags), 0666);
+ char *path_ptr = Str_To_Utf8(ivars->path);
+ ivars->fd = open(path_ptr, SI_posix_flags(ivars->flags), 0666);
+ FREEMEM(path_ptr);
if (ivars->fd == -1) {
ivars->fd = 0;
Err_set_error(Err_new(Str_newf("Can't open '%o': %s", ivars->path,
@@ -438,7 +441,7 @@ FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
static CFISH_INLINE bool
SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
- char *filepath = (char*)Str_Get_Ptr8(ivars->path);
+ char *filepath = Str_To_Utf8(ivars->path);
SYSTEM_INFO sys_info;
// Get system page size.
@@ -455,6 +458,7 @@ SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
FILE_ATTRIBUTE_READONLY | FILE_FLAG_OVERLAPPED,
NULL
);
+ FREEMEM(filepath);
if (ivars->win_fhandle == INVALID_HANDLE_VALUE) {
char *win_error = Err_win_error();
Err_set_error(Err_new(Str_newf("CreateFile for %o failed: %s",
http://git-wip-us.apache.org/repos/asf/lucy/blob/62993728/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index 70522f3..eb1c54f 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -50,6 +50,10 @@
static String*
S_fullpath(FSFolder *self, const String *path);
+// Return a String containing a platform-specific absolute filepath.
+static char*
+S_fullpath_ptr(FSFolder *self, const String *path);
+
// Return true if the supplied path is a directory.
static bool
S_dir_ok(const String *path);
@@ -72,7 +76,7 @@ S_absolutify(const String *path);
// Create a hard link.
static bool
-S_hard_link(String *from_path, String *to_path);
+S_hard_link(char *from_path, char *to_path);
FSFolder*
FSFolder_new(const String *path) {
@@ -142,12 +146,12 @@ FSFolder_Local_Exists_IMP(FSFolder *self, const String *name) {
}
else {
struct stat stat_buf;
- String *fullpath = S_fullpath(self, name);
+ char *fullpath_ptr = S_fullpath_ptr(self, name);
bool retval = false;
- if (stat((char*)Str_Get_Ptr8(fullpath), &stat_buf) != -1) {
+ if (stat(fullpath_ptr, &stat_buf) != -1) {
retval = true;
}
- DECREF(fullpath);
+ FREEMEM(fullpath_ptr);
return retval;
}
}
@@ -171,27 +175,26 @@ FSFolder_Local_Is_Directory_IMP(FSFolder *self, const String *name) {
bool
FSFolder_Rename_IMP(FSFolder *self, const String* from, const String *to) {
- String *from_path = S_fullpath(self, from);
- String *to_path = S_fullpath(self, to);
- bool retval = !rename((char*)Str_Get_Ptr8(from_path),
- (char*)Str_Get_Ptr8(to_path));
+ char *from_path = S_fullpath_ptr(self, from);
+ char *to_path = S_fullpath_ptr(self, to);
+ bool retval = !rename(from_path, to_path);
if (!retval) {
- Err_set_error(Err_new(Str_newf("rename from '%o' to '%o' failed: %s",
+ Err_set_error(Err_new(Str_newf("rename from '%s' to '%s' failed: %s",
from_path, to_path, strerror(errno))));
}
- DECREF(from_path);
- DECREF(to_path);
+ FREEMEM(from_path);
+ FREEMEM(to_path);
return retval;
}
bool
FSFolder_Hard_Link_IMP(FSFolder *self, const String *from,
const String *to) {
- String *from_path = S_fullpath(self, from);
- String *to_path = S_fullpath(self, to);
- bool retval = S_hard_link(from_path, to_path);
- DECREF(from_path);
- DECREF(to_path);
+ char *from_path_ptr = S_fullpath_ptr(self, from);
+ char *to_path_ptr = S_fullpath_ptr(self, to);
+ bool retval = S_hard_link(from_path_ptr, to_path_ptr);
+ FREEMEM(from_path_ptr);
+ FREEMEM(to_path_ptr);
return retval;
}
@@ -199,15 +202,14 @@ bool
FSFolder_Local_Delete_IMP(FSFolder *self, const String *name) {
FSFolderIVARS *const ivars = FSFolder_IVARS(self);
- String *fullpath = S_fullpath(self, name);
- char *path_ptr = (char*)Str_Get_Ptr8(fullpath);
+ char *path_ptr = S_fullpath_ptr(self, name);
#ifdef CHY_REMOVE_ZAPS_DIRS
bool result = !remove(path_ptr);
#else
bool result = !rmdir(path_ptr) || !remove(path_ptr);
#endif
DECREF(Hash_Delete(ivars->entries, (Obj*)name));
- DECREF(fullpath);
+ FREEMEM(path_ptr);
return result;
}
@@ -281,23 +283,53 @@ S_fullpath(FSFolder *self, const String *path) {
return retval;
}
+static char*
+S_fullpath_ptr(FSFolder *self, const String *path) {
+ FSFolderIVARS *const ivars = FSFolder_IVARS(self);
+ size_t folder_size = Str_Get_Size(ivars->path);
+ size_t path_size = Str_Get_Size(path);
+ size_t full_size = folder_size + 1 + path_size;
+ const char *folder_ptr = (char*)Str_Get_Ptr8(ivars->path);
+ const char *path_ptr = (char*)Str_Get_Ptr8(path);
+
+ char *buf = (char*)MALLOCATE(full_size + 1);
+ memcpy(buf, folder_ptr, folder_size);
+ buf[folder_size] = DIR_SEP[0];
+ memcpy(buf + folder_size + 1, path_ptr, path_size);
+ buf[full_size] = '\0';
+
+ if (DIR_SEP[0] != '/') {
+ for (size_t i = 0; i < full_size; ++i) {
+ if (buf[i] == '/') { buf[i] = DIR_SEP[0]; }
+ }
+ }
+
+ return buf;
+}
+
static bool
S_dir_ok(const String *path) {
+ bool retval = false;
+ char *path_ptr = Str_To_Utf8(path);
struct stat stat_buf;
- if (stat((char*)Str_Get_Ptr8(path), &stat_buf) != -1) {
- if (stat_buf.st_mode & S_IFDIR) { return true; }
+ if (stat(path_ptr, &stat_buf) != -1) {
+ if (stat_buf.st_mode & S_IFDIR) { retval = true; }
}
- return false;
+ FREEMEM(path_ptr);
+ return retval;
}
static bool
S_create_dir(const String *path) {
- if (-1 == chy_makedir((char*)Str_Get_Ptr8(path), 0777)) {
+ bool retval = true;
+ char *path_ptr = Str_To_Utf8(path);
+ if (-1 == chy_makedir(path_ptr, 0777)) {
Err_set_error(Err_new(Str_newf("Couldn't create directory '%o': %s",
path, strerror(errno))));
- return false;
+ retval = false;
}
- return true;
+ FREEMEM(path_ptr);
+ return retval;
}
static bool
@@ -346,17 +378,14 @@ S_absolutify(const String *path) {
}
static bool
-S_hard_link(String *from_path, String *to_path) {
- char *from8 = (char*)Str_Get_Ptr8(from_path);
- char *to8 = (char*)Str_Get_Ptr8(to_path);
-
+S_hard_link(char *from8, char *to8) {
if (CreateHardLink(to8, from8, NULL)) {
return true;
}
else {
char *win_error = Err_win_error();
- Err_set_error(Err_new(Str_newf("CreateHardLink for new file '%o' from '%o' failed: %s",
- to_path, from_path, win_error)));
+ Err_set_error(Err_new(Str_newf("CreateHardLink for new file '%s' from '%s' failed: %s",
+ to8, from8, win_error)));
FREEMEM(win_error);
return false;
}
@@ -382,13 +411,10 @@ S_absolutify(const String *path) {
}
static bool
-S_hard_link(String *from_path, String *to_path) {
- char *from8 = (char*)Str_Get_Ptr8(from_path);
- char *to8 = (char*)Str_Get_Ptr8(to_path);
-
+S_hard_link(char *from8, char *to8) {
if (-1 == link(from8, to8)) {
- Err_set_error(Err_new(Str_newf("hard link for new file '%o' from '%o' failed: %s",
- to_path, from_path, strerror(errno))));
+ Err_set_error(Err_new(Str_newf("hard link for new file '%s' from '%s' failed: %s",
+ to8, from8, strerror(errno))));
return false;
}
else {
[lucy-commits] [47/50] [abbrv] git commit: refs/heads/master - Fix the invocant type
on method typedefs.
Posted by nw...@apache.org.
Fix the invocant type on method typedefs.
Method typedefs, like method invocation inline functions, are defined
for each class in the inheritance chain. Prior to this fix, the "self"
type in the typedef was the type of the last concrete implementor
rather than the type of the invocant.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/c36b887e
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/c36b887e
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/c36b887e
Branch: refs/heads/master
Commit: c36b887ec8209235bd93fb18fe3c1efabae595ab
Parents: 94697de
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Sep 30 11:52:32 2013 -0700
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCBindMethod.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/c36b887e/clownfish/compiler/src/CFCBindMethod.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindMethod.c b/clownfish/compiler/src/CFCBindMethod.c
index c60cc98..0a2f7c9 100644
--- a/clownfish/compiler/src/CFCBindMethod.c
+++ b/clownfish/compiler/src/CFCBindMethod.c
@@ -88,8 +88,6 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
CFCParamList *param_list = CFCMethod_get_param_list(method);
const char *PREFIX = CFCClass_get_PREFIX(klass);
const char *invoker_struct = CFCClass_full_struct_sym(klass);
- const char *common_struct
- = CFCType_get_specifier(CFCMethod_self_type(method));
char *full_meth_sym = CFCMethod_full_method_sym(method, klass);
char *full_offset_sym = CFCMethod_full_offset_sym(method, klass);
@@ -125,7 +123,7 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
= CFCUtil_sprintf(pattern, PREFIX, full_offset_sym, ret_type_str,
full_meth_sym, invoker_struct, params_minus_invoker,
full_typedef, full_typedef, full_offset_sym,
- maybe_return, common_struct,
+ maybe_return, invoker_struct,
arg_names_minus_invoker);
FREEMEM(full_offset_sym);
@@ -136,11 +134,17 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
char*
CFCBindMeth_typedef_dec(struct CFCMethod *method, CFCClass *klass) {
- const char *params = CFCParamList_to_c(CFCMethod_get_param_list(method));
+ const char *params_minus_invoker
+ = CFCParamList_to_c(CFCMethod_get_param_list(method));
+ while (*params_minus_invoker && *params_minus_invoker != ',') {
+ params_minus_invoker++;
+ }
+ const char *self_struct = CFCClass_full_struct_sym(klass);
const char *ret_type = CFCType_to_c(CFCMethod_get_return_type(method));
char *full_typedef = CFCMethod_full_typedef(method, klass);
- char *buf = CFCUtil_sprintf("typedef %s\n(*%s)(%s);\n", ret_type,
- full_typedef, params);
+ char *buf = CFCUtil_sprintf("typedef %s\n(*%s)(%s *self%s);\n", ret_type,
+ full_typedef, self_struct,
+ params_minus_invoker);
FREEMEM(full_typedef);
return buf;
}
[lucy-commits] [09/50] [abbrv] git commit: refs/heads/master - Remove 'cap' field
from String
Posted by nw...@apache.org.
Remove 'cap' field from String
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7c42ec46
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7c42ec46
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7c42ec46
Branch: refs/heads/master
Commit: 7c42ec4626ae61a9ae21faad67ead4029bd46c0f
Parents: 4a210d7
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Sep 10 02:35:54 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:14 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Index/DocReader.c | 4 ++--
clownfish/runtime/core/Clownfish/CharBuf.c | 2 +-
clownfish/runtime/core/Clownfish/String.c | 21 ++++++---------------
clownfish/runtime/core/Clownfish/String.cfh | 8 +++-----
core/Lucy/Index/SortCache/TextSortCache.c | 2 +-
core/Lucy/Util/Freezer.c | 7 +++----
core/Lucy/Util/Json.c | 2 +-
7 files changed, 17 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c42ec46/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index 5a62738..dc3619b 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -77,8 +77,8 @@ DefDocReader_Fetch_Doc_IMP(DefaultDocReader *self, int32_t doc_id) {
char *buf = (char*)MALLOCATE(value_len + 1);
InStream_Read_Bytes(dat_in, buf, value_len);
buf[value_len] = '\0';
- value = (Obj*)Str_new_steal_from_trusted_str(
- buf, value_len, value_len + 1);
+ value
+ = (Obj*)Str_new_steal_from_trusted_str(buf, value_len);
break;
}
case FType_BLOB: {
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c42ec46/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 8b6de34..74919dd 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -304,7 +304,7 @@ CB_To_String_IMP(CharBuf *self) {
String*
CB_Yield_String_IMP(CharBuf *self) {
String *retval
- = Str_new_steal_from_trusted_str(self->ptr, self->size, self->cap);
+ = Str_new_steal_from_trusted_str(self->ptr, self->size);
self->ptr = NULL;
self->size = 0;
self->cap = 0;
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c42ec46/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index a5544e0..ecc5989 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -72,7 +72,6 @@ Str_init(String *self, size_t size) {
// Assign.
self->size = 0;
- self->cap = size + 1;
return self;
}
@@ -102,32 +101,30 @@ Str_init_from_trusted_utf8(String *self, const char *ptr, size_t size) {
// Assign.
self->size = size;
- self->cap = size + 1;
self->ptr[size] = '\0'; // Null terminate.
return self;
}
String*
-Str_new_steal_from_trusted_str(char *ptr, size_t size, size_t cap) {
+Str_new_steal_from_trusted_str(char *ptr, size_t size) {
String *self = (String*)VTable_Make_Obj(STRING);
- return Str_init_steal_trusted_str(self, ptr, size, cap);
+ return Str_init_steal_trusted_str(self, ptr, size);
}
String*
-Str_init_steal_trusted_str(String *self, char *ptr, size_t size, size_t cap) {
+Str_init_steal_trusted_str(String *self, char *ptr, size_t size) {
self->ptr = ptr;
self->size = size;
- self->cap = cap;
return self;
}
String*
-Str_new_steal_str(char *ptr, size_t size, size_t cap) {
+Str_new_steal_str(char *ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
}
- return Str_new_steal_from_trusted_str(ptr, size, cap);
+ return Str_new_steal_from_trusted_str(ptr, size);
}
String*
@@ -135,7 +132,6 @@ Str_new_from_char(uint32_t code_point) {
const size_t MAX_UTF8_BYTES = 4;
String *self = (String*)VTable_Make_Obj(STRING);
self->ptr = (char*)MALLOCATE(MAX_UTF8_BYTES + 1);
- self->cap = MAX_UTF8_BYTES + 1;
self->size = StrHelp_encode_utf8_char(code_point, (uint8_t*)self->ptr);
self->ptr[self->size] = '\0';
return self;
@@ -313,8 +309,7 @@ Str_Cat_Trusted_UTF8_IMP(String *self, const char* ptr, size_t size) {
memcpy(result_ptr + self->size, ptr, size);
result_ptr[result_size] = '\0';
String *result = (String*)VTable_Make_Obj(STRING);
- return Str_init_steal_trusted_str(result, result_ptr, result_size,
- result_size + 1);
+ return Str_init_steal_trusted_str(result, result_ptr, result_size);
}
bool
@@ -540,7 +535,6 @@ ViewCharBuf*
ViewCB_init(ViewCharBuf *self, const char *utf8, size_t size) {
self->ptr = (char*)utf8;
self->size = size;
- self->cap = 0;
return self;
}
@@ -558,7 +552,6 @@ SStr_new(void *allocation) {
static char empty_string[] = "";
StackString *self
= (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
- self->cap = 0;
self->size = 0;
self->ptr = empty_string;
return self;
@@ -568,7 +561,6 @@ StackString*
SStr_new_from_str(void *allocation, size_t alloc_size, String *string) {
StackString *self
= (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
- self->cap = alloc_size - sizeof(StackString);
self->size = Str_Get_Size(string);
self->ptr = ((char*)allocation) + sizeof(StackString);
@@ -586,7 +578,6 @@ StackString*
SStr_wrap_str(void *allocation, const char *ptr, size_t size) {
StackString *self
= (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
- self->cap = 0;
self->size = size;
self->ptr = (char*)ptr;
return self;
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c42ec46/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index 876657d..8f666ac 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -25,7 +25,6 @@ class Clownfish::String cnick Str
char *ptr;
size_t size;
- size_t cap; /* allocated bytes, including terminating null */
inert incremented String*
new(size_t size);
@@ -55,20 +54,19 @@ class Clownfish::String cnick Str
* passed-in string. Check validity of supplied UTF-8.
*/
inert incremented String*
- new_steal_str(char *ptr, size_t size, size_t cap);
+ new_steal_str(char *ptr, size_t size);
/** Return a pointer to a new String which assumes ownership of the
* passed-in string. Do not check validity of supplied UTF-8.
*/
inert incremented String*
- new_steal_from_trusted_str(char *ptr, size_t size, size_t cap);
+ new_steal_from_trusted_str(char *ptr, size_t size);
/** Initialize the String using the passed-in string. Do not check
* validity of supplied UTF-8.
*/
public inert String*
- init_steal_trusted_str(decremented String *self, char *ptr,
- size_t size, size_t cap);
+ init_steal_trusted_str(decremented String *self, char *ptr, size_t size);
/** Return a String which holds a single character.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c42ec46/core/Lucy/Index/SortCache/TextSortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache/TextSortCache.c b/core/Lucy/Index/SortCache/TextSortCache.c
index 97df2bb..afd5b50 100644
--- a/core/Lucy/Index/SortCache/TextSortCache.c
+++ b/core/Lucy/Index/SortCache/TextSortCache.c
@@ -115,7 +115,7 @@ TextSortCache_Value_IMP(TextSortCache *self, int32_t ord) {
InStream_Seek(ivars->dat_in, offset);
InStream_Read_Bytes(ivars->dat_in, ptr, len);
ptr[len] = '\0';
- return (Obj*)Str_new_steal_str(ptr, len, len + 1);
+ return (Obj*)Str_new_steal_str(ptr, len);
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c42ec46/core/Lucy/Util/Freezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c
index cdaeffc..e492962 100644
--- a/core/Lucy/Util/Freezer.c
+++ b/core/Lucy/Util/Freezer.c
@@ -216,14 +216,13 @@ Freezer_deserialize_string(String *string, InStream *instream) {
if (size == SIZE_MAX) {
THROW(ERR, "Can't deserialize SIZE_MAX bytes");
}
- size_t cap = Memory_oversize(size + 1, sizeof(char));
- char *buf = MALLOCATE(cap);
+ char *buf = MALLOCATE(size + 1);
InStream_Read_Bytes(instream, buf, size);
buf[size] = '\0';
if (!StrHelp_utf8_valid(buf, size)) {
THROW(ERR, "Attempt to deserialize invalid UTF-8");
}
- return Str_init_steal_trusted_str(string, buf, size, cap);
+ return Str_init_steal_trusted_str(string, buf, size);
}
String*
@@ -339,7 +338,7 @@ Freezer_deserialize_hash(Hash *hash, InStream *instream) {
char *key_buf = (char*)MALLOCATE(len + 1);
InStream_Read_Bytes(instream, key_buf, len);
key_buf[len] = '\0';
- String *key = Str_new_steal_from_trusted_str(key_buf, len, len + 1);
+ String *key = Str_new_steal_from_trusted_str(key_buf, len);
Hash_Store(hash, (Obj*)key, THAW(instream));
DECREF(key);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c42ec46/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index 61018d6..b5e7f57 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -653,7 +653,7 @@ S_unescape_text(char *const top, char *const end) {
Err_set_error(Err_new(mess));
return NULL;
}
- return Str_new_steal_from_trusted_str(target_buf, target_size, cap);
+ return Str_new_steal_from_trusted_str(target_buf, target_size);
}
static CFISH_INLINE bool
[lucy-commits] [23/50] [abbrv] git commit: refs/heads/master - Make sure the return
value of INCREF is used
Posted by nw...@apache.org.
Make sure the return value of INCREF is used
Verified by temporarily adding __attribute__((warn_unused_result)) to
CFISH_Obj_Inc_RefCount.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/2e8f8926
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/2e8f8926
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/2e8f8926
Branch: refs/heads/master
Commit: 2e8f8926b4a072b62c8af9024cc6bbfae92a4e3e
Parents: 5d56059
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri May 10 19:06:00 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:17 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Document/Doc.c | 6 ++----
clownfish/runtime/core/Clownfish/Test/TestObj.c | 2 +-
clownfish/runtime/core/Clownfish/Test/TestVArray.c | 2 +-
.../runtime/core/Clownfish/TestHarness/TestBatchRunner.c | 3 +--
core/Lucy/Index/LexIndex.c | 2 +-
core/Lucy/Index/Snapshot.c | 5 ++---
core/Lucy/Index/SortReader.c | 7 +++----
core/Lucy/Index/ZombieKeyedHash.c | 2 +-
core/Lucy/Search/QueryParser/ParserElem.c | 4 ++--
9 files changed, 14 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/2e8f8926/c/src/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Document/Doc.c b/c/src/Lucy/Document/Doc.c
index e162839..4aa129c 100644
--- a/c/src/Lucy/Document/Doc.c
+++ b/c/src/Lucy/Document/Doc.c
@@ -36,8 +36,7 @@ Doc_init(Doc *self, void *fields, int32_t doc_id) {
Hash *hash;
if (fields) {
- hash = (Hash *)CERTIFY(fields, HASH);
- INCREF(hash);
+ hash = (Hash *)INCREF(CERTIFY(fields, HASH));
}
else {
hash = Hash_new(0);
@@ -64,8 +63,7 @@ Doc_Get_Size_IMP(Doc *self) {
void
Doc_Store_IMP(Doc *self, const String *field, Obj *value) {
Hash *hash = (Hash*)Doc_IVARS(self)->fields;
- Hash_Store(hash, (Obj *)field, value);
- INCREF(value);
+ Hash_Store(hash, (Obj *)field, INCREF(value));
}
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/2e8f8926/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 191ec33..4466ef0 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestObj.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestObj.c
@@ -54,7 +54,7 @@ test_refcounts(TestBatchRunner *runner) {
TEST_INT_EQ(runner, Obj_Get_RefCount(obj), 1,
"Correct starting refcount");
- Obj_Inc_RefCount(obj);
+ obj = Obj_Inc_RefCount(obj);
TEST_INT_EQ(runner, Obj_Get_RefCount(obj), 2, "Inc_RefCount");
Obj_Dec_RefCount(obj);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2e8f8926/clownfish/runtime/core/Clownfish/Test/TestVArray.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestVArray.c b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
index d22cad0..1abb89e 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestVArray.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
@@ -88,7 +88,7 @@ test_Store_Fetch(TestBatchRunner *runner) {
TEST_INT_EQ(runner, 3, VA_Get_Size(array), "Store updates size");
TEST_TRUE(runner, Str_Equals_Utf8(elem, "foo", 3), "Store");
- INCREF(elem);
+ elem = (String*)INCREF(elem);
TEST_INT_EQ(runner, 2, Str_Get_RefCount(elem),
"start with refcount of 2");
VA_Store(array, 2, (Obj*)Str_newf("bar"));
http://git-wip-us.apache.org/repos/asf/lucy/blob/2e8f8926/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.c b/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
index 0e81e04..72cebf2 100644
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
+++ b/clownfish/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
@@ -80,8 +80,7 @@ TestBatchRunner_Run_Batch_IMP(TestBatchRunner *self, TestBatch *batch) {
if (err) {
failed = true;
String *mess = Err_Get_Mess(err);
- INCREF(mess);
- Err_warn_mess(mess);
+ Err_warn_mess((String*)INCREF(mess));
}
if (self->num_failed > 0) {
failed = true;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2e8f8926/core/Lucy/Index/LexIndex.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexIndex.c b/core/Lucy/Index/LexIndex.c
index 3ef77b2..f8a2a82 100644
--- a/core/Lucy/Index/LexIndex.c
+++ b/core/Lucy/Index/LexIndex.c
@@ -62,7 +62,7 @@ LexIndex_init(LexIndex *self, Schema *schema, Folder *folder,
DECREF(self);
Err_throw_mess(ERR, mess);
}
- INCREF(ivars->field_type);
+ ivars->field_type = (FieldType*)INCREF(ivars->field_type);
ivars->term_stepper = FType_Make_Term_Stepper(ivars->field_type);
ivars->ixix_in = Folder_Open_In(folder, ixix_file);
if (!ivars->ixix_in) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/2e8f8926/core/Lucy/Index/Snapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Snapshot.c b/core/Lucy/Index/Snapshot.c
index fd9f546..3f32465 100644
--- a/core/Lucy/Index/Snapshot.c
+++ b/core/Lucy/Index/Snapshot.c
@@ -128,10 +128,9 @@ Snapshot_Read_File_IMP(Snapshot *self, Folder *folder, const String *path) {
}
// Build up list of entries.
- VArray *list = (VArray*)CERTIFY(
+ VArray *list = (VArray*)INCREF(CERTIFY(
Hash_Fetch_Utf8(snap_data, "entries", 7),
- VARRAY);
- INCREF(list);
+ VARRAY));
if (format == 1 || (format == 2 && subformat < 1)) {
VArray *cleaned = S_clean_segment_contents(list);
DECREF(list);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2e8f8926/core/Lucy/Index/SortReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortReader.c b/core/Lucy/Index/SortReader.c
index 28b55f0..efbd994 100644
--- a/core/Lucy/Index/SortReader.c
+++ b/core/Lucy/Index/SortReader.c
@@ -90,16 +90,15 @@ DefSortReader_init(DefaultSortReader *self, Schema *schema, Folder *folder,
HASH));
ivars->null_ords = (Hash*)Hash_Fetch_Utf8(metadata, "null_ords", 9);
if (ivars->null_ords) {
- CERTIFY(ivars->null_ords, HASH);
- INCREF(ivars->null_ords);
+ ivars->null_ords = (Hash*)INCREF(CERTIFY(ivars->null_ords, HASH));
}
else {
ivars->null_ords = Hash_new(0);
}
ivars->ord_widths = (Hash*)Hash_Fetch_Utf8(metadata, "ord_widths", 10);
if (ivars->ord_widths) {
- CERTIFY(ivars->ord_widths, HASH);
- INCREF(ivars->ord_widths);
+ ivars->ord_widths
+ = (Hash*)INCREF(CERTIFY(ivars->ord_widths, HASH));
}
else {
ivars->ord_widths = Hash_new(0);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2e8f8926/core/Lucy/Index/ZombieKeyedHash.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/ZombieKeyedHash.c b/core/Lucy/Index/ZombieKeyedHash.c
index 2747888..c991e66 100644
--- a/core/Lucy/Index/ZombieKeyedHash.c
+++ b/core/Lucy/Index/ZombieKeyedHash.c
@@ -99,7 +99,7 @@ ZKHash_Make_Key_IMP(ZombieKeyedHash *self, Obj *key, int32_t hash_sum) {
* reaches 4. However, we must never call Destroy() for these objects,
* because they will try to free() their initial allocation, which is
* invalid because it's part of a MemoryPool arena. */
- INCREF(retval);
+ retval = INCREF(retval);
return retval;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2e8f8926/core/Lucy/Search/QueryParser/ParserElem.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/ParserElem.c b/core/Lucy/Search/QueryParser/ParserElem.c
index febc56f..9a831df 100644
--- a/core/Lucy/Search/QueryParser/ParserElem.c
+++ b/core/Lucy/Search/QueryParser/ParserElem.c
@@ -44,9 +44,9 @@ ParserElem_Destroy_IMP(ParserElem *self) {
void
ParserElem_Set_Value_IMP(ParserElem *self, Obj *value) {
ParserElemIVARS *const ivars = ParserElem_IVARS(self);
- INCREF(value);
+ Obj *new_value = INCREF(value);
DECREF(ivars->value);
- ivars->value = value;
+ ivars->value = new_value;
}
Obj*
[lucy-commits] [33/50] [abbrv] git commit: refs/heads/master - Use int32_t for
remaining Unicode code points
Posted by nw...@apache.org.
Use int32_t for remaining Unicode code points
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/a49e0d42
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/a49e0d42
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/a49e0d42
Branch: refs/heads/master
Commit: a49e0d427add06505863a25cc1848fde678af47b
Parents: 9355ca3
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 23 15:13:43 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:18 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/CharBuf.c | 2 +-
clownfish/runtime/core/Clownfish/CharBuf.cfh | 2 +-
clownfish/runtime/core/Clownfish/String.c | 6 +++---
clownfish/runtime/core/Clownfish/String.cfh | 6 +++---
clownfish/runtime/core/Clownfish/Test/TestString.c | 8 ++++----
.../runtime/core/Clownfish/Test/Util/TestStringHelper.c | 2 +-
clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c | 4 ++--
clownfish/runtime/core/Clownfish/Util/StringHelper.c | 8 ++++----
clownfish/runtime/core/Clownfish/Util/StringHelper.cfh | 6 +++---
core/Lucy/Highlight/Highlighter.c | 2 +-
core/Lucy/Store/FSFolder.c | 2 +-
core/Lucy/Test/Search/TestSortSpec.c | 2 +-
core/Lucy/Util/Json.c | 2 +-
13 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index bfbae45..ea056b8 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -312,7 +312,7 @@ CB_Yield_String_IMP(CharBuf *self) {
}
void
-CB_Cat_Char_IMP(CharBuf *self, uint32_t code_point) {
+CB_Cat_Char_IMP(CharBuf *self, int32_t code_point) {
const size_t MAX_UTF8_BYTES = 4;
if (self->size + MAX_UTF8_BYTES >= self->cap) {
S_grow(self, Memory_oversize(self->size + MAX_UTF8_BYTES,
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.cfh b/clownfish/runtime/core/Clownfish/CharBuf.cfh
index 64d38da..34c23c3 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.cfh
+++ b/clownfish/runtime/core/Clownfish/CharBuf.cfh
@@ -106,7 +106,7 @@ class Clownfish::CharBuf cnick CB
/** Concatenate one Unicode character onto the end of the CharBuf.
*/
void
- Cat_Char(CharBuf *self, uint32_t code_point);
+ Cat_Char(CharBuf *self, int32_t code_point);
/** Assign more memory to the CharBuf, if it doesn't already have enough
* room to hold a string of <code>size</code> bytes. Cannot shrink the
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 28f27e6..b2c2c97 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -130,7 +130,7 @@ Str_init_wrap_trusted_utf8(String *self, const char *ptr, size_t size) {
}
String*
-Str_new_from_char(uint32_t code_point) {
+Str_new_from_char(int32_t code_point) {
const size_t MAX_UTF8_BYTES = 4;
char *ptr = (char*)MALLOCATE(MAX_UTF8_BYTES + 1);
size_t size = StrHelp_encode_utf8_char(code_point, (uint8_t*)ptr);
@@ -451,7 +451,7 @@ Str_Length_IMP(String *self) {
return SStrIter_Advance(iter, SIZE_MAX);
}
-uint32_t
+int32_t
Str_Code_Point_At_IMP(String *self, size_t tick) {
StackStringIterator *iter = STR_STACKTOP(self);
SStrIter_Advance(iter, tick);
@@ -459,7 +459,7 @@ Str_Code_Point_At_IMP(String *self, size_t tick) {
return code_point == STRITER_DONE ? 0 : code_point;
}
-uint32_t
+int32_t
Str_Code_Point_From_IMP(String *self, size_t tick) {
if (tick == 0) { return 0; }
StackStringIterator *iter = STR_STACKTAIL(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index 1151589..c4ea6d5 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -86,7 +86,7 @@ class Clownfish::String cnick Str
/** Return a String which holds a single character.
*/
inert incremented String*
- new_from_char(uint32_t code_point);
+ new_from_char(int32_t code_point);
/** Return a pointer to a new String which contains formatted data
* expanded according to CB_VCatF.
@@ -241,14 +241,14 @@ class Clownfish::String cnick Str
* better to throw an exception, but that's not practical with UTF-8 and
* no cached length.)
*/
- uint32_t
+ int32_t
Code_Point_At(String *self, size_t tick);
/** Return the Unicode code point at the specified number of code points
* counted backwards from the end of the string. Return 0 if outside the
* string.
*/
- uint32_t
+ int32_t
Code_Point_From(String *self, size_t tick);
/** Return a newly allocated String containing a copy of the indicated
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/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 652c8e9..a59ff4c 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestString.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestString.c
@@ -52,7 +52,7 @@ S_get_str(const char *string) {
// Surround a smiley with lots of whitespace.
static String*
S_smiley_with_whitespace(int *num_spaces_ptr) {
- uint32_t spaces[] = {
+ int32_t spaces[] = {
' ', '\t', '\r', '\n', 0x000B, 0x000C, 0x000D, 0x0085,
0x00A0, 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004,
0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029,
@@ -141,10 +141,10 @@ test_Find(TestBatchRunner *runner) {
static void
test_Code_Point_At_and_From(TestBatchRunner *runner) {
- uint32_t code_points[] = {
+ int32_t code_points[] = {
'a', smiley_cp, smiley_cp, 'b', smiley_cp, 'c'
};
- uint32_t num_code_points = sizeof(code_points) / sizeof(uint32_t);
+ uint32_t num_code_points = sizeof(code_points) / sizeof(int32_t);
String *string = Str_newf("a%s%sb%sc", smiley, smiley, smiley);
uint32_t i;
@@ -316,7 +316,7 @@ test_Swap_Chars(TestBatchRunner *runner) {
static void
test_iterator(TestBatchRunner *runner) {
- static const uint32_t code_points[] = {
+ static const int32_t code_points[] = {
0x41,
0x7F,
0x80,
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
index 2ecb528..339de02 100644
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
+++ b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
@@ -156,7 +156,7 @@ test_to_base36(TestBatchRunner *runner) {
static void
test_utf8_round_trip(TestBatchRunner *runner) {
- uint32_t code_point;
+ int32_t code_point;
for (code_point = 0; code_point <= 0x10FFFF; code_point++) {
char buffer[4];
uint32_t size = StrHelp_encode_utf8_char(code_point, buffer);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/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 31195ed..a987d5c 100644
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
+++ b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
@@ -70,9 +70,9 @@ TestUtils_random_f64s(double *buf, size_t count) {
return f64s;
}
-static uint32_t
+static int32_t
S_random_code_point(void) {
- uint32_t code_point = 0;
+ int32_t code_point = 0;
while (1) {
uint8_t chance = (rand() % 9) + 1;
switch (chance) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/Util/StringHelper.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/StringHelper.c b/clownfish/runtime/core/Clownfish/Util/StringHelper.c
index 98e7f11..ba117c5 100644
--- a/clownfish/runtime/core/Clownfish/Util/StringHelper.c
+++ b/clownfish/runtime/core/Clownfish/Util/StringHelper.c
@@ -130,7 +130,7 @@ StrHelp_utf8_valid(const char *ptr, size_t size) {
}
bool
-StrHelp_is_whitespace(uint32_t code_point) {
+StrHelp_is_whitespace(int32_t code_point) {
switch (code_point) {
// <control-0009>..<control-000D>
case 0x0009: case 0x000A: case 0x000B: case 0x000C: case 0x000D:
@@ -156,7 +156,7 @@ StrHelp_is_whitespace(uint32_t code_point) {
}
uint32_t
-StrHelp_encode_utf8_char(uint32_t code_point, void *buffer) {
+StrHelp_encode_utf8_char(int32_t code_point, void *buffer) {
uint8_t *buf = (uint8_t*)buffer;
if (code_point <= 0x7F) { // ASCII
buf[0] = (uint8_t)code_point;
@@ -186,10 +186,10 @@ StrHelp_encode_utf8_char(uint32_t code_point, void *buffer) {
}
}
-uint32_t
+int32_t
StrHelp_decode_utf8_char(const char *ptr) {
const uint8_t *const string = (const uint8_t*)ptr;
- uint32_t retval = *string;
+ int32_t retval = *string;
int bytes = StrHelp_UTF8_COUNT[retval];
switch (bytes & 0x7) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh b/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
index 905613d..1cbb46a 100644
--- a/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
+++ b/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
@@ -47,7 +47,7 @@ inert class Clownfish::Util::StringHelper cnick StrHelp {
/** Returns true if the code point qualifies as Unicode whitespace.
*/
inert bool
- is_whitespace(uint32_t code_point);
+ is_whitespace(int32_t code_point);
/** Encode a Unicode code point to a UTF-8 sequence.
*
@@ -56,11 +56,11 @@ inert class Clownfish::Util::StringHelper cnick StrHelp {
* maximum legal length for a UTF-8 char).
*/
inert uint32_t
- encode_utf8_char(uint32_t code_point, void *buffer);
+ encode_utf8_char(int32_t code_point, void *buffer);
/** Decode a UTF-8 sequence to a Unicode code point. Assumes valid UTF-8.
*/
- inert uint32_t
+ inert int32_t
decode_utf8_char(const char *utf8);
/** Return the first non-continuation byte before the supplied pointer.
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index b181115..c384b46 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -28,7 +28,7 @@
#include "Lucy/Search/Span.h"
#include "Lucy/Index/DocVector.h"
-const uint32_t ELLIPSIS_CODE_POINT = 0x2026;
+const int32_t ELLIPSIS_CODE_POINT = 0x2026;
/* If Highlighter_Encode has been overridden, return its output. If not,
* increment the refcount of the supplied encode_buf and call encode_entities.
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index cb4d09e..1550d73 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -350,7 +350,7 @@ S_is_local_entry(const String *path) {
static bool
S_is_absolute(const String *path) {
- uint32_t code_point = Str_Code_Point_At(path, 0);
+ int32_t code_point = Str_Code_Point_At(path, 0);
if (isalpha(code_point)) {
code_point = Str_Code_Point_At(path, 1);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index 6401f27..81effa3 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -272,7 +272,7 @@ S_random_string() {
size_t length = 1 + rand() % 10;
CharBuf *buf = CB_new(length);
while (length--) {
- uint32_t code_point = 'a' + rand() % ('z' - 'a' + 1);
+ int32_t code_point = 'a' + rand() % ('z' - 'a' + 1);
CB_Cat_Char(buf, code_point);
}
String *string = CB_Yield_String(buf);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index 9b751ad..cdb01fb 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -634,7 +634,7 @@ S_unescape_text(const char *top, const char *end) {
text - 5, end);
return NULL;
}
- target_size += StrHelp_encode_utf8_char((uint32_t)code_point,
+ target_size += StrHelp_encode_utf8_char((int32_t)code_point,
target_buf + target_size);
}
break;
[lucy-commits] [46/50] [abbrv] git commit: refs/heads/master - Fix C sample program
Posted by nw...@apache.org.
Fix C sample program
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/bb0fff59
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/bb0fff59
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/bb0fff59
Branch: refs/heads/master
Commit: bb0fff59cbc2f34007f287ca91406f368b5f005d
Parents: d099713
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 19:50:38 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200
----------------------------------------------------------------------
c/sample/getting_started.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/bb0fff59/c/sample/getting_started.c
----------------------------------------------------------------------
diff --git a/c/sample/getting_started.c b/c/sample/getting_started.c
index f7bbcfe..10093b8 100644
--- a/c/sample/getting_started.c
+++ b/c/sample/getting_started.c
@@ -23,13 +23,14 @@
*
* c99 \
* getting_started.c \
- * -I $PREFIX/include -L $PREFIX/lib -l lucy \
+ * -I $PREFIX/include -L $PREFIX/lib -l cfish -l lucy \
* -o getting_started
*/
#include <stdio.h>
#include <string.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "Clownfish/String.h"
#include "Lucy/Analysis/EasyAnalyzer.h"
@@ -179,7 +180,7 @@ S_search(IndexSearcher *searcher, const char *query) {
printf("Result %d: %s\n", i, value);
- DECREF(value);
+ free(value);
DECREF(value_str);
DECREF(hit);
i++;
[lucy-commits] [30/50] [abbrv] git commit: refs/heads/master - Copy substring of
wrapped strings
Posted by nw...@apache.org.
Copy substring of wrapped strings
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/9bf27d98
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/9bf27d98
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/9bf27d98
Branch: refs/heads/master
Commit: 9bf27d9822ffc91672e4475fd7b88d315fb6fc90
Parents: 6bc95d5
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Sep 18 20:43:48 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:18 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/9bf27d98/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 8747ab3..ab4d34e 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -156,11 +156,19 @@ Str_newf(const char *pattern, ...) {
}
static String*
-S_new_substring(String *origin, size_t byte_offset, size_t size) {
+S_new_substring(String *string, size_t byte_offset, size_t size) {
String *self = (String*)VTable_Make_Obj(STRING);
- self->ptr = origin->ptr + byte_offset;
- self->size = size;
- self->origin = (String*)INCREF(origin);
+
+ if (string->origin == NULL) {
+ // Copy substring of wrapped strings.
+ Str_init_from_trusted_utf8(self, string->ptr + byte_offset, size);
+ }
+ else {
+ self->ptr = string->ptr + byte_offset;
+ self->size = size;
+ self->origin = (String*)INCREF(string->origin);
+ }
+
return self;
}
[lucy-commits] [36/50] [abbrv] Convert "const String" to "String"
Posted by nw...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/Folder.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.cfh b/core/Lucy/Store/Folder.cfh
index dbb1b4e..dafa984 100644
--- a/core/Lucy/Store/Folder.cfh
+++ b/core/Lucy/Store/Folder.cfh
@@ -32,7 +32,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
Hash *entries;
public inert nullable Folder*
- init(Folder *self, const String *path);
+ init(Folder *self, String *path);
public void
Destroy(Folder *self);
@@ -45,7 +45,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
/** Setter for <code>path</code> member var.
*/
void
- Set_Path(Folder *self, const String *path);
+ Set_Path(Folder *self, String *path);
/** Open an OutStream, or set Err_error and return NULL on failure.
*
@@ -53,7 +53,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return an OutStream.
*/
public incremented nullable OutStream*
- Open_Out(Folder *self, const String *path);
+ Open_Out(Folder *self, String *path);
/** Open an InStream, or set Err_error and return NULL on failure.
*
@@ -61,7 +61,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return an InStream.
*/
public incremented nullable InStream*
- Open_In(Folder *self, const String *path);
+ Open_In(Folder *self, String *path);
/** Open a FileHandle, or set Err_error and return NULL on failure.
*
@@ -70,7 +70,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return a FileHandle.
*/
public incremented nullable FileHandle*
- Open_FileHandle(Folder *self, const String *path, uint32_t flags);
+ Open_FileHandle(Folder *self, String *path, uint32_t flags);
/** Open a DirHandle or set Err_error and return NULL on failure.
*
@@ -79,7 +79,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return a DirHandle.
*/
public incremented nullable DirHandle*
- Open_Dir(Folder *self, const String *path = NULL);
+ Open_Dir(Folder *self, String *path = NULL);
/** Create a subdirectory.
*
@@ -87,7 +87,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return true on success, false on failure (sets Err_error).
*/
public bool
- MkDir(Folder *self, const String *path);
+ MkDir(Folder *self, String *path);
/** List all local entries within a directory. Set Err_error and return
* NULL if something goes wrong.
@@ -96,7 +96,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return an unsorted array of filenames.
*/
incremented VArray*
- List(Folder *self, const String *path = NULL);
+ List(Folder *self, String *path = NULL);
/** Recursively list all files and directories in the Folder.
*
@@ -104,7 +104,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return an unsorted array of relative filepaths.
*/
incremented VArray*
- List_R(Folder *self, const String *path = NULL);
+ List_R(Folder *self, String *path = NULL);
/** Indicate whether an entity exists at <code>path</code>.
*
@@ -112,7 +112,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return true if <code>path</code> exists.
*/
public bool
- Exists(Folder *self, const String *path);
+ Exists(Folder *self, String *path);
/** Indicate whether a directory exists at <code>path</code>.
*
@@ -120,7 +120,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return true if <code>path</code> is a directory.
*/
bool
- Is_Directory(Folder *self, const String *path);
+ Is_Directory(Folder *self, String *path);
/** Delete an entry from the folder.
*
@@ -128,7 +128,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return true if the deletion was successful.
*/
public bool
- Delete(Folder *self, const String *path);
+ Delete(Folder *self, String *path);
/** Delete recursively, starting at <code>path</code>
*
@@ -137,7 +137,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* part remains.
*/
public bool
- Delete_Tree(Folder *self, const String *path);
+ Delete_Tree(Folder *self, String *path);
/** Rename a file or directory, or set Err_error and return false on
* failure. If an entry exists at <code>to</code>, the results are
@@ -148,7 +148,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return true on success, false on failure.
*/
public abstract bool
- Rename(Folder *self, const String *from, const String *to);
+ Rename(Folder *self, String *from, String *to);
/** Create a hard link at path <code>to</code> pointing at the existing
* file <code>from</code>, or set Err_error and return false on failure.
@@ -156,7 +156,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return true on success, false on failure.
*/
public abstract bool
- Hard_Link(Folder *self, const String *from, const String *to);
+ Hard_Link(Folder *self, String *from, String *to);
/** Read a file and return its contents.
*
@@ -164,12 +164,12 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @param return the file's contents.
*/
public incremented ByteBuf*
- Slurp_File(Folder *self, const String *path);
+ Slurp_File(Folder *self, String *path);
/** Collapse the contents of the directory into a compound file.
*/
void
- Consolidate(Folder *self, const String *path);
+ Consolidate(Folder *self, String *path);
/** Given a filepath, return the Folder representing everything except
* the last component. E.g. the 'foo/bar' Folder for '/foo/bar/baz.txt',
@@ -179,7 +179,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* either doesn't exist or isn't a directory, return NULL.
*/
nullable Folder*
- Enclosing_Folder(Folder *self, const String *path);
+ Enclosing_Folder(Folder *self, String *path);
/** Return the Folder at the subdirectory specified by <code>path</code>.
* If <code>path</code> is NULL or an empty string, return this Folder.
@@ -190,7 +190,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return A Folder.
*/
nullable Folder*
- Find_Folder(Folder *self, const String *path);
+ Find_Folder(Folder *self, String *path);
/** Perform implementation-specific initialization. For example: FSFolder
* creates its own directory.
@@ -214,13 +214,13 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* on failure.
*/
abstract incremented nullable FileHandle*
- Local_Open_FileHandle(Folder *self, const String *name, uint32_t flags);
+ Local_Open_FileHandle(Folder *self, String *name, uint32_t flags);
/** Open an InStream for a local file, or set Err_error and return NULL on
* failure.
*/
incremented nullable InStream*
- Local_Open_In(Folder *self, const String *name);
+ Local_Open_In(Folder *self, String *name);
/** Open a DirHandle to iterate over the local entries in this Folder, or
* set Err_error and return NULL on failure.
@@ -234,7 +234,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return true on success, false on failure (sets Err_error)
*/
abstract bool
- Local_MkDir(Folder *self, const String *name);
+ Local_MkDir(Folder *self, String *name);
/** Indicate whether a local entry exists for the supplied
* <code>name</code>.
@@ -242,7 +242,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @param name The name of the local entry.
*/
abstract bool
- Local_Exists(Folder *self, const String *name);
+ Local_Exists(Folder *self, String *name);
/** Indicate whether a local subdirectory exists with the supplied
* <code>name</code>.
@@ -250,7 +250,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @param name The name of the local subdirectory.
*/
abstract bool
- Local_Is_Directory(Folder *self, const String *name);
+ Local_Is_Directory(Folder *self, String *name);
/** Return the Folder object representing the specified directory, if such
* a directory exists.
@@ -259,7 +259,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return a Folder.
*/
abstract nullable Folder*
- Local_Find_Folder(Folder *self, const String *name);
+ Local_Find_Folder(Folder *self, String *name);
/** Delete a local entry.
*
@@ -267,7 +267,7 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
* @return true if the deletion was successful.
*/
abstract bool
- Local_Delete(Folder *self, const String *name);
+ Local_Delete(Folder *self, String *name);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/InStream.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/InStream.c b/core/Lucy/Store/InStream.c
index d68efa4..885e576 100644
--- a/core/Lucy/Store/InStream.c
+++ b/core/Lucy/Store/InStream.c
@@ -122,7 +122,7 @@ InStream_Destroy_IMP(InStream *self) {
}
InStream*
-InStream_Reopen_IMP(InStream *self, const String *filename, int64_t offset,
+InStream_Reopen_IMP(InStream *self, String *filename, int64_t offset,
int64_t len) {
InStreamIVARS *const ivars = InStream_IVARS(self);
if (!ivars->file_handle) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/InStream.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/InStream.cfh b/core/Lucy/Store/InStream.cfh
index 9fbb19b..88a099f 100644
--- a/core/Lucy/Store/InStream.cfh
+++ b/core/Lucy/Store/InStream.cfh
@@ -62,7 +62,7 @@ class Lucy::Store::InStream inherits Clownfish::Obj {
* @param len Length of the file as seen by the new InStream.
*/
incremented InStream*
- Reopen(InStream *self, const String *filename = NULL, int64_t offset,
+ Reopen(InStream *self, String *filename = NULL, int64_t offset,
int64_t len);
/** Clone the InStream. Clones share the same underlying FileHandle and
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index e95fa5f..f252f8f 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -30,8 +30,8 @@
#include "Lucy/Util/Sleep.h"
Lock*
-Lock_init(Lock *self, Folder *folder, const String *name,
- const String *host, int32_t timeout, int32_t interval) {
+Lock_init(Lock *self, Folder *folder, String *name,
+ String *host, int32_t timeout, int32_t interval) {
LockIVARS *const ivars = Lock_IVARS(self);
// Validate.
@@ -112,15 +112,15 @@ Lock_Obtain_IMP(Lock *self) {
/***************************************************************************/
LockFileLock*
-LFLock_new(Folder *folder, const String *name, const String *host,
+LFLock_new(Folder *folder, String *name, String *host,
int32_t timeout, int32_t interval) {
LockFileLock *self = (LockFileLock*)VTable_Make_Obj(LOCKFILELOCK);
return LFLock_init(self, folder, name, host, timeout, interval);
}
LockFileLock*
-LFLock_init(LockFileLock *self, Folder *folder, const String *name,
- const String *host, int32_t timeout, int32_t interval) {
+LFLock_init(LockFileLock *self, Folder *folder, String *name,
+ String *host, int32_t timeout, int32_t interval) {
int pid = PID_getpid();
Lock_init((Lock*)self, folder, name, host, timeout, interval);
LockFileLockIVARS *const ivars = LFLock_IVARS(self);
@@ -226,7 +226,7 @@ LFLock_Clear_Stale_IMP(LockFileLock *self) {
}
bool
-LFLock_Maybe_Delete_File_IMP(LockFileLock *self, const String *path,
+LFLock_Maybe_Delete_File_IMP(LockFileLock *self, String *path,
bool delete_mine, bool delete_other) {
LockFileLockIVARS *const ivars = LFLock_IVARS(self);
Folder *folder = ivars->folder;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/Lock.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.cfh b/core/Lucy/Store/Lock.cfh
index d18d083..08dc94b 100644
--- a/core/Lucy/Store/Lock.cfh
+++ b/core/Lucy/Store/Lock.cfh
@@ -47,8 +47,8 @@ public abstract class Lucy::Store::Lock inherits Clownfish::Obj {
* @param interval Time in milliseconds between retries.
*/
public inert Lock*
- init(Lock *self, Folder *folder, const String *name,
- const String *host, int32_t timeout = 0, int32_t interval = 100);
+ init(Lock *self, Folder *folder, String *name,
+ String *host, int32_t timeout = 0, int32_t interval = 100);
/** Returns true if the Lock is shared, false if the Lock is exclusive.
*/
@@ -116,12 +116,12 @@ class Lucy::Store::LockFileLock cnick LFLock
String *link_path;
inert incremented LockFileLock*
- new(Folder *folder, const String *name, const String *host,
+ new(Folder *folder, String *name, String *host,
int32_t timeout = 0, int32_t interval = 100);
public inert LockFileLock*
- init(LockFileLock *self, Folder *folder, const String *name,
- const String *host, int32_t timeout = 0, int32_t interval = 100);
+ init(LockFileLock *self, Folder *folder, String *name,
+ String *host, int32_t timeout = 0, int32_t interval = 100);
public bool
Shared(LockFileLock *self);
@@ -148,7 +148,7 @@ class Lucy::Store::LockFileLock cnick LFLock
* don't match this process's pid.
*/
bool
- Maybe_Delete_File(LockFileLock *self, const String *filepath,
+ Maybe_Delete_File(LockFileLock *self, String *filepath,
bool delete_mine, bool delete_other);
public void
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/LockFactory.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/LockFactory.c b/core/Lucy/Store/LockFactory.c
index f485654..dee3d20 100644
--- a/core/Lucy/Store/LockFactory.c
+++ b/core/Lucy/Store/LockFactory.c
@@ -27,13 +27,13 @@
#include "Lucy/Store/SharedLock.h"
LockFactory*
-LockFact_new(Folder *folder, const String *host) {
+LockFact_new(Folder *folder, String *host) {
LockFactory *self = (LockFactory*)VTable_Make_Obj(LOCKFACTORY);
return LockFact_init(self, folder, host);
}
LockFactory*
-LockFact_init(LockFactory *self, Folder *folder, const String *host) {
+LockFact_init(LockFactory *self, Folder *folder, String *host) {
LockFactoryIVARS *const ivars = LockFact_IVARS(self);
ivars->folder = (Folder*)INCREF(folder);
ivars->host = Str_Clone(host);
@@ -49,7 +49,7 @@ LockFact_Destroy_IMP(LockFactory *self) {
}
Lock*
-LockFact_Make_Lock_IMP(LockFactory *self, const String *name,
+LockFact_Make_Lock_IMP(LockFactory *self, String *name,
int32_t timeout, int32_t interval) {
LockFactoryIVARS *const ivars = LockFact_IVARS(self);
return (Lock*)LFLock_new(ivars->folder, name, ivars->host, timeout,
@@ -57,7 +57,7 @@ LockFact_Make_Lock_IMP(LockFactory *self, const String *name,
}
Lock*
-LockFact_Make_Shared_Lock_IMP(LockFactory *self, const String *name,
+LockFact_Make_Shared_Lock_IMP(LockFactory *self, String *name,
int32_t timeout, int32_t interval) {
LockFactoryIVARS *const ivars = LockFact_IVARS(self);
return (Lock*)ShLock_new(ivars->folder, name, ivars->host, timeout,
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/LockFactory.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/LockFactory.cfh b/core/Lucy/Store/LockFactory.cfh
index b450191..d9ab93d 100644
--- a/core/Lucy/Store/LockFactory.cfh
+++ b/core/Lucy/Store/LockFactory.cfh
@@ -31,14 +31,14 @@ public class Lucy::Store::LockFactory cnick LockFact
String *host;
inert incremented LockFactory*
- new(Folder *folder, const String *host);
+ new(Folder *folder, String *host);
/**
* @param folder A L<Lucy::Store::Folder>.
* @param host An identifier which should be unique per-machine.
*/
public inert LockFactory*
- init(LockFactory *self, Folder *folder, const String *host);
+ init(LockFactory *self, Folder *folder, String *host);
/** Return a Lock object, which, once Obtain() returns successfully,
* maintains an exclusive lock on a resource.
@@ -50,7 +50,7 @@ public class Lucy::Store::LockFactory cnick LockFact
* @param interval Time in milliseconds between retries.
*/
public incremented Lock*
- Make_Lock(LockFactory *self, const String *name, int32_t timeout = 0,
+ Make_Lock(LockFactory *self, String *name, int32_t timeout = 0,
int32_t interval = 100);
/** Return a Lock object for which Shared() returns true, and which
@@ -64,7 +64,7 @@ public class Lucy::Store::LockFactory cnick LockFact
* @param interval Time in milliseconds between retries.
*/
public incremented Lock*
- Make_Shared_Lock(LockFactory *self, const String *name,
+ Make_Shared_Lock(LockFactory *self, String *name,
int32_t timeout = 0, int32_t interval = 100);
public void
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/RAMFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFileHandle.c b/core/Lucy/Store/RAMFileHandle.c
index 5178f6f..98edc44 100644
--- a/core/Lucy/Store/RAMFileHandle.c
+++ b/core/Lucy/Store/RAMFileHandle.c
@@ -22,13 +22,13 @@
#include "Lucy/Store/FileWindow.h"
RAMFileHandle*
-RAMFH_open(const String *path, uint32_t flags, RAMFile *file) {
+RAMFH_open(String *path, uint32_t flags, RAMFile *file) {
RAMFileHandle *self = (RAMFileHandle*)VTable_Make_Obj(RAMFILEHANDLE);
return RAMFH_do_open(self, path, flags, file);
}
RAMFileHandle*
-RAMFH_do_open(RAMFileHandle *self, const String *path, uint32_t flags,
+RAMFH_do_open(RAMFileHandle *self, String *path, uint32_t flags,
RAMFile *file) {
bool must_create
= (flags & (FH_CREATE | FH_EXCLUSIVE)) == (FH_CREATE | FH_EXCLUSIVE)
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/RAMFileHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFileHandle.cfh b/core/Lucy/Store/RAMFileHandle.cfh
index fb0877f..c7660e1 100644
--- a/core/Lucy/Store/RAMFileHandle.cfh
+++ b/core/Lucy/Store/RAMFileHandle.cfh
@@ -29,7 +29,7 @@ class Lucy::Store::RAMFileHandle cnick RAMFH
int64_t len;
inert incremented nullable RAMFileHandle*
- open(const String *path = NULL, uint32_t flags, RAMFile *file = NULL);
+ open(String *path = NULL, uint32_t flags, RAMFile *file = NULL);
/**
* Return a new RAMFileHandle, or set Err_error and return NULL on
@@ -41,7 +41,7 @@ class Lucy::Store::RAMFileHandle cnick RAMFH
* must be passed or an error will occur.
*/
inert nullable RAMFileHandle*
- do_open(RAMFileHandle *self, const String *path = NULL, uint32_t flags,
+ do_open(RAMFileHandle *self, String *path = NULL, uint32_t flags,
RAMFile *file = NULL);
/** Access the backing RAMFile.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/RAMFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFolder.c b/core/Lucy/Store/RAMFolder.c
index 4a42484..fe497ab 100644
--- a/core/Lucy/Store/RAMFolder.c
+++ b/core/Lucy/Store/RAMFolder.c
@@ -28,16 +28,16 @@
// Return the concatenation of the Folder's path and the supplied path.
static String*
-S_fullpath(RAMFolder *self, const String *path);
+S_fullpath(RAMFolder *self, String *path);
RAMFolder*
-RAMFolder_new(const String *path) {
+RAMFolder_new(String *path) {
RAMFolder *self = (RAMFolder*)VTable_Make_Obj(RAMFOLDER);
return RAMFolder_init(self, path);
}
RAMFolder*
-RAMFolder_init(RAMFolder *self, const String *path) {
+RAMFolder_init(RAMFolder *self, String *path) {
Folder_init((Folder*)self, path);
return self;
}
@@ -54,7 +54,7 @@ RAMFolder_Check_IMP(RAMFolder *self) {
}
bool
-RAMFolder_Local_MkDir_IMP(RAMFolder *self, const String *name) {
+RAMFolder_Local_MkDir_IMP(RAMFolder *self, String *name) {
RAMFolderIVARS *const ivars = RAMFolder_IVARS(self);
if (Hash_Fetch(ivars->entries, (Obj*)name)) {
Err_set_error(Err_new(Str_newf("Can't MkDir, '%o' already exists",
@@ -71,7 +71,7 @@ RAMFolder_Local_MkDir_IMP(RAMFolder *self, const String *name) {
}
FileHandle*
-RAMFolder_Local_Open_FileHandle_IMP(RAMFolder *self, const String *name,
+RAMFolder_Local_Open_FileHandle_IMP(RAMFolder *self, String *name,
uint32_t flags) {
RAMFolderIVARS *const ivars = RAMFolder_IVARS(self);
RAMFileHandle *fh;
@@ -122,13 +122,13 @@ RAMFolder_Local_Open_Dir_IMP(RAMFolder *self) {
}
bool
-RAMFolder_Local_Exists_IMP(RAMFolder *self, const String *name) {
+RAMFolder_Local_Exists_IMP(RAMFolder *self, String *name) {
RAMFolderIVARS *const ivars = RAMFolder_IVARS(self);
return !!Hash_Fetch(ivars->entries, (Obj*)name);
}
bool
-RAMFolder_Local_Is_Directory_IMP(RAMFolder *self, const String *name) {
+RAMFolder_Local_Is_Directory_IMP(RAMFolder *self, String *name) {
RAMFolderIVARS *const ivars = RAMFolder_IVARS(self);
Obj *entry = Hash_Fetch(ivars->entries, (Obj*)name);
if (entry && Obj_Is_A(entry, FOLDER)) { return true; }
@@ -139,7 +139,7 @@ RAMFolder_Local_Is_Directory_IMP(RAMFolder *self, const String *name) {
#define OP_HARD_LINK 2
static bool
-S_rename_or_hard_link(RAMFolder *self, const String* from, const String *to,
+S_rename_or_hard_link(RAMFolder *self, String* from, String *to,
Folder *from_folder, Folder *to_folder,
String *from_name, String *to_name,
int op) {
@@ -274,8 +274,8 @@ S_rename_or_hard_link(RAMFolder *self, const String* from, const String *to,
}
bool
-RAMFolder_Rename_IMP(RAMFolder *self, const String* from,
- const String *to) {
+RAMFolder_Rename_IMP(RAMFolder *self, String* from,
+ String *to) {
Folder *from_folder = RAMFolder_Enclosing_Folder(self, from);
Folder *to_folder = RAMFolder_Enclosing_Folder(self, to);
String *from_name = IxFileNames_local_part(from);
@@ -289,8 +289,8 @@ RAMFolder_Rename_IMP(RAMFolder *self, const String* from,
}
bool
-RAMFolder_Hard_Link_IMP(RAMFolder *self, const String *from,
- const String *to) {
+RAMFolder_Hard_Link_IMP(RAMFolder *self, String *from,
+ String *to) {
Folder *from_folder = RAMFolder_Enclosing_Folder(self, from);
Folder *to_folder = RAMFolder_Enclosing_Folder(self, to);
String *from_name = IxFileNames_local_part(from);
@@ -304,7 +304,7 @@ RAMFolder_Hard_Link_IMP(RAMFolder *self, const String *from,
}
bool
-RAMFolder_Local_Delete_IMP(RAMFolder *self, const String *name) {
+RAMFolder_Local_Delete_IMP(RAMFolder *self, String *name) {
RAMFolderIVARS *const ivars = RAMFolder_IVARS(self);
Obj *entry = Hash_Fetch(ivars->entries, (Obj*)name);
if (entry) {
@@ -338,7 +338,7 @@ RAMFolder_Local_Delete_IMP(RAMFolder *self, const String *name) {
}
Folder*
-RAMFolder_Local_Find_Folder_IMP(RAMFolder *self, const String *path) {
+RAMFolder_Local_Find_Folder_IMP(RAMFolder *self, String *path) {
RAMFolderIVARS *const ivars = RAMFolder_IVARS(self);
Folder *local_folder = (Folder*)Hash_Fetch(ivars->entries, (Obj*)path);
if (local_folder && Folder_Is_A(local_folder, FOLDER)) {
@@ -353,7 +353,7 @@ RAMFolder_Close_IMP(RAMFolder *self) {
}
static String*
-S_fullpath(RAMFolder *self, const String *path) {
+S_fullpath(RAMFolder *self, String *path) {
RAMFolderIVARS *const ivars = RAMFolder_IVARS(self);
if (Str_Get_Size(ivars->path)) {
return Str_newf("%o/%o", ivars->path, path);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/RAMFolder.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFolder.cfh b/core/Lucy/Store/RAMFolder.cfh
index a1133f2..c04267d 100644
--- a/core/Lucy/Store/RAMFolder.cfh
+++ b/core/Lucy/Store/RAMFolder.cfh
@@ -25,13 +25,13 @@ parcel Lucy;
public class Lucy::Store::RAMFolder inherits Lucy::Store::Folder {
inert incremented RAMFolder*
- new(const String *path = NULL);
+ new(String *path = NULL);
/**
* @param path Relative path, used for subfolders.
*/
public inert RAMFolder*
- init(RAMFolder *self, const String *path = NULL);
+ init(RAMFolder *self, String *path = NULL);
public void
Initialize(RAMFolder *self);
@@ -43,31 +43,31 @@ public class Lucy::Store::RAMFolder inherits Lucy::Store::Folder {
Close(RAMFolder *self);
incremented nullable FileHandle*
- Local_Open_FileHandle(RAMFolder *self, const String *name, uint32_t flags);
+ Local_Open_FileHandle(RAMFolder *self, String *name, uint32_t flags);
incremented nullable DirHandle*
Local_Open_Dir(RAMFolder *self);
bool
- Local_MkDir(RAMFolder *self, const String *name);
+ Local_MkDir(RAMFolder *self, String *name);
bool
- Local_Exists(RAMFolder *self, const String *name);
+ Local_Exists(RAMFolder *self, String *name);
bool
- Local_Is_Directory(RAMFolder *self, const String *name);
+ Local_Is_Directory(RAMFolder *self, String *name);
nullable Folder*
- Local_Find_Folder(RAMFolder *self, const String *name);
+ Local_Find_Folder(RAMFolder *self, String *name);
bool
- Local_Delete(RAMFolder *self, const String *name);
+ Local_Delete(RAMFolder *self, String *name);
public bool
- Rename(RAMFolder *self, const String* from, const String *to);
+ Rename(RAMFolder *self, String* from, String *to);
public bool
- Hard_Link(RAMFolder *self, const String *from, const String *to);
+ Hard_Link(RAMFolder *self, String *from, String *to);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/SharedLock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.c b/core/Lucy/Store/SharedLock.c
index 1707254..54bb4e5 100644
--- a/core/Lucy/Store/SharedLock.c
+++ b/core/Lucy/Store/SharedLock.c
@@ -27,15 +27,15 @@
#include "Lucy/Store/OutStream.h"
SharedLock*
-ShLock_new(Folder *folder, const String *name, const String *host,
+ShLock_new(Folder *folder, String *name, String *host,
int32_t timeout, int32_t interval) {
SharedLock *self = (SharedLock*)VTable_Make_Obj(SHAREDLOCK);
return ShLock_init(self, folder, name, host, timeout, interval);
}
SharedLock*
-ShLock_init(SharedLock *self, Folder *folder, const String *name,
- const String *host, int32_t timeout, int32_t interval) {
+ShLock_init(SharedLock *self, Folder *folder, String *name,
+ String *host, int32_t timeout, int32_t interval) {
LFLock_init((LockFileLock*)self, folder, name, host, timeout, interval);
SharedLockIVARS *const ivars = ShLock_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Store/SharedLock.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.cfh b/core/Lucy/Store/SharedLock.cfh
index ce27042..a9b741c 100644
--- a/core/Lucy/Store/SharedLock.cfh
+++ b/core/Lucy/Store/SharedLock.cfh
@@ -42,7 +42,7 @@ class Lucy::Store::SharedLock cnick ShLock
inherits Lucy::Store::LockFileLock {
inert incremented SharedLock*
- new(Folder *folder, const String *name, const String *host,
+ new(Folder *folder, String *name, String *host,
int32_t timeout = 0, int32_t interval = 100);
/**
@@ -55,8 +55,8 @@ class Lucy::Store::SharedLock cnick ShLock
* @param interval Time in milliseconds between retries.
*/
public inert SharedLock*
- init(SharedLock *self, Folder *folder, const String *name,
- const String *host, int32_t timeout = 0, int32_t interval = 100);
+ init(SharedLock *self, Folder *folder, String *name,
+ String *host, int32_t timeout = 0, int32_t interval = 100);
public bool
Shared(SharedLock *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Test/Store/MockFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/MockFileHandle.c b/core/Lucy/Test/Store/MockFileHandle.c
index b3f0693..d7afa71 100644
--- a/core/Lucy/Test/Store/MockFileHandle.c
+++ b/core/Lucy/Test/Store/MockFileHandle.c
@@ -23,13 +23,13 @@
#include "Lucy/Store/FileWindow.h"
MockFileHandle*
-MockFileHandle_new(const String *path, int64_t length) {
+MockFileHandle_new(String *path, int64_t length) {
MockFileHandle *self = (MockFileHandle*)VTable_Make_Obj(MOCKFILEHANDLE);
return MockFileHandle_init(self, path, length);
}
MockFileHandle*
-MockFileHandle_init(MockFileHandle *self, const String *path,
+MockFileHandle_init(MockFileHandle *self, String *path,
int64_t length) {
FH_do_open((FileHandle*)self, path, 0);
MockFileHandleIVARS *const ivars = MockFileHandle_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Test/Store/MockFileHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/MockFileHandle.cfh b/core/Lucy/Test/Store/MockFileHandle.cfh
index 8b3ed59..fe979f4 100644
--- a/core/Lucy/Test/Store/MockFileHandle.cfh
+++ b/core/Lucy/Test/Store/MockFileHandle.cfh
@@ -23,10 +23,10 @@ class Lucy::Store::MockFileHandle inherits Lucy::Store::FileHandle {
int64_t len;
inert incremented MockFileHandle*
- new(const String *path = NULL, int64_t length);
+ new(String *path = NULL, int64_t length);
inert MockFileHandle*
- init(MockFileHandle *self, const String *path = NULL, int64_t length);
+ init(MockFileHandle *self, String *path = NULL, int64_t length);
bool
Window(MockFileHandle *self, FileWindow *window, int64_t offset, int64_t len);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Util/IndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/IndexFileNames.c b/core/Lucy/Util/IndexFileNames.c
index 5d616f2..377d727 100644
--- a/core/Lucy/Util/IndexFileNames.c
+++ b/core/Lucy/Util/IndexFileNames.c
@@ -50,7 +50,7 @@ IxFileNames_latest_snapshot(Folder *folder) {
}
uint64_t
-IxFileNames_extract_gen(const String *name) {
+IxFileNames_extract_gen(String *name) {
StringIterator *iter = Str_Top(name);
// Advance past first underscore. Bail if we run out of string or if we
@@ -70,7 +70,7 @@ IxFileNames_extract_gen(const String *name) {
}
String*
-IxFileNames_local_part(const String *path) {
+IxFileNames_local_part(String *path) {
StringIterator *top = Str_Tail(path);
int32_t code_point = StrIter_Prev(top);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Util/IndexFileNames.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/IndexFileNames.cfh b/core/Lucy/Util/IndexFileNames.cfh
index b82f857..3e7ee7f 100644
--- a/core/Lucy/Util/IndexFileNames.cfh
+++ b/core/Lucy/Util/IndexFileNames.cfh
@@ -27,7 +27,7 @@ inert class Lucy::Util::IndexFileNames cnick IxFileNames {
* @return a generation number, or 0 if no number can be extracted.
*/
inert uint64_t
- extract_gen(const String *name);
+ extract_gen(String *name);
/** Return the name of the latest generation snapshot file in the Folder,
* or NULL if no such file exists.
@@ -39,7 +39,7 @@ inert class Lucy::Util::IndexFileNames cnick IxFileNames {
* Trailing slashes will be stripped.
*/
inert incremented String*
- local_part(const String *path);
+ local_part(String *path);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index c96a69d..34ec936 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -101,7 +101,7 @@ Json_from_json(String *json) {
}
Obj*
-Json_slurp_json(Folder *folder, const String *path) {
+Json_slurp_json(Folder *folder, String *path) {
InStream *instream = Folder_Open_In(folder, path);
if (!instream) {
ERR_ADD_FRAME(Err_get_error());
@@ -119,7 +119,7 @@ Json_slurp_json(Folder *folder, const String *path) {
}
bool
-Json_spew_json(Obj *dump, Folder *folder, const String *path) {
+Json_spew_json(Obj *dump, Folder *folder, String *path) {
String *json = Json_to_json(dump);
if (!json) {
ERR_ADD_FRAME(Err_get_error());
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/Lucy/Util/Json.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.cfh b/core/Lucy/Util/Json.cfh
index ceedfd3..c103074 100644
--- a/core/Lucy/Util/Json.cfh
+++ b/core/Lucy/Util/Json.cfh
@@ -40,7 +40,7 @@ class Lucy::Util::Json inherits Clownfish::Obj {
* @return true if the write succeeds, false on failure (sets Err_error).
*/
inert bool
- spew_json(Obj *dump, Folder *folder, const String *path);
+ spew_json(Obj *dump, Folder *folder, String *path);
/** Decode the JSON in the file at <code>path</code> and return a data
* structure made of Hashes, VArrays, and Strings. Returns NULL and sets
@@ -48,7 +48,7 @@ class Lucy::Util::Json inherits Clownfish::Obj {
* contain valid JSON.
*/
inert incremented nullable Obj*
- slurp_json(Folder *folder, const String *path);
+ slurp_json(Folder *folder, String *path);
/** Allow the encoder to output strings, etc, instead of throwing an error
* on anything other than a hash or an array. Testing only.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/LucyX/Search/ProximityQuery.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.c b/core/LucyX/Search/ProximityQuery.c
index ee76917..c4b779f 100644
--- a/core/LucyX/Search/ProximityQuery.c
+++ b/core/LucyX/Search/ProximityQuery.c
@@ -47,13 +47,13 @@ S_do_init(ProximityQuery *self, String *field, VArray *terms, float boost,
uint32_t within);
ProximityQuery*
-ProximityQuery_new(const String *field, VArray *terms, uint32_t within) {
+ProximityQuery_new(String *field, VArray *terms, uint32_t within) {
ProximityQuery *self = (ProximityQuery*)VTable_Make_Obj(PROXIMITYQUERY);
return ProximityQuery_init(self, field, terms, within);
}
ProximityQuery*
-ProximityQuery_init(ProximityQuery *self, const String *field, VArray *terms,
+ProximityQuery_init(ProximityQuery *self, String *field, VArray *terms,
uint32_t within) {
return S_do_init(self, Str_Clone(field), VA_Clone(terms), 1.0f, within);
}
@@ -371,7 +371,7 @@ ProximityCompiler_Make_Matcher_IMP(ProximityCompiler *self, SegReader *reader,
VArray*
ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler *self,
Searcher *searcher, DocVector *doc_vec,
- const String *field) {
+ String *field) {
ProximityCompilerIVARS *const ivars = ProximityCompiler_IVARS(self);
ProximityQueryIVARS *const parent_ivars
= ProximityQuery_IVARS((ProximityQuery*)ivars->parent);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/core/LucyX/Search/ProximityQuery.cfh
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.cfh b/core/LucyX/Search/ProximityQuery.cfh
index 102b38f..904cd6a 100644
--- a/core/LucyX/Search/ProximityQuery.cfh
+++ b/core/LucyX/Search/ProximityQuery.cfh
@@ -29,14 +29,14 @@ public class LucyX::Search::ProximityQuery inherits Lucy::Search::Query {
uint32_t within;
inert incremented ProximityQuery*
- new(const String *field, VArray *terms, uint32_t within);
+ new(String *field, VArray *terms, uint32_t within);
/**
* @param field The field that the phrase must occur in.
* @param terms The ordered array of terms that must match.
*/
public inert ProximityQuery*
- init(ProximityQuery *self, const String *field, VArray *terms, uint32_t within);
+ init(ProximityQuery *self, String *field, VArray *terms, uint32_t within);
/** Accessor for object's field attribute.
*/
@@ -109,7 +109,7 @@ class LucyX::Search::ProximityCompiler
public incremented VArray*
Highlight_Spans(ProximityCompiler *self, Searcher *searcher,
- DocVector *doc_vec, const String *field);
+ DocVector *doc_vec, String *field);
public bool
Equals(ProximityCompiler *self, Obj *other);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/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 5b1532e..1561b48 100644
--- a/perl/buildlib/Lucy/Build/Binding/Util.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Util.pm
@@ -203,7 +203,7 @@ MODULE = Lucy PACKAGE = Lucy::Util::IndexFileNames
uint64_t
extract_gen(name)
- const cfish_String *name;
+ cfish_String *name;
CODE:
RETVAL = lucy_IxFileNames_extract_gen(name);
OUTPUT: RETVAL
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/perl/xs/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c
index 59baf40..40ff0b7 100644
--- a/perl/xs/Lucy/Analysis/RegexTokenizer.c
+++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c
@@ -25,7 +25,7 @@
#include "Clownfish/Util/StringHelper.h"
static SV*
-S_compile_token_re(const cfish_String *pattern);
+S_compile_token_re(cfish_String *pattern);
static void
S_set_token_re_but_not_pattern(lucy_RegexTokenizer *self, void *token_re);
@@ -40,7 +40,7 @@ lucy_RegexTokenizer_is_available(void) {
lucy_RegexTokenizer*
lucy_RegexTokenizer_init(lucy_RegexTokenizer *self,
- const cfish_String *pattern) {
+ cfish_String *pattern) {
lucy_Analyzer_init((lucy_Analyzer*)self);
lucy_RegexTokenizerIVARS *const ivars = lucy_RegexTokenizer_IVARS(self);
#define DEFAULT_PATTERN "\\w+(?:['\\x{2019}]\\w+)*"
@@ -67,7 +67,7 @@ lucy_RegexTokenizer_init(lucy_RegexTokenizer *self,
}
static SV*
-S_compile_token_re(const cfish_String *pattern) {
+S_compile_token_re(cfish_String *pattern) {
dSP;
ENTER;
SAVETMPS;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f079ab91/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index f74ed22..a46da38 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -52,7 +52,7 @@ LUCY_Doc_Get_Size_IMP(lucy_Doc *self) {
}
void
-LUCY_Doc_Store_IMP(lucy_Doc *self, const cfish_String *field, cfish_Obj *value) {
+LUCY_Doc_Store_IMP(lucy_Doc *self, cfish_String *field, cfish_Obj *value) {
lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self);
const char *key = CFISH_Str_Get_Ptr8(field);
size_t key_size = CFISH_Str_Get_Size(field);
[lucy-commits] [17/50] [abbrv] git commit: refs/heads/master - Rename _UTF8 and _Str
to _Utf8
Posted by nw...@apache.org.
Rename _UTF8 and _Str to _Utf8
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/c3ccd8cd
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/c3ccd8cd
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/c3ccd8cd
Branch: refs/heads/master
Commit: c3ccd8cd246e99ed582dec839ca938fcdae68fa4
Parents: e47845a
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 14 16:22:34 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:16 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Analysis/RegexTokenizer.c | 8 ++--
c/src/Lucy/Index/DocReader.c | 2 +-
clownfish/runtime/core/Clownfish/CharBuf.c | 28 ++++++------
clownfish/runtime/core/Clownfish/CharBuf.cfh | 6 +--
clownfish/runtime/core/Clownfish/Err.c | 2 +-
clownfish/runtime/core/Clownfish/Hash.c | 6 +--
clownfish/runtime/core/Clownfish/Hash.cfh | 8 ++--
clownfish/runtime/core/Clownfish/String.c | 34 +++++++--------
clownfish/runtime/core/Clownfish/String.cfh | 16 +++----
.../runtime/core/Clownfish/Test/TestCharBuf.c | 12 ++---
.../runtime/core/Clownfish/Test/TestHash.c | 6 +--
clownfish/runtime/core/Clownfish/Test/TestNum.c | 12 ++---
clownfish/runtime/core/Clownfish/Test/TestObj.c | 4 +-
.../runtime/core/Clownfish/Test/TestString.c | 20 ++++-----
.../runtime/core/Clownfish/Test/TestVArray.c | 10 ++---
clownfish/runtime/core/Clownfish/VTable.c | 2 +-
clownfish/runtime/perl/xs/XSBind.c | 8 ++--
core/Lucy/Analysis/Analyzer.c | 6 +--
core/Lucy/Analysis/EasyAnalyzer.c | 4 +-
core/Lucy/Analysis/Normalizer.c | 20 ++++-----
core/Lucy/Analysis/PolyAnalyzer.c | 6 +--
core/Lucy/Analysis/RegexTokenizer.c | 12 ++---
core/Lucy/Analysis/RegexTokenizer.cfh | 4 +-
core/Lucy/Analysis/SnowballStemmer.c | 4 +-
core/Lucy/Analysis/SnowballStopFilter.c | 8 ++--
core/Lucy/Analysis/StandardTokenizer.c | 12 ++---
core/Lucy/Analysis/StandardTokenizer.cfh | 4 +-
core/Lucy/Document/HitDoc.c | 4 +-
core/Lucy/Highlight/Highlighter.c | 8 ++--
core/Lucy/Index/BackgroundMerger.c | 4 +-
core/Lucy/Index/DataWriter.c | 4 +-
core/Lucy/Index/DeletionsReader.c | 8 ++--
core/Lucy/Index/DeletionsWriter.c | 20 ++++-----
core/Lucy/Index/DocReader.c | 4 +-
core/Lucy/Index/DocVector.c | 2 +-
core/Lucy/Index/DocWriter.c | 4 +-
core/Lucy/Index/FilePurger.c | 8 ++--
core/Lucy/Index/HighlightReader.c | 6 +--
core/Lucy/Index/HighlightWriter.c | 4 +-
core/Lucy/Index/IndexManager.c | 10 ++---
core/Lucy/Index/Indexer.c | 10 ++---
core/Lucy/Index/LexiconWriter.c | 14 +++---
core/Lucy/Index/PolyReader.c | 4 +-
core/Lucy/Index/PostingListReader.c | 6 +--
core/Lucy/Index/PostingListWriter.c | 4 +-
core/Lucy/Index/SegLexicon.c | 6 +--
core/Lucy/Index/Segment.c | 32 +++++++-------
core/Lucy/Index/Segment.cfh | 6 +--
core/Lucy/Index/Similarity.c | 6 +--
core/Lucy/Index/Snapshot.c | 18 ++++----
core/Lucy/Index/SortReader.c | 10 ++---
core/Lucy/Index/SortWriter.c | 10 ++---
core/Lucy/Plan/BlobType.c | 22 +++++-----
core/Lucy/Plan/FullTextType.c | 36 +++++++--------
core/Lucy/Plan/NumericType.c | 36 +++++++--------
core/Lucy/Plan/Schema.c | 40 ++++++++---------
core/Lucy/Plan/StringType.c | 26 +++++------
core/Lucy/Search/ANDQuery.c | 4 +-
core/Lucy/Search/Compiler.c | 2 +-
core/Lucy/Search/LeafQuery.c | 8 ++--
core/Lucy/Search/NoMatchQuery.c | 6 +--
core/Lucy/Search/ORQuery.c | 4 +-
core/Lucy/Search/PhraseQuery.c | 14 +++---
core/Lucy/Search/PolyQuery.c | 4 +-
core/Lucy/Search/Query.c | 12 ++---
core/Lucy/Search/QueryParser.c | 10 ++---
core/Lucy/Search/QueryParser/QueryLexer.c | 2 +-
core/Lucy/Search/RangeQuery.c | 28 ++++++------
core/Lucy/Search/TermQuery.c | 8 ++--
core/Lucy/Store/CompoundFileReader.c | 8 ++--
core/Lucy/Store/CompoundFileWriter.c | 16 +++----
core/Lucy/Store/FSFolder.c | 6 +--
core/Lucy/Store/Folder.c | 4 +-
core/Lucy/Store/Lock.c | 16 +++----
core/Lucy/Store/SharedLock.c | 8 ++--
core/Lucy/Test/Analysis/TestNormalizer.c | 10 ++---
core/Lucy/Test/Analysis/TestSnowballStemmer.c | 4 +-
.../Lucy/Test/Analysis/TestSnowballStopFilter.c | 4 +-
core/Lucy/Test/Analysis/TestStandardTokenizer.c | 14 +++---
core/Lucy/Test/Highlight/TestHighlighter.c | 36 +++++++--------
core/Lucy/Test/Index/TestSegment.c | 16 +++----
core/Lucy/Test/Plan/TestFullTextType.c | 2 +-
core/Lucy/Test/Search/TestQueryParserSyntax.c | 2 +-
core/Lucy/Test/Search/TestSortSpec.c | 4 +-
core/Lucy/Test/Store/TestCompoundFileReader.c | 12 ++---
core/Lucy/Test/Store/TestCompoundFileWriter.c | 4 +-
core/Lucy/Test/Store/TestFSFolder.c | 2 +-
core/Lucy/Test/Store/TestFileHandle.c | 2 +-
core/Lucy/Test/Store/TestRAMFileHandle.c | 2 +-
core/Lucy/Test/Store/TestRAMFolder.c | 2 +-
core/Lucy/Test/Util/TestIndexFileNames.c | 2 +-
core/Lucy/Test/Util/TestJson.c | 10 ++---
core/Lucy/Util/Freezer.c | 2 +-
core/Lucy/Util/IndexFileNames.c | 4 +-
core/Lucy/Util/Json.c | 46 ++++++++++----------
core/LucyX/Search/ProximityQuery.c | 20 ++++-----
perl/xs/Lucy/Analysis/RegexTokenizer.c | 10 ++---
perl/xs/Lucy/Document/Doc.c | 18 ++++----
98 files changed, 512 insertions(+), 512 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/c/src/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Analysis/RegexTokenizer.c b/c/src/Lucy/Analysis/RegexTokenizer.c
index 4780430..bb3f96b 100644
--- a/c/src/Lucy/Analysis/RegexTokenizer.c
+++ b/c/src/Lucy/Analysis/RegexTokenizer.c
@@ -101,8 +101,8 @@ RegexTokenizer_Destroy_IMP(RegexTokenizer *self) {
}
void
-RegexTokenizer_Tokenize_Str_IMP(RegexTokenizer *self, const char *string,
- size_t string_len, Inversion *inversion) {
+RegexTokenizer_Tokenize_Utf8_IMP(RegexTokenizer *self, const char *string,
+ size_t string_len, Inversion *inversion) {
RegexTokenizerIVARS *const ivars = RegexTokenizer_IVARS(self);
pcre *re = (pcre*)ivars->token_re;
int byte_offset = 0;
@@ -189,8 +189,8 @@ RegexTokenizer_Destroy_IMP(RegexTokenizer *self) {
}
void
-RegexTokenizer_Tokenize_Str_IMP(RegexTokenizer *self, const char *string,
- size_t string_len, Inversion *inversion) {
+RegexTokenizer_Tokenize_Utf8_IMP(RegexTokenizer *self, const char *string,
+ size_t string_len, Inversion *inversion) {
UNUSED_VAR(self);
UNUSED_VAR(string);
UNUSED_VAR(string_len);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index dc3619b..7904c45 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -111,7 +111,7 @@ DefDocReader_Fetch_Doc_IMP(DefaultDocReader *self, int32_t doc_id) {
}
// Store the value.
- Hash_Store_Str(fields, field_name, field_name_len, value);
+ Hash_Store_Utf8(fields, field_name, field_name_len, value);
}
FREEMEM(field_name);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 74919dd..9f48caa 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -173,7 +173,7 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
while (slice_end < pattern_end && *slice_end != '%') { slice_end++; }
if (pattern != slice_end) {
size_t size = slice_end - pattern;
- CB_Cat_Trusted_UTF8(self, pattern, size);
+ CB_Cat_Trusted_Utf8(self, pattern, size);
pattern = slice_end;
}
@@ -182,13 +182,13 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
switch (*pattern) {
case '%': {
- CB_Cat_Trusted_UTF8(self, "%", 1);
+ CB_Cat_Trusted_Utf8(self, "%", 1);
}
break;
case 'o': {
Obj *obj = va_arg(args, Obj*);
if (!obj) {
- CB_Cat_Trusted_UTF8(self, "[NULL]", 6);
+ CB_Cat_Trusted_Utf8(self, "[NULL]", 6);
}
else if (Obj_Is_A(obj, STRING)) {
CB_Cat(self, (String*)obj);
@@ -219,7 +219,7 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
S_die_invalid_pattern(pattern_start);
}
size = sprintf(buf, "%" PRId64, val);
- CB_Cat_Trusted_UTF8(self, buf, size);
+ CB_Cat_Trusted_Utf8(self, buf, size);
}
break;
case 'u': {
@@ -241,7 +241,7 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
S_die_invalid_pattern(pattern_start);
}
size = sprintf(buf, "%" PRIu64, val);
- CB_Cat_Trusted_UTF8(self, buf, size);
+ CB_Cat_Trusted_Utf8(self, buf, size);
}
break;
case 'f': {
@@ -249,7 +249,7 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
double num = va_arg(args, double);
char bigbuf[512];
size_t size = sprintf(bigbuf, "%g", num);
- CB_Cat_Trusted_UTF8(self, bigbuf, size);
+ CB_Cat_Trusted_Utf8(self, bigbuf, size);
pattern += 2;
}
else {
@@ -261,7 +261,7 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
if (pattern[1] == '3' && pattern[2] == '2') {
unsigned long val = va_arg(args, uint32_t);
size_t size = sprintf(buf, "%.8lx", val);
- CB_Cat_Trusted_UTF8(self, buf, size);
+ CB_Cat_Trusted_Utf8(self, buf, size);
pattern += 2;
}
else {
@@ -272,15 +272,15 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
case 's': {
char *string = va_arg(args, char*);
if (string == NULL) {
- CB_Cat_Trusted_UTF8(self, "[NULL]", 6);
+ CB_Cat_Trusted_Utf8(self, "[NULL]", 6);
}
else {
size_t size = strlen(string);
if (StrHelp_utf8_valid(string, size)) {
- CB_Cat_Trusted_UTF8(self, string, size);
+ CB_Cat_Trusted_Utf8(self, string, size);
}
else {
- CB_Cat_Trusted_UTF8(self, "[INVALID UTF8]", 14);
+ CB_Cat_Trusted_Utf8(self, "[INVALID UTF8]", 14);
}
}
}
@@ -330,7 +330,7 @@ CB_Clone_IMP(CharBuf *self) {
}
void
-CB_Mimic_UTF8_IMP(CharBuf *self, const char* ptr, size_t size) {
+CB_Mimic_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
}
@@ -362,15 +362,15 @@ CB_Mimic_IMP(CharBuf *self, Obj *other) {
}
void
-CB_Cat_UTF8_IMP(CharBuf *self, const char* ptr, size_t size) {
+CB_Cat_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
}
- CB_Cat_Trusted_UTF8_IMP(self, ptr, size);
+ CB_Cat_Trusted_Utf8_IMP(self, ptr, size);
}
void
-CB_Cat_Trusted_UTF8_IMP(CharBuf *self, const char* ptr, size_t size) {
+CB_Cat_Trusted_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
const size_t new_size = self->size + size;
if (new_size >= self->cap) {
size_t amount = Memory_oversize(new_size, sizeof(char));
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.cfh b/clownfish/runtime/core/Clownfish/CharBuf.cfh
index a08ba4f..da48822 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.cfh
+++ b/clownfish/runtime/core/Clownfish/CharBuf.cfh
@@ -63,18 +63,18 @@ class Clownfish::CharBuf cnick CB
Mimic(CharBuf *self, Obj *other);
void
- Mimic_UTF8(CharBuf *self, const char *ptr, size_t size);
+ Mimic_Utf8(CharBuf *self, const char *ptr, size_t size);
/** Concatenate the passed-in string onto the end of the CharBuf.
*/
void
- Cat_UTF8(CharBuf *self, const char *ptr, size_t size);
+ Cat_Utf8(CharBuf *self, const char *ptr, size_t size);
/** Concatenate the supplied text onto the end of the CharBuf. Don't
* check for UTF-8 validity.
*/
void
- Cat_Trusted_UTF8(CharBuf *self, const char *ptr, size_t size);
+ Cat_Trusted_Utf8(CharBuf *self, const char *ptr, size_t size);
/** Concatenate the contents of <code>string</code> onto the end of the
* caller.
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Err.c b/clownfish/runtime/core/Clownfish/Err.c
index ade23a3..7ae899a 100644
--- a/clownfish/runtime/core/Clownfish/Err.c
+++ b/clownfish/runtime/core/Clownfish/Err.c
@@ -157,7 +157,7 @@ void
Err_Add_Frame_IMP(Err *self, const char *file, int line, const char *func) {
CharBuf *buf = CB_new_from_str(self->mess);
- if (!Str_Ends_With_Str(self->mess, "\n", 1)) {
+ if (!Str_Ends_With_Utf8(self->mess, "\n", 1)) {
CB_Cat_Char(buf, '\n');
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.c b/clownfish/runtime/core/Clownfish/Hash.c
index 7e3fb2e..02e9794 100644
--- a/clownfish/runtime/core/Clownfish/Hash.c
+++ b/clownfish/runtime/core/Clownfish/Hash.c
@@ -159,7 +159,7 @@ Hash_Store_IMP(Hash *self, Obj *key, Obj *value) {
}
void
-Hash_Store_Str_IMP(Hash *self, const char *key, size_t key_len, Obj *value) {
+Hash_Store_Utf8_IMP(Hash *self, const char *key, size_t key_len, Obj *value) {
StackString *key_buf = SSTR_WRAP_STR((char*)key, key_len);
Hash_do_store(self, (Obj*)key_buf, value,
SStr_Hash_Sum(key_buf), false);
@@ -173,7 +173,7 @@ Hash_Make_Key_IMP(Hash *self, Obj *key, int32_t hash_sum) {
}
Obj*
-Hash_Fetch_Str_IMP(Hash *self, const char *key, size_t key_len) {
+Hash_Fetch_Utf8_IMP(Hash *self, const char *key, size_t key_len) {
StackString *key_buf = SSTR_WRAP_STR(key, key_len);
return Hash_Fetch_IMP(self, (Obj*)key_buf);
}
@@ -225,7 +225,7 @@ Hash_Delete_IMP(Hash *self, const Obj *key) {
}
Obj*
-Hash_Delete_Str_IMP(Hash *self, const char *key, size_t key_len) {
+Hash_Delete_Utf8_IMP(Hash *self, const char *key, size_t key_len) {
StackString *key_buf = SSTR_WRAP_STR(key, key_len);
return Hash_Delete_IMP(self, (Obj*)key_buf);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/Hash.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.cfh b/clownfish/runtime/core/Clownfish/Hash.cfh
index 397cc2d..5f289fd 100644
--- a/clownfish/runtime/core/Clownfish/Hash.cfh
+++ b/clownfish/runtime/core/Clownfish/Hash.cfh
@@ -57,8 +57,8 @@ class Clownfish::Hash inherits Clownfish::Obj {
Store(Hash *self, Obj *key, decremented Obj *value);
void
- Store_Str(Hash *self, const char *str, size_t len,
- decremented Obj *value);
+ Store_Utf8(Hash *self, const char *str, size_t len,
+ decremented Obj *value);
/** Fetch the value associated with <code>key</code>.
*
@@ -68,7 +68,7 @@ class Clownfish::Hash inherits Clownfish::Obj {
Fetch(Hash *self, const Obj *key);
nullable Obj*
- Fetch_Str(Hash *self, const char *key, size_t key_len);
+ Fetch_Utf8(Hash *self, const char *key, size_t key_len);
/** Attempt to delete a key-value pair from the hash.
*
@@ -79,7 +79,7 @@ class Clownfish::Hash inherits Clownfish::Obj {
Delete(Hash *self, const Obj *key);
incremented nullable Obj*
- Delete_Str(Hash *self, const char *key, size_t key_ley);
+ Delete_Utf8(Hash *self, const char *key, size_t key_ley);
/** Prepare to iterate over all the key-value pairs in the hash.
*
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index d39f271..d68aacf 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -249,19 +249,19 @@ Str_Clone_IMP(String *self) {
String*
Str_Cat_IMP(String *self, const String *other) {
- return Str_Cat_Trusted_UTF8(self, other->ptr, other->size);
+ return Str_Cat_Trusted_Utf8(self, other->ptr, other->size);
}
String*
-Str_Cat_UTF8_IMP(String *self, const char* ptr, size_t size) {
+Str_Cat_Utf8_IMP(String *self, const char* ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
}
- return Str_Cat_Trusted_UTF8(self, ptr, size);
+ return Str_Cat_Trusted_Utf8(self, ptr, size);
}
String*
-Str_Cat_Trusted_UTF8_IMP(String *self, const char* ptr, size_t size) {
+Str_Cat_Trusted_Utf8_IMP(String *self, const char* ptr, size_t size) {
size_t result_size = self->size + size;
char *result_ptr = (char*)MALLOCATE(result_size + 1);
memcpy(result_ptr, self->ptr, self->size);
@@ -273,11 +273,11 @@ Str_Cat_Trusted_UTF8_IMP(String *self, const char* ptr, size_t size) {
bool
Str_Starts_With_IMP(String *self, const String *prefix) {
- return Str_Starts_With_Str_IMP(self, prefix->ptr, prefix->size);
+ return Str_Starts_With_Utf8_IMP(self, prefix->ptr, prefix->size);
}
bool
-Str_Starts_With_Str_IMP(String *self, const char *prefix, size_t size) {
+Str_Starts_With_Utf8_IMP(String *self, const char *prefix, size_t size) {
if (size <= self->size
&& (memcmp(self->ptr, prefix, size) == 0)
) {
@@ -293,7 +293,7 @@ Str_Equals_IMP(String *self, Obj *other) {
String *const twin = (String*)other;
if (twin == self) { return true; }
if (!Obj_Is_A(other, STRING)) { return false; }
- return Str_Equals_Str_IMP(self, twin->ptr, twin->size);
+ return Str_Equals_Utf8_IMP(self, twin->ptr, twin->size);
}
int32_t
@@ -303,7 +303,7 @@ Str_Compare_To_IMP(String *self, Obj *other) {
}
bool
-Str_Equals_Str_IMP(String *self, const char *ptr, size_t size) {
+Str_Equals_Utf8_IMP(String *self, const char *ptr, size_t size) {
if (self->size != size) {
return false;
}
@@ -312,11 +312,11 @@ Str_Equals_Str_IMP(String *self, const char *ptr, size_t size) {
bool
Str_Ends_With_IMP(String *self, const String *postfix) {
- return Str_Ends_With_Str_IMP(self, postfix->ptr, postfix->size);
+ return Str_Ends_With_Utf8_IMP(self, postfix->ptr, postfix->size);
}
bool
-Str_Ends_With_Str_IMP(String *self, const char *postfix, size_t postfix_len) {
+Str_Ends_With_Utf8_IMP(String *self, const char *postfix, size_t postfix_len) {
if (postfix_len <= self->size) {
char *start = self->ptr + self->size - postfix_len;
if (memcmp(start, postfix, postfix_len) == 0) {
@@ -329,11 +329,11 @@ Str_Ends_With_Str_IMP(String *self, const char *postfix, size_t postfix_len) {
int64_t
Str_Find_IMP(String *self, const String *substring) {
- return Str_Find_Str(self, substring->ptr, substring->size);
+ return Str_Find_Utf8(self, substring->ptr, substring->size);
}
int64_t
-Str_Find_Str_IMP(String *self, const char *ptr, size_t size) {
+Str_Find_Utf8_IMP(String *self, const char *ptr, size_t size) {
StackStringIterator *iter = STR_STACKTOP(self);
int64_t location = 0;
@@ -824,11 +824,11 @@ StrIter_Skip_Prev_Whitespace_IMP(StringIterator *self) {
bool
StrIter_Starts_With_IMP(StringIterator *self, String *prefix) {
- return StrIter_Starts_With_UTF8_IMP(self, prefix->ptr, prefix->size);
+ return StrIter_Starts_With_Utf8_IMP(self, prefix->ptr, prefix->size);
}
bool
-StrIter_Starts_With_UTF8_IMP(StringIterator *self, const char *prefix,
+StrIter_Starts_With_Utf8_IMP(StringIterator *self, const char *prefix,
size_t size) {
String *string = self->string;
size_t byte_offset = self->byte_offset;
@@ -844,12 +844,12 @@ StrIter_Starts_With_UTF8_IMP(StringIterator *self, const char *prefix,
bool
StrIter_Ends_With_IMP(StringIterator *self, String *postfix) {
- return StrIter_Ends_With_UTF8_IMP(self, postfix->ptr, postfix->size);
+ return StrIter_Ends_With_Utf8_IMP(self, postfix->ptr, postfix->size);
}
bool
-StrIter_Ends_With_UTF8_IMP(StringIterator *self, const char *postfix,
- size_t size) {
+StrIter_Ends_With_Utf8_IMP(StringIterator *self, const char *postfix,
+ size_t size) {
String *string = self->string;
size_t byte_offset = self->byte_offset;
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index ee78652..22138db 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -97,13 +97,13 @@ class Clownfish::String cnick Str
/** Return the concatenation of the String and the passed-in raw UTF-8.
*/
incremented String*
- Cat_UTF8(String *self, const char *ptr, size_t size);
+ Cat_Utf8(String *self, const char *ptr, size_t size);
/** Return the concatenation of the String and the passed-in raw UTF-8.
* Don't check for UTF-8 validity.
*/
incremented String*
- Cat_Trusted_UTF8(String *self, const char *ptr, size_t size);
+ Cat_Trusted_Utf8(String *self, const char *ptr, size_t size);
/** Replace all instances of one character for the other.
*
@@ -131,7 +131,7 @@ class Clownfish::String cnick Str
/** Test whether the String starts with the passed-in string.
*/
bool
- Starts_With_Str(String *self, const char *prefix, size_t size);
+ Starts_With_Utf8(String *self, const char *prefix, size_t size);
/** Test whether the String ends with the content of another.
*/
@@ -141,7 +141,7 @@ class Clownfish::String cnick Str
/** Test whether the String ends with the passed-in string.
*/
bool
- Ends_With_Str(String *self, const char *postfix, size_t size);
+ Ends_With_Utf8(String *self, const char *postfix, size_t size);
/** Return the location of the substring within the String (measured in
* code points), or -1 if the substring does not match.
@@ -150,12 +150,12 @@ class Clownfish::String cnick Str
Find(String *self, const String *substring);
int64_t
- Find_Str(String *self, const char *ptr, size_t size);
+ Find_Utf8(String *self, const char *ptr, size_t size);
/** Test whether the String matches the passed-in string.
*/
bool
- Equals_Str(String *self, const char *ptr, size_t size);
+ Equals_Utf8(String *self, const char *ptr, size_t size);
/** Return the number of Unicode code points in the object's string.
*/
@@ -394,7 +394,7 @@ class Clownfish::StringIterator cnick StrIter
* string.
*/
bool
- Starts_With_UTF8(StringIterator *self, const char *prefix, size_t size);
+ Starts_With_Utf8(StringIterator *self, const char *prefix, size_t size);
/** Test whether the content before the iterator ends with
* <code>postfix</code>.
@@ -406,7 +406,7 @@ class Clownfish::StringIterator cnick StrIter
* string.
*/
bool
- Ends_With_UTF8(StringIterator *self, const char *postfix, size_t size);
+ Ends_With_Utf8(StringIterator *self, const char *postfix, size_t size);
public void
Destroy(StringIterator *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c b/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
index 31865f9..48c36a1 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
@@ -74,13 +74,13 @@ test_Cat(TestBatchRunner *runner) {
DECREF(got);
got = S_get_cb("a");
- CB_Cat_UTF8(got, smiley, smiley_len);
- TEST_TRUE(runner, S_cb_equals(got, wanted), "Cat_UTF8");
+ CB_Cat_Utf8(got, smiley, smiley_len);
+ TEST_TRUE(runner, S_cb_equals(got, wanted), "Cat_Utf8");
DECREF(got);
got = S_get_cb("a");
- CB_Cat_Trusted_UTF8(got, smiley, smiley_len);
- TEST_TRUE(runner, S_cb_equals(got, wanted), "Cat_Trusted_UTF8");
+ CB_Cat_Trusted_Utf8(got, smiley, smiley_len);
+ TEST_TRUE(runner, S_cb_equals(got, wanted), "Cat_Trusted_Utf8");
DECREF(got);
DECREF(wanted);
@@ -102,8 +102,8 @@ test_Mimic_and_Clone(TestBatchRunner *runner) {
DECREF(got);
got = S_get_cb("bar");
- CB_Mimic_UTF8(got, "foo", 3);
- TEST_TRUE(runner, S_cb_equals(got, wanted), "Mimic_Str");
+ CB_Mimic_Utf8(got, "foo", 3);
+ TEST_TRUE(runner, S_cb_equals(got, wanted), "Mimic_Utf8");
DECREF(got);
got = CB_Clone(wanted_cb);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/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 ef29c7a..ca35f1a 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestHash.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestHash.c
@@ -45,15 +45,15 @@ test_Equals(TestBatchRunner *runner) {
TEST_TRUE(runner, Hash_Equals(hash, (Obj*)other),
"Empty hashes are equal");
- Hash_Store_Str(hash, "foo", 3, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(hash, "foo", 3, (Obj*)CFISH_TRUE);
TEST_FALSE(runner, Hash_Equals(hash, (Obj*)other),
"Add one pair and Equals returns false");
- Hash_Store_Str(other, "foo", 3, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(other, "foo", 3, (Obj*)CFISH_TRUE);
TEST_TRUE(runner, Hash_Equals(hash, (Obj*)other),
"Add a matching pair and Equals returns true");
- Hash_Store_Str(other, "foo", 3, INCREF(stuff));
+ Hash_Store_Utf8(other, "foo", 3, INCREF(stuff));
TEST_FALSE(runner, Hash_Equals(hash, (Obj*)other),
"Non-matching value spoils Equals");
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/Test/TestNum.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestNum.c b/clownfish/runtime/core/Clownfish/Test/TestNum.c
index 0334aac..f84c2c0 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestNum.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestNum.c
@@ -44,17 +44,17 @@ test_To_String(TestBatchRunner *runner) {
String *true_string = Bool_To_String(CFISH_TRUE);
String *false_string = Bool_To_String(CFISH_FALSE);
- TEST_TRUE(runner, Str_Starts_With_Str(f32_string, "1.3", 3),
+ TEST_TRUE(runner, Str_Starts_With_Utf8(f32_string, "1.3", 3),
"Float32_To_String");
- TEST_TRUE(runner, Str_Starts_With_Str(f64_string, "1.3", 3),
+ TEST_TRUE(runner, Str_Starts_With_Utf8(f64_string, "1.3", 3),
"Float64_To_String");
- TEST_TRUE(runner, Str_Equals_Str(i32_string, "2147483647", 10),
+ TEST_TRUE(runner, Str_Equals_Utf8(i32_string, "2147483647", 10),
"Int32_To_String");
- TEST_TRUE(runner, Str_Equals_Str(i64_string, "9223372036854775807", 19),
+ TEST_TRUE(runner, Str_Equals_Utf8(i64_string, "9223372036854775807", 19),
"Int64_To_String");
- TEST_TRUE(runner, Str_Equals_Str(true_string, "true", 4),
+ TEST_TRUE(runner, Str_Equals_Utf8(true_string, "true", 4),
"Bool_To_String [true]");
- TEST_TRUE(runner, Str_Equals_Str(false_string, "false", 5),
+ TEST_TRUE(runner, Str_Equals_Utf8(false_string, "false", 5),
"Bool_To_String [false]");
DECREF(false_string);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/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 c848b7d..191ec33 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestObj.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestObj.c
@@ -67,7 +67,7 @@ static void
test_To_String(TestBatchRunner *runner) {
Obj *testobj = S_new_testobj();
String *string = Obj_To_String(testobj);
- TEST_TRUE(runner, Str_Find_Str(string, "TestObj", 7) >= 0, "To_String");
+ TEST_TRUE(runner, Str_Find_Utf8(string, "TestObj", 7) >= 0, "To_String");
DECREF(string);
DECREF(testobj);
}
@@ -149,7 +149,7 @@ S_verify_abstract_error(TestBatchRunner *runner, Err_Attempt_t routine,
Err *error = Err_trap(routine, context);
TEST_TRUE(runner, error != NULL
&& Err_Is_A(error, ERR)
- && Str_Find_Str(Err_Get_Mess(error), "bstract", 7) != -1,
+ && Str_Find_Utf8(Err_Get_Mess(error), "bstract", 7) != -1,
message);
DECREF(error);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/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 daecdc6..2b7e911 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestString.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestString.c
@@ -84,14 +84,14 @@ test_Cat(TestBatchRunner *runner) {
DECREF(source);
source = S_get_str("a");
- got = Str_Cat_UTF8(source, smiley, smiley_len);
- TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "Cat_UTF8");
+ got = Str_Cat_Utf8(source, smiley, smiley_len);
+ TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "Cat_Utf8");
DECREF(got);
DECREF(source);
source = S_get_str("a");
- got = Str_Cat_Trusted_UTF8(source, smiley, smiley_len);
- TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "Cat_Trusted_UTF8");
+ got = Str_Cat_Trusted_Utf8(source, smiley, smiley_len);
+ TEST_TRUE(runner, Str_Equals(wanted, (Obj*)got), "Cat_Trusted_Utf8");
DECREF(got);
DECREF(source);
@@ -177,28 +177,28 @@ test_Trim(TestBatchRunner *runner) {
String *got;
got = Str_Trim(ws_smiley);
- TEST_TRUE(runner, Str_Equals_Str(got, smiley, smiley_len), "Trim");
+ TEST_TRUE(runner, Str_Equals_Utf8(got, smiley, smiley_len), "Trim");
DECREF(got);
got = Str_Trim_Top(ws_foo);
- TEST_TRUE(runner, Str_Equals_Str(got, "foo ", 5), "Trim_Top");
+ TEST_TRUE(runner, Str_Equals_Utf8(got, "foo ", 5), "Trim_Top");
DECREF(got);
got = Str_Trim_Tail(ws_foo);
- TEST_TRUE(runner, Str_Equals_Str(got, " foo", 5), "Trim_Tail");
+ TEST_TRUE(runner, Str_Equals_Utf8(got, " foo", 5), "Trim_Tail");
DECREF(got);
got = Str_Trim(ws_only);
- TEST_TRUE(runner, Str_Equals_Str(got, "", 0), "Trim with only whitespace");
+ TEST_TRUE(runner, Str_Equals_Utf8(got, "", 0), "Trim with only whitespace");
DECREF(got);
got = Str_Trim_Top(ws_only);
- TEST_TRUE(runner, Str_Equals_Str(got, "", 0),
+ TEST_TRUE(runner, Str_Equals_Utf8(got, "", 0),
"Trim_Top with only whitespace");
DECREF(got);
got = Str_Trim_Tail(ws_only);
- TEST_TRUE(runner, Str_Equals_Str(got, "", 0),
+ TEST_TRUE(runner, Str_Equals_Utf8(got, "", 0),
"Trim_Tail with only whitespace");
DECREF(got);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/Test/TestVArray.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestVArray.c b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
index 7f7b72b..d22cad0 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestVArray.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
@@ -86,7 +86,7 @@ test_Store_Fetch(TestBatchRunner *runner) {
VA_Store(array, 2, (Obj*)Str_newf("foo"));
elem = (String*)CERTIFY(VA_Fetch(array, 2), STRING);
TEST_INT_EQ(runner, 3, VA_Get_Size(array), "Store updates size");
- TEST_TRUE(runner, Str_Equals_Str(elem, "foo", 3), "Store");
+ TEST_TRUE(runner, Str_Equals_Utf8(elem, "foo", 3), "Store");
INCREF(elem);
TEST_INT_EQ(runner, 2, Str_Get_RefCount(elem),
@@ -96,7 +96,7 @@ test_Store_Fetch(TestBatchRunner *runner) {
"Displacing elem via Store updates refcount");
DECREF(elem);
elem = (String*)CERTIFY(VA_Fetch(array, 2), STRING);
- TEST_TRUE(runner, Str_Equals_Str(elem, "bar", 3), "Store displacement");
+ TEST_TRUE(runner, Str_Equals_Utf8(elem, "bar", 3), "Store displacement");
DECREF(array);
}
@@ -115,18 +115,18 @@ test_Push_Pop_Shift_Unshift(TestBatchRunner *runner) {
TEST_TRUE(runner, NULL != CERTIFY(VA_Fetch(array, 2), STRING), "Push");
elem = (String*)CERTIFY(VA_Shift(array), STRING);
- TEST_TRUE(runner, Str_Equals_Str(elem, "a", 1), "Shift");
+ TEST_TRUE(runner, Str_Equals_Utf8(elem, "a", 1), "Shift");
TEST_INT_EQ(runner, VA_Get_Size(array), 2, "size after Shift");
DECREF(elem);
elem = (String*)CERTIFY(VA_Pop(array), STRING);
- TEST_TRUE(runner, Str_Equals_Str(elem, "c", 1), "Pop");
+ TEST_TRUE(runner, Str_Equals_Utf8(elem, "c", 1), "Pop");
TEST_INT_EQ(runner, VA_Get_Size(array), 1, "size after Pop");
DECREF(elem);
VA_Unshift(array, (Obj*)Str_newf("foo"));
elem = (String*)CERTIFY(VA_Fetch(array, 0), STRING);
- TEST_TRUE(runner, Str_Equals_Str(elem, "foo", 3), "Unshift");
+ TEST_TRUE(runner, Str_Equals_Utf8(elem, "foo", 3), "Unshift");
TEST_INT_EQ(runner, VA_Get_Size(array), 2, "size after Shift");
DECREF(array);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VTable.c b/clownfish/runtime/core/Clownfish/VTable.c
index 67ec977..c2bfde8 100644
--- a/clownfish/runtime/core/Clownfish/VTable.c
+++ b/clownfish/runtime/core/Clownfish/VTable.c
@@ -417,7 +417,7 @@ S_find_method(VTable *self, const char *name) {
for (uint32_t i = 0; i < size; i++) {
Method *method = (Method*)VA_Fetch(self->methods, i);
- if (Str_Equals_Str(method->name, name, name_len)) {
+ if (Str_Equals_Utf8(method->name, name, name_len)) {
return method;
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 39d65d8..379bc7d 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -252,10 +252,10 @@ S_perl_hash_to_cfish_hash(HV *phash) {
// this.
SV *key_sv = HeKEY_sv(entry);
char *key_str = SvPVutf8(key_sv, key_len);
- CFISH_Hash_Store_Str(retval, key_str, key_len, value);
+ CFISH_Hash_Store_Utf8(retval, key_str, key_len, value);
}
else if (HeKUTF8(entry)) {
- CFISH_Hash_Store_Str(retval, HeKEY(entry), key_len, value);
+ CFISH_Hash_Store_Utf8(retval, HeKEY(entry), key_len, value);
}
else {
char *key_str = HeKEY(entry);
@@ -264,12 +264,12 @@ S_perl_hash_to_cfish_hash(HV *phash) {
if ((key_str[i] & 0x80) == 0x80) { pure_ascii = false; }
}
if (pure_ascii) {
- CFISH_Hash_Store_Str(retval, key_str, key_len, value);
+ CFISH_Hash_Store_Utf8(retval, key_str, key_len, value);
}
else {
SV *key_sv = HeSVKEY_force(entry);
key_str = SvPVutf8(key_sv, key_len);
- CFISH_Hash_Store_Str(retval, key_str, key_len, value);
+ CFISH_Hash_Store_Utf8(retval, key_str, key_len, value);
}
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/Analyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Analyzer.c b/core/Lucy/Analysis/Analyzer.c
index b620e9e..4683276 100644
--- a/core/Lucy/Analysis/Analyzer.c
+++ b/core/Lucy/Analysis/Analyzer.c
@@ -61,8 +61,8 @@ Analyzer_Split_IMP(Analyzer *self, String *text) {
Obj*
Analyzer_Dump_IMP(Analyzer *self) {
Hash *dump = Hash_new(0);
- Hash_Store_Str(dump, "_class", 6,
- (Obj*)Str_Clone(Obj_Get_Class_Name((Obj*)self)));
+ Hash_Store_Utf8(dump, "_class", 6,
+ (Obj*)Str_Clone(Obj_Get_Class_Name((Obj*)self)));
return (Obj*)dump;
}
@@ -71,7 +71,7 @@ Analyzer_Load_IMP(Analyzer *self, Obj *dump) {
CHY_UNUSED_VAR(self);
Hash *source = (Hash*)CERTIFY(dump, HASH);
String *class_name
- = (String*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), STRING);
+ = (String*)CERTIFY(Hash_Fetch_Utf8(source, "_class", 6), STRING);
VTable *vtable = VTable_singleton(class_name, NULL);
Analyzer *loaded = (Analyzer*)VTable_Make_Obj(vtable);
return (Obj*)loaded;
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/EasyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/EasyAnalyzer.c b/core/Lucy/Analysis/EasyAnalyzer.c
index f4d0947..136dca9 100644
--- a/core/Lucy/Analysis/EasyAnalyzer.c
+++ b/core/Lucy/Analysis/EasyAnalyzer.c
@@ -78,7 +78,7 @@ EasyAnalyzer_Dump_IMP(EasyAnalyzer *self) {
EasyAnalyzer_Dump_t super_dump
= SUPER_METHOD_PTR(EASYANALYZER, LUCY_EasyAnalyzer_Dump);
Hash *dump = super_dump(self);
- Hash_Store_Str(dump, "language", 8, (Obj*)Str_Clone(ivars->language));
+ Hash_Store_Utf8(dump, "language", 8, (Obj*)Str_Clone(ivars->language));
return dump;
}
@@ -89,7 +89,7 @@ EasyAnalyzer_Load_IMP(EasyAnalyzer *self, Obj *dump) {
EasyAnalyzer *loaded = super_load(self, dump);
Hash *source = (Hash*)CERTIFY(dump, HASH);
String *language
- = (String*)CERTIFY(Hash_Fetch_Str(source, "language", 8), STRING);
+ = (String*)CERTIFY(Hash_Fetch_Utf8(source, "language", 8), STRING);
return EasyAnalyzer_init(loaded, language);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/Normalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Normalizer.c b/core/Lucy/Analysis/Normalizer.c
index 924d966..c022f5f 100644
--- a/core/Lucy/Analysis/Normalizer.c
+++ b/core/Lucy/Analysis/Normalizer.c
@@ -40,17 +40,17 @@ Normalizer_init(Normalizer *self, const String *form, bool case_fold,
NormalizerIVARS *const ivars = Normalizer_IVARS(self);
if (form == NULL
- || Str_Equals_Str(form, "NFKC", 4) || Str_Equals_Str(form, "nfkc", 4)
+ || Str_Equals_Utf8(form, "NFKC", 4) || Str_Equals_Utf8(form, "nfkc", 4)
) {
options |= UTF8PROC_COMPOSE | UTF8PROC_COMPAT;
}
- else if (Str_Equals_Str(form, "NFC", 3) || Str_Equals_Str(form, "nfc", 3)) {
+ else if (Str_Equals_Utf8(form, "NFC", 3) || Str_Equals_Utf8(form, "nfc", 3)) {
options |= UTF8PROC_COMPOSE;
}
- else if (Str_Equals_Str(form, "NFKD", 4) || Str_Equals_Str(form, "nfkd", 4)) {
+ else if (Str_Equals_Utf8(form, "NFKD", 4) || Str_Equals_Utf8(form, "nfkd", 4)) {
options |= UTF8PROC_DECOMPOSE | UTF8PROC_COMPAT;
}
- else if (Str_Equals_Str(form, "NFD", 3) || Str_Equals_Str(form, "nfd", 3)) {
+ else if (Str_Equals_Utf8(form, "NFD", 3) || Str_Equals_Utf8(form, "nfd", 3)) {
options |= UTF8PROC_DECOMPOSE;
}
else {
@@ -133,13 +133,13 @@ Normalizer_Dump_IMP(Normalizer *self) {
Str_new_from_trusted_utf8("NFKD", 4) :
Str_new_from_trusted_utf8("NFD", 3);
- Hash_Store_Str(dump, "normalization_form", 18, (Obj*)form);
+ Hash_Store_Utf8(dump, "normalization_form", 18, (Obj*)form);
BoolNum *case_fold = Bool_singleton(options & UTF8PROC_CASEFOLD);
- Hash_Store_Str(dump, "case_fold", 9, (Obj*)case_fold);
+ Hash_Store_Utf8(dump, "case_fold", 9, (Obj*)case_fold);
BoolNum *strip_accents = Bool_singleton(options & UTF8PROC_STRIPMARK);
- Hash_Store_Str(dump, "strip_accents", 13, (Obj*)strip_accents);
+ Hash_Store_Utf8(dump, "strip_accents", 13, (Obj*)strip_accents);
return dump;
}
@@ -151,11 +151,11 @@ Normalizer_Load_IMP(Normalizer *self, Obj *dump) {
Normalizer *loaded = super_load(self, dump);
Hash *source = (Hash*)CERTIFY(dump, HASH);
- Obj *obj = Hash_Fetch_Str(source, "normalization_form", 18);
+ Obj *obj = Hash_Fetch_Utf8(source, "normalization_form", 18);
String *form = (String*)CERTIFY(obj, STRING);
- obj = Hash_Fetch_Str(source, "case_fold", 9);
+ obj = Hash_Fetch_Utf8(source, "case_fold", 9);
bool case_fold = Bool_Get_Value((BoolNum*)CERTIFY(obj, BOOLNUM));
- obj = Hash_Fetch_Str(source, "strip_accents", 13);
+ obj = Hash_Fetch_Utf8(source, "strip_accents", 13);
bool strip_accents = Bool_Get_Value((BoolNum*)CERTIFY(obj, BOOLNUM));
return Normalizer_init(loaded, form, case_fold, strip_accents);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/PolyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/PolyAnalyzer.c b/core/Lucy/Analysis/PolyAnalyzer.c
index 00f8a4a..59ba1d9 100644
--- a/core/Lucy/Analysis/PolyAnalyzer.c
+++ b/core/Lucy/Analysis/PolyAnalyzer.c
@@ -128,8 +128,8 @@ PolyAnalyzer_Dump_IMP(PolyAnalyzer *self) {
= SUPER_METHOD_PTR(POLYANALYZER, LUCY_PolyAnalyzer_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
if (ivars->analyzers) {
- Hash_Store_Str(dump, "analyzers", 9,
- Freezer_dump((Obj*)ivars->analyzers));
+ Hash_Store_Utf8(dump, "analyzers", 9,
+ Freezer_dump((Obj*)ivars->analyzers));
}
return (Obj*)dump;
}
@@ -141,7 +141,7 @@ PolyAnalyzer_Load_IMP(PolyAnalyzer *self, Obj *dump) {
= SUPER_METHOD_PTR(POLYANALYZER, LUCY_PolyAnalyzer_Load);
PolyAnalyzer *loaded = super_load(self, dump);
VArray *analyzer_dumps
- = (VArray*)CERTIFY(Hash_Fetch_Str(source, "analyzers", 9), VARRAY);
+ = (VArray*)CERTIFY(Hash_Fetch_Utf8(source, "analyzers", 9), VARRAY);
VArray *analyzers
= (VArray*)CERTIFY(Freezer_load((Obj*)analyzer_dumps), VARRAY);
PolyAnalyzer_init(loaded, NULL, analyzers);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/RegexTokenizer.c b/core/Lucy/Analysis/RegexTokenizer.c
index ee8be64..3b9e6fa 100644
--- a/core/Lucy/Analysis/RegexTokenizer.c
+++ b/core/Lucy/Analysis/RegexTokenizer.c
@@ -35,8 +35,8 @@ RegexTokenizer_Transform_IMP(RegexTokenizer *self, Inversion *inversion) {
while (NULL != (token = Inversion_Next(inversion))) {
TokenIVARS *const token_ivars = Token_IVARS(token);
- RegexTokenizer_Tokenize_Str(self, token_ivars->text, token_ivars->len,
- new_inversion);
+ RegexTokenizer_Tokenize_Utf8(self, token_ivars->text, token_ivars->len,
+ new_inversion);
}
return new_inversion;
@@ -45,8 +45,8 @@ RegexTokenizer_Transform_IMP(RegexTokenizer *self, Inversion *inversion) {
Inversion*
RegexTokenizer_Transform_Text_IMP(RegexTokenizer *self, String *text) {
Inversion *new_inversion = Inversion_new(NULL);
- RegexTokenizer_Tokenize_Str(self, (char*)Str_Get_Ptr8(text),
- Str_Get_Size(text), new_inversion);
+ RegexTokenizer_Tokenize_Utf8(self, (char*)Str_Get_Ptr8(text),
+ Str_Get_Size(text), new_inversion);
return new_inversion;
}
@@ -56,7 +56,7 @@ RegexTokenizer_Dump_IMP(RegexTokenizer *self) {
RegexTokenizer_Dump_t super_dump
= SUPER_METHOD_PTR(REGEXTOKENIZER, LUCY_RegexTokenizer_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
- Hash_Store_Str(dump, "pattern", 7, (Obj*)Str_Clone(ivars->pattern));
+ Hash_Store_Utf8(dump, "pattern", 7, (Obj*)Str_Clone(ivars->pattern));
return (Obj*)dump;
}
@@ -67,7 +67,7 @@ RegexTokenizer_Load_IMP(RegexTokenizer *self, Obj *dump) {
= SUPER_METHOD_PTR(REGEXTOKENIZER, LUCY_RegexTokenizer_Load);
RegexTokenizer *loaded = super_load(self, dump);
String *pattern
- = (String*)CERTIFY(Hash_Fetch_Str(source, "pattern", 7), STRING);
+ = (String*)CERTIFY(Hash_Fetch_Utf8(source, "pattern", 7), STRING);
return RegexTokenizer_init(loaded, pattern);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/RegexTokenizer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/RegexTokenizer.cfh b/core/Lucy/Analysis/RegexTokenizer.cfh
index fb0fb56..a4bde3c 100644
--- a/core/Lucy/Analysis/RegexTokenizer.cfh
+++ b/core/Lucy/Analysis/RegexTokenizer.cfh
@@ -81,8 +81,8 @@ public class Lucy::Analysis::RegexTokenizer
* supplied Inversion.
*/
void
- Tokenize_Str(RegexTokenizer *self, const char *text, size_t len,
- Inversion *inversion);
+ Tokenize_Utf8(RegexTokenizer *self, const char *text, size_t len,
+ Inversion *inversion);
/** Set the compiled regular expression for matching a token. Also sets
* <code>pattern</code> as a side effect.
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/SnowballStemmer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStemmer.c b/core/Lucy/Analysis/SnowballStemmer.c
index 3df82a4..955d2fc 100644
--- a/core/Lucy/Analysis/SnowballStemmer.c
+++ b/core/Lucy/Analysis/SnowballStemmer.c
@@ -90,7 +90,7 @@ SnowStemmer_Dump_IMP(SnowballStemmer *self) {
SnowStemmer_Dump_t super_dump
= SUPER_METHOD_PTR(SNOWBALLSTEMMER, LUCY_SnowStemmer_Dump);
Hash *dump = super_dump(self);
- Hash_Store_Str(dump, "language", 8, (Obj*)Str_Clone(ivars->language));
+ Hash_Store_Utf8(dump, "language", 8, (Obj*)Str_Clone(ivars->language));
return dump;
}
@@ -101,7 +101,7 @@ SnowStemmer_Load_IMP(SnowballStemmer *self, Obj *dump) {
SnowballStemmer *loaded = super_load(self, dump);
Hash *source = (Hash*)CERTIFY(dump, HASH);
String *language
- = (String*)CERTIFY(Hash_Fetch_Str(source, "language", 8), STRING);
+ = (String*)CERTIFY(Hash_Fetch_Utf8(source, "language", 8), STRING);
return SnowStemmer_init(loaded, language);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/SnowballStopFilter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.c b/core/Lucy/Analysis/SnowballStopFilter.c
index 323c108..4aa9d16 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.c
+++ b/core/Lucy/Analysis/SnowballStopFilter.c
@@ -69,7 +69,7 @@ SnowStop_Transform_IMP(SnowballStopFilter *self, Inversion *inversion) {
while (NULL != (token = Inversion_Next(inversion))) {
TokenIVARS *const token_ivars = Token_IVARS(token);
- if (!Hash_Fetch_Str(stoplist, token_ivars->text, token_ivars->len)) {
+ if (!Hash_Fetch_Utf8(stoplist, token_ivars->text, token_ivars->len)) {
Inversion_Append(new_inversion, (Token*)INCREF(token));
}
}
@@ -97,8 +97,8 @@ SnowStop_Dump_IMP(SnowballStopFilter *self) {
= SUPER_METHOD_PTR(SNOWBALLSTOPFILTER, LUCY_SnowStop_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
if (ivars->stoplist) {
- Hash_Store_Str(dump, "stoplist", 8,
- Freezer_dump((Obj*)ivars->stoplist));
+ Hash_Store_Utf8(dump, "stoplist", 8,
+ Freezer_dump((Obj*)ivars->stoplist));
}
return (Obj*)dump;
}
@@ -109,7 +109,7 @@ SnowStop_Load_IMP(SnowballStopFilter *self, Obj *dump) {
SnowStop_Load_t super_load
= SUPER_METHOD_PTR(SNOWBALLSTOPFILTER, LUCY_SnowStop_Load);
SnowballStopFilter *loaded = (SnowballStopFilter*)super_load(self, dump);
- Obj *stoplist = Hash_Fetch_Str(source, "stoplist", 8);
+ Obj *stoplist = Hash_Fetch_Utf8(source, "stoplist", 8);
if (stoplist) {
SnowStop_IVARS(loaded)->stoplist
= (Hash*)CERTIFY(Freezer_load(stoplist), HASH);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/StandardTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/StandardTokenizer.c b/core/Lucy/Analysis/StandardTokenizer.c
index eaa68f5..8db94ec 100644
--- a/core/Lucy/Analysis/StandardTokenizer.c
+++ b/core/Lucy/Analysis/StandardTokenizer.c
@@ -87,8 +87,8 @@ StandardTokenizer_Transform_IMP(StandardTokenizer *self, Inversion *inversion) {
while (NULL != (token = Inversion_Next(inversion))) {
TokenIVARS *const token_ivars = Token_IVARS(token);
- StandardTokenizer_Tokenize_Str(self, token_ivars->text,
- token_ivars->len, new_inversion);
+ StandardTokenizer_Tokenize_Utf8(self, token_ivars->text,
+ token_ivars->len, new_inversion);
}
return new_inversion;
@@ -97,14 +97,14 @@ StandardTokenizer_Transform_IMP(StandardTokenizer *self, Inversion *inversion) {
Inversion*
StandardTokenizer_Transform_Text_IMP(StandardTokenizer *self, String *text) {
Inversion *new_inversion = Inversion_new(NULL);
- StandardTokenizer_Tokenize_Str(self, (char*)Str_Get_Ptr8(text),
- Str_Get_Size(text), new_inversion);
+ StandardTokenizer_Tokenize_Utf8(self, (char*)Str_Get_Ptr8(text),
+ Str_Get_Size(text), new_inversion);
return new_inversion;
}
void
-StandardTokenizer_Tokenize_Str_IMP(StandardTokenizer *self, const char *text,
- size_t len, Inversion *inversion) {
+StandardTokenizer_Tokenize_Utf8_IMP(StandardTokenizer *self, const char *text,
+ size_t len, Inversion *inversion) {
UNUSED_VAR(self);
if ((len >= 1 && (uint8_t)text[len - 1] >= 0xC0)
|| (len >= 2 && (uint8_t)text[len - 2] >= 0xE0)
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Analysis/StandardTokenizer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/StandardTokenizer.cfh b/core/Lucy/Analysis/StandardTokenizer.cfh
index 6e4041a..2bac5c7 100644
--- a/core/Lucy/Analysis/StandardTokenizer.cfh
+++ b/core/Lucy/Analysis/StandardTokenizer.cfh
@@ -47,8 +47,8 @@ public class Lucy::Analysis::StandardTokenizer
* supplied Inversion.
*/
void
- Tokenize_Str(StandardTokenizer *self, const char *text, size_t len,
- Inversion *inversion);
+ Tokenize_Utf8(StandardTokenizer *self, const char *text, size_t len,
+ Inversion *inversion);
public bool
Equals(StandardTokenizer *self, Obj *other);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Document/HitDoc.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Document/HitDoc.c b/core/Lucy/Document/HitDoc.c
index 83cfdf9..2abcbbc 100644
--- a/core/Lucy/Document/HitDoc.c
+++ b/core/Lucy/Document/HitDoc.c
@@ -70,7 +70,7 @@ HitDoc_Dump_IMP(HitDoc *self) {
HitDoc_Dump_t super_dump
= SUPER_METHOD_PTR(HITDOC, LUCY_HitDoc_Dump);
Hash *dump = super_dump(self);
- Hash_Store_Str(dump, "score", 5, (Obj*)Str_newf("%f64", ivars->score));
+ Hash_Store_Utf8(dump, "score", 5, (Obj*)Str_newf("%f64", ivars->score));
return dump;
}
@@ -81,7 +81,7 @@ HitDoc_Load_IMP(HitDoc *self, Obj *dump) {
= SUPER_METHOD_PTR(HITDOC, LUCY_HitDoc_Load);
HitDoc *loaded = super_load(self, dump);
HitDocIVARS *const loaded_ivars = HitDoc_IVARS(loaded);
- Obj *score = CERTIFY(Hash_Fetch_Str(source, "score", 5), OBJ);
+ Obj *score = CERTIFY(Hash_Fetch_Utf8(source, "score", 5), OBJ);
loaded_ivars->score = (float)Obj_To_F64(score);
return loaded;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index 35585a1..2d55639 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -614,16 +614,16 @@ S_encode_entities(String *text, CharBuf *buf) {
CB_catf(buf, "&#%u32;", code_point);
}
else if (code_point == '<') {
- CB_Cat_Trusted_UTF8(buf, "<", 4);
+ CB_Cat_Trusted_Utf8(buf, "<", 4);
}
else if (code_point == '>') {
- CB_Cat_Trusted_UTF8(buf, ">", 4);
+ CB_Cat_Trusted_Utf8(buf, ">", 4);
}
else if (code_point == '&') {
- CB_Cat_Trusted_UTF8(buf, "&", 5);
+ CB_Cat_Trusted_Utf8(buf, "&", 5);
}
else if (code_point == '"') {
- CB_Cat_Trusted_UTF8(buf, """, 6);
+ CB_Cat_Trusted_Utf8(buf, """, 6);
}
else {
CB_Cat_Char(buf, code_point);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/BackgroundMerger.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/BackgroundMerger.c b/core/Lucy/Index/BackgroundMerger.c
index 45bd39d..547a5f9 100644
--- a/core/Lucy/Index/BackgroundMerger.c
+++ b/core/Lucy/Index/BackgroundMerger.c
@@ -413,7 +413,7 @@ BGMerger_Prepare_Commit_IMP(BackgroundMerger *self) {
// Write temporary snapshot file.
DECREF(ivars->snapfile);
String *snapfile = IxManager_Make_Snapshot_Filename(ivars->manager);
- ivars->snapfile = Str_Cat_Trusted_UTF8(snapfile, ".temp", 5);
+ ivars->snapfile = Str_Cat_Trusted_Utf8(snapfile, ".temp", 5);
DECREF(snapfile);
Folder_Delete(folder, ivars->snapfile);
Snapshot_Write_File(snapshot, folder, ivars->snapfile);
@@ -444,7 +444,7 @@ BGMerger_Prepare_Commit_IMP(BackgroundMerger *self) {
VArray *files = Snapshot_List(latest_snapshot);
for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) {
String *file = (String*)VA_Fetch(files, i);
- if (Str_Starts_With_Str(file, "seg_", 4)) {
+ if (Str_Starts_With_Utf8(file, "seg_", 4)) {
int64_t gen = (int64_t)IxFileNames_extract_gen(file);
if (gen > ivars->cutoff) {
Snapshot_Add_Entry(ivars->snapshot, file);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/DataWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DataWriter.c b/core/Lucy/Index/DataWriter.c
index 747dc89..5cc299a 100644
--- a/core/Lucy/Index/DataWriter.c
+++ b/core/Lucy/Index/DataWriter.c
@@ -91,8 +91,8 @@ DataWriter_Merge_Segment_IMP(DataWriter *self, SegReader *reader,
Hash*
DataWriter_Metadata_IMP(DataWriter *self) {
Hash *metadata = Hash_new(0);
- Hash_Store_Str(metadata, "format", 6,
- (Obj*)Str_newf("%i32", DataWriter_Format(self)));
+ Hash_Store_Utf8(metadata, "format", 6,
+ (Obj*)Str_newf("%i32", DataWriter_Format(self)));
return metadata;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/DeletionsReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DeletionsReader.c b/core/Lucy/Index/DeletionsReader.c
index 3e21ada..bb5e49d 100644
--- a/core/Lucy/Index/DeletionsReader.c
+++ b/core/Lucy/Index/DeletionsReader.c
@@ -168,19 +168,19 @@ DefDelReader_Read_Deletions_IMP(DefaultDeletionsReader *self) {
for (int32_t i = VA_Get_Size(segments) - 1; i >= 0; i--) {
Segment *other_seg = (Segment*)VA_Fetch(segments, i);
Hash *metadata
- = (Hash*)Seg_Fetch_Metadata_Str(other_seg, "deletions", 9);
+ = (Hash*)Seg_Fetch_Metadata_Utf8(other_seg, "deletions", 9);
if (metadata) {
Hash *files = (Hash*)CERTIFY(
- Hash_Fetch_Str(metadata, "files", 5), HASH);
+ Hash_Fetch_Utf8(metadata, "files", 5), HASH);
Hash *seg_files_data
= (Hash*)Hash_Fetch(files, (Obj*)my_seg_name);
if (seg_files_data) {
Obj *count = (Obj*)CERTIFY(
- Hash_Fetch_Str(seg_files_data, "count", 5),
+ Hash_Fetch_Utf8(seg_files_data, "count", 5),
OBJ);
del_count = (int32_t)Obj_To_I64(count);
del_file = (String*)CERTIFY(
- Hash_Fetch_Str(seg_files_data, "filename", 8),
+ Hash_Fetch_Utf8(seg_files_data, "filename", 8),
STRING);
break;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/DeletionsWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DeletionsWriter.c b/core/Lucy/Index/DeletionsWriter.c
index 2bb0f02..829a04c 100644
--- a/core/Lucy/Index/DeletionsWriter.c
+++ b/core/Lucy/Index/DeletionsWriter.c
@@ -168,8 +168,8 @@ DefDelWriter_Finish_IMP(DefaultDeletionsWriter *self) {
}
}
- Seg_Store_Metadata_Str(ivars->segment, "deletions", 9,
- (Obj*)DefDelWriter_Metadata(self));
+ Seg_Store_Metadata_Utf8(ivars->segment, "deletions", 9,
+ (Obj*)DefDelWriter_Metadata(self));
}
Hash*
@@ -187,14 +187,14 @@ DefDelWriter_Metadata_IMP(DefaultDeletionsWriter *self) {
BitVector *deldocs = (BitVector*)VA_Fetch(ivars->bit_vecs, i);
Segment *segment = SegReader_Get_Segment(seg_reader);
Hash *mini_meta = Hash_new(2);
- Hash_Store_Str(mini_meta, "count", 5,
- (Obj*)Str_newf("%u32", (uint32_t)BitVec_Count(deldocs)));
- Hash_Store_Str(mini_meta, "filename", 8,
- (Obj*)S_del_filename(self, seg_reader));
+ Hash_Store_Utf8(mini_meta, "count", 5,
+ (Obj*)Str_newf("%u32", (uint32_t)BitVec_Count(deldocs)));
+ Hash_Store_Utf8(mini_meta, "filename", 8,
+ (Obj*)S_del_filename(self, seg_reader));
Hash_Store(files, (Obj*)Seg_Get_Name(segment), (Obj*)mini_meta);
}
}
- Hash_Store_Str(metadata, "files", 5, (Obj*)files);
+ Hash_Store_Utf8(metadata, "files", 5, (Obj*)files);
return metadata;
}
@@ -344,11 +344,11 @@ DefDelWriter_Merge_Segment_IMP(DefaultDeletionsWriter *self,
DefaultDeletionsWriterIVARS *const ivars = DefDelWriter_IVARS(self);
UNUSED_VAR(doc_map);
Segment *segment = SegReader_Get_Segment(reader);
- Hash *del_meta = (Hash*)Seg_Fetch_Metadata_Str(segment, "deletions", 9);
+ Hash *del_meta = (Hash*)Seg_Fetch_Metadata_Utf8(segment, "deletions", 9);
if (del_meta) {
VArray *seg_readers = ivars->seg_readers;
- Hash *files = (Hash*)Hash_Fetch_Str(del_meta, "files", 5);
+ Hash *files = (Hash*)Hash_Fetch_Utf8(del_meta, "files", 5);
if (files) {
String *seg;
Hash *mini_meta;
@@ -370,7 +370,7 @@ DefDelWriter_Merge_Segment_IMP(DefaultDeletionsWriter *self,
* merge away the most recent deletions file
* pointing at this target segment -- so force a
* new file to be written out. */
- int32_t count = (int32_t)Obj_To_I64(Hash_Fetch_Str(mini_meta, "count", 5));
+ int32_t count = (int32_t)Obj_To_I64(Hash_Fetch_Utf8(mini_meta, "count", 5));
DeletionsReader *del_reader
= (DeletionsReader*)SegReader_Obtain(
candidate, VTable_Get_Name(DELETIONSREADER));
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DocReader.c b/core/Lucy/Index/DocReader.c
index 483af50..30f8dba 100644
--- a/core/Lucy/Index/DocReader.c
+++ b/core/Lucy/Index/DocReader.c
@@ -139,13 +139,13 @@ DefDocReader_init(DefaultDocReader *self, Schema *schema, Folder *folder,
seg_tick);
DefaultDocReaderIVARS *const ivars = DefDocReader_IVARS(self);
segment = DefDocReader_Get_Segment(self);
- metadata = (Hash*)Seg_Fetch_Metadata_Str(segment, "documents", 9);
+ metadata = (Hash*)Seg_Fetch_Metadata_Utf8(segment, "documents", 9);
if (metadata) {
String *seg_name = Seg_Get_Name(segment);
String *ix_file = Str_newf("%o/documents.ix", seg_name);
String *dat_file = Str_newf("%o/documents.dat", seg_name);
- Obj *format = Hash_Fetch_Str(metadata, "format", 6);
+ Obj *format = Hash_Fetch_Utf8(metadata, "format", 6);
// Check format.
if (!format) { THROW(ERR, "Missing 'format' var"); }
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/DocVector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DocVector.c b/core/Lucy/Index/DocVector.c
index 5821f90..585c955 100644
--- a/core/Lucy/Index/DocVector.c
+++ b/core/Lucy/Index/DocVector.c
@@ -132,7 +132,7 @@ S_extract_tv_cache(ByteBuf *field_buf) {
// Decompress the term text.
CB_Set_Size(text_buf, overlap);
- CB_Cat_Trusted_UTF8(text_buf, tv_string, len);
+ CB_Cat_Trusted_Utf8(text_buf, tv_string, len);
tv_string += len;
// Get positions & offsets string.
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/DocWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DocWriter.c b/core/Lucy/Index/DocWriter.c
index cb8c9e3..16f86ef 100644
--- a/core/Lucy/Index/DocWriter.c
+++ b/core/Lucy/Index/DocWriter.c
@@ -208,8 +208,8 @@ DocWriter_Finish_IMP(DocWriter *self) {
// Close down output streams.
OutStream_Close(ivars->dat_out);
OutStream_Close(ivars->ix_out);
- Seg_Store_Metadata_Str(ivars->segment, "documents", 9,
- (Obj*)DocWriter_Metadata(self));
+ Seg_Store_Metadata_Utf8(ivars->segment, "documents", 9,
+ (Obj*)DocWriter_Metadata(self));
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/FilePurger.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/FilePurger.c b/core/Lucy/Index/FilePurger.c
index 46957a9..d61482e 100644
--- a/core/Lucy/Index/FilePurger.c
+++ b/core/Lucy/Index/FilePurger.c
@@ -60,7 +60,7 @@ FilePurger_init(FilePurger *self, Folder *folder, Snapshot *snapshot,
// Don't allow the locks directory to be zapped.
ivars->disallowed = Hash_new(0);
- Hash_Store_Str(ivars->disallowed, "locks", 5, (Obj*)CFISH_TRUE);
+ Hash_Store_Utf8(ivars->disallowed, "locks", 5, (Obj*)CFISH_TRUE);
return self;
}
@@ -149,7 +149,7 @@ S_zap_dead_merge(FilePurger *self, Hash *candidates) {
if (!Lock_Is_Locked(merge_lock)) {
Hash *merge_data = IxManager_Read_Merge_Data(manager);
Obj *cutoff = merge_data
- ? Hash_Fetch_Str(merge_data, "cutoff", 6)
+ ? Hash_Fetch_Utf8(merge_data, "cutoff", 6)
: NULL;
if (cutoff) {
@@ -209,8 +209,8 @@ S_discover_unused(FilePurger *self, VArray **purgables_ptr,
Hash *candidates = Hash_new(64);
while (DH_Next(dh)) {
String *entry = DH_Get_Entry(dh);
- if (Str_Starts_With_Str(entry, "snapshot_", 9)
- && Str_Ends_With_Str(entry, ".json", 5)
+ if (Str_Starts_With_Utf8(entry, "snapshot_", 9)
+ && Str_Ends_With_Utf8(entry, ".json", 5)
&& (!snapfile || !Str_Equals(entry, (Obj*)snapfile))
) {
Snapshot *snapshot
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/HighlightReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/HighlightReader.c b/core/Lucy/Index/HighlightReader.c
index f24c346..af2c269 100644
--- a/core/Lucy/Index/HighlightReader.c
+++ b/core/Lucy/Index/HighlightReader.c
@@ -119,14 +119,14 @@ DefHLReader_init(DefaultHighlightReader *self, Schema *schema,
segments, seg_tick);
DefaultHighlightReaderIVARS *const ivars = DefHLReader_IVARS(self);
Segment *segment = DefHLReader_Get_Segment(self);
- Hash *metadata = (Hash*)Seg_Fetch_Metadata_Str(segment, "highlight", 9);
+ Hash *metadata = (Hash*)Seg_Fetch_Metadata_Utf8(segment, "highlight", 9);
if (!metadata) {
- metadata = (Hash*)Seg_Fetch_Metadata_Str(segment, "term_vectors", 12);
+ metadata = (Hash*)Seg_Fetch_Metadata_Utf8(segment, "term_vectors", 12);
}
// Check format.
if (metadata) {
- Obj *format = Hash_Fetch_Str(metadata, "format", 6);
+ Obj *format = Hash_Fetch_Utf8(metadata, "format", 6);
if (!format) { THROW(ERR, "Missing 'format' var"); }
else {
if (Obj_To_I64(format) != HLWriter_current_file_format) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/HighlightWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/HighlightWriter.c b/core/Lucy/Index/HighlightWriter.c
index 0d03233..e259a61 100644
--- a/core/Lucy/Index/HighlightWriter.c
+++ b/core/Lucy/Index/HighlightWriter.c
@@ -259,8 +259,8 @@ HLWriter_Finish_IMP(HighlightWriter *self) {
// Close down the output streams.
OutStream_Close(ivars->dat_out);
OutStream_Close(ivars->ix_out);
- Seg_Store_Metadata_Str(ivars->segment, "highlight", 9,
- (Obj*)HLWriter_Metadata(self));
+ Seg_Store_Metadata_Utf8(ivars->segment, "highlight", 9,
+ (Obj*)HLWriter_Metadata(self));
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/IndexManager.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/IndexManager.c b/core/Lucy/Index/IndexManager.c
index b1b29b4..b22e993 100644
--- a/core/Lucy/Index/IndexManager.c
+++ b/core/Lucy/Index/IndexManager.c
@@ -91,8 +91,8 @@ IxManager_Make_Snapshot_Filename_IMP(IndexManager *self) {
if (!dh) { RETHROW(INCREF(Err_get_error())); }
while (DH_Next(dh)) {
String *entry = DH_Get_Entry(dh);
- if (Str_Starts_With_Str(entry, "snapshot_", 9)
- && Str_Ends_With_Str(entry, ".json", 5)
+ if (Str_Starts_With_Utf8(entry, "snapshot_", 9)
+ && Str_Ends_With_Utf8(entry, ".json", 5)
) {
uint64_t gen = IxFileNames_extract_gen(entry);
if (gen > max_gen) { max_gen = gen; }
@@ -266,7 +266,7 @@ IxManager_Write_Merge_Data_IMP(IndexManager *self, int64_t cutoff) {
StackString *merge_json = SSTR_WRAP_STR("merge.json", 10);
Hash *data = Hash_new(1);
bool success;
- Hash_Store_Str(data, "cutoff", 6, (Obj*)Str_newf("%i64", cutoff));
+ Hash_Store_Utf8(data, "cutoff", 6, (Obj*)Str_newf("%i64", cutoff));
success = Json_spew_json((Obj*)data, ivars->folder, (String*)merge_json);
DECREF(data);
if (!success) {
@@ -306,8 +306,8 @@ IxManager_Make_Snapshot_Read_Lock_IMP(IndexManager *self,
const String *filename) {
LockFactory *lock_factory = S_obtain_lock_factory(self);
- if (!Str_Starts_With_Str(filename, "snapshot_", 9)
- || !Str_Ends_With_Str(filename, ".json", 5)
+ if (!Str_Starts_With_Utf8(filename, "snapshot_", 9)
+ || !Str_Ends_With_Utf8(filename, ".json", 5)
) {
THROW(ERR, "Not a snapshot filename: %o", filename);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/Indexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Indexer.c b/core/Lucy/Index/Indexer.c
index 815e7b4..7ef8ae2 100644
--- a/core/Lucy/Index/Indexer.c
+++ b/core/Lucy/Index/Indexer.c
@@ -176,7 +176,7 @@ Indexer_init(Indexer *self, Schema *schema, Obj *index,
// way.
Hash *merge_data = IxManager_Read_Merge_Data(ivars->manager);
Obj *cutoff_obj = merge_data
- ? Hash_Fetch_Str(merge_data, "cutoff", 6)
+ ? Hash_Fetch_Utf8(merge_data, "cutoff", 6)
: NULL;
if (!cutoff_obj) {
DECREF(merge_lock);
@@ -384,8 +384,8 @@ S_find_schema_file(Snapshot *snapshot) {
String *retval = NULL;
for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) {
String *file = (String*)VA_Fetch(files, i);
- if (Str_Starts_With_Str(file, "schema_", 7)
- && Str_Ends_With_Str(file, ".json", 5)
+ if (Str_Starts_With_Utf8(file, "schema_", 7)
+ && Str_Ends_With_Utf8(file, ".json", 5)
) {
retval = file;
break;
@@ -412,7 +412,7 @@ S_maybe_merge(Indexer *self, VArray *seg_readers) {
// If something else holds the merge lock, don't interfere.
Hash *merge_data = IxManager_Read_Merge_Data(ivars->manager);
if (merge_data) {
- Obj *cutoff_obj = Hash_Fetch_Str(merge_data, "cutoff", 6);
+ Obj *cutoff_obj = Hash_Fetch_Utf8(merge_data, "cutoff", 6);
if (cutoff_obj) {
cutoff = Obj_To_I64(cutoff_obj);
}
@@ -508,7 +508,7 @@ Indexer_Prepare_Commit_IMP(Indexer *self) {
// Derive snapshot and schema file names.
DECREF(ivars->snapfile);
String *snapfile = IxManager_Make_Snapshot_Filename(ivars->manager);
- ivars->snapfile = Str_Cat_Trusted_UTF8(snapfile, ".temp", 5);
+ ivars->snapfile = Str_Cat_Trusted_Utf8(snapfile, ".temp", 5);
DECREF(snapfile);
uint64_t schema_gen = IxFileNames_extract_gen(ivars->snapfile);
char base36[StrHelp_MAX_BASE36_BYTES];
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/LexiconWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/LexiconWriter.c b/core/Lucy/Index/LexiconWriter.c
index 9ffd853..5189c49 100644
--- a/core/Lucy/Index/LexiconWriter.c
+++ b/core/Lucy/Index/LexiconWriter.c
@@ -230,8 +230,8 @@ LexWriter_Finish_IMP(LexiconWriter *self) {
}
// Store metadata.
- Seg_Store_Metadata_Str(ivars->segment, "lexicon", 7,
- (Obj*)LexWriter_Metadata(self));
+ Seg_Store_Metadata_Utf8(ivars->segment, "lexicon", 7,
+ (Obj*)LexWriter_Metadata(self));
}
Hash*
@@ -246,13 +246,13 @@ LexWriter_Metadata_IMP(LexiconWriter *self) {
// Placeholders.
if (Hash_Get_Size(counts) == 0) {
- Hash_Store_Str(counts, "none", 4, (Obj*)Str_newf("%i32", (int32_t)0));
- Hash_Store_Str(ix_counts, "none", 4,
- (Obj*)Str_newf("%i32", (int32_t)0));
+ Hash_Store_Utf8(counts, "none", 4, (Obj*)Str_newf("%i32", (int32_t)0));
+ Hash_Store_Utf8(ix_counts, "none", 4,
+ (Obj*)Str_newf("%i32", (int32_t)0));
}
- Hash_Store_Str(metadata, "counts", 6, (Obj*)counts);
- Hash_Store_Str(metadata, "index_counts", 12, (Obj*)ix_counts);
+ Hash_Store_Utf8(metadata, "counts", 6, (Obj*)counts);
+ Hash_Store_Utf8(metadata, "index_counts", 12, (Obj*)ix_counts);
return metadata;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/PolyReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyReader.c b/core/Lucy/Index/PolyReader.c
index e63a639..0446bcb 100644
--- a/core/Lucy/Index/PolyReader.c
+++ b/core/Lucy/Index/PolyReader.c
@@ -237,8 +237,8 @@ S_try_open_elements(void *context) {
if (Seg_valid_seg_name(entry)) {
num_segs++;
}
- else if (Str_Starts_With_Str(entry, "schema_", 7)
- && Str_Ends_With_Str(entry, ".json", 5)
+ else if (Str_Starts_With_Utf8(entry, "schema_", 7)
+ && Str_Ends_With_Utf8(entry, ".json", 5)
) {
uint64_t gen = IxFileNames_extract_gen(entry);
if (gen > latest_schema_gen) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/PostingListReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingListReader.c b/core/Lucy/Index/PostingListReader.c
index 02ae03d..f643917 100644
--- a/core/Lucy/Index/PostingListReader.c
+++ b/core/Lucy/Index/PostingListReader.c
@@ -71,13 +71,13 @@ DefPListReader_init(DefaultPostingListReader *self, Schema *schema,
ivars->lex_reader = (LexiconReader*)INCREF(lex_reader);
// Check format.
- Hash *my_meta = (Hash*)Seg_Fetch_Metadata_Str(segment, "postings", 8);
+ Hash *my_meta = (Hash*)Seg_Fetch_Metadata_Utf8(segment, "postings", 8);
if (!my_meta) {
- my_meta = (Hash*)Seg_Fetch_Metadata_Str(segment, "posting_list", 12);
+ my_meta = (Hash*)Seg_Fetch_Metadata_Utf8(segment, "posting_list", 12);
}
if (my_meta) {
- Obj *format = Hash_Fetch_Str(my_meta, "format", 6);
+ Obj *format = Hash_Fetch_Utf8(my_meta, "format", 6);
if (!format) { THROW(ERR, "Missing 'format' var"); }
else {
if (Obj_To_I64(format) != PListWriter_current_file_format) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/PostingListWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingListWriter.c b/core/Lucy/Index/PostingListWriter.c
index 0245413..b398bc2 100644
--- a/core/Lucy/Index/PostingListWriter.c
+++ b/core/Lucy/Index/PostingListWriter.c
@@ -243,8 +243,8 @@ PListWriter_Finish_IMP(PostingListWriter *self) {
}
// Store metadata.
- Seg_Store_Metadata_Str(ivars->segment, "postings", 8,
- (Obj*)PListWriter_Metadata(self));
+ Seg_Store_Metadata_Utf8(ivars->segment, "postings", 8,
+ (Obj*)PListWriter_Metadata(self));
// Close down and clean up.
OutStream_Close(ivars->skip_out);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/SegLexicon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SegLexicon.c b/core/Lucy/Index/SegLexicon.c
index 19c6e7b..dd5931f 100644
--- a/core/Lucy/Index/SegLexicon.c
+++ b/core/Lucy/Index/SegLexicon.c
@@ -47,11 +47,11 @@ SegLexicon*
SegLex_init(SegLexicon *self, Schema *schema, Folder *folder,
Segment *segment, const String *field) {
Hash *metadata = (Hash*)CERTIFY(
- Seg_Fetch_Metadata_Str(segment, "lexicon", 7),
+ Seg_Fetch_Metadata_Utf8(segment, "lexicon", 7),
HASH);
Architecture *arch = Schema_Get_Architecture(schema);
- Hash *counts = (Hash*)Hash_Fetch_Str(metadata, "counts", 6);
- Obj *format = Hash_Fetch_Str(metadata, "format", 6);
+ Hash *counts = (Hash*)Hash_Fetch_Utf8(metadata, "counts", 6);
+ Obj *format = Hash_Fetch_Utf8(metadata, "format", 6);
String *seg_name = Seg_Get_Name(segment);
int32_t field_num = Seg_Field_Num(segment, field);
FieldType *type = Schema_Fetch_Type(schema, field);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/Segment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c
index d375e98..21a3f66 100644
--- a/core/Lucy/Index/Segment.c
+++ b/core/Lucy/Index/Segment.c
@@ -65,7 +65,7 @@ Seg_num_to_name(int64_t number) {
bool
Seg_valid_seg_name(const String *name) {
- if (Str_Starts_With_Str(name, "seg_", 4)) {
+ if (Str_Starts_With_Utf8(name, "seg_", 4)) {
StringIterator *iter = Str_Top(name);
StrIter_Advance(iter, 4);
uint32_t code_point;
@@ -107,17 +107,17 @@ Seg_Read_File_IMP(Segment *self, Folder *folder) {
DECREF(ivars->metadata);
ivars->metadata = metadata;
my_metadata
- = (Hash*)CERTIFY(Hash_Fetch_Str(ivars->metadata, "segmeta", 7), HASH);
+ = (Hash*)CERTIFY(Hash_Fetch_Utf8(ivars->metadata, "segmeta", 7), HASH);
// Assign.
- Obj *count = Hash_Fetch_Str(my_metadata, "count", 5);
- if (!count) { count = Hash_Fetch_Str(my_metadata, "doc_count", 9); }
+ Obj *count = Hash_Fetch_Utf8(my_metadata, "count", 5);
+ if (!count) { count = Hash_Fetch_Utf8(my_metadata, "doc_count", 9); }
if (!count) { THROW(ERR, "Missing 'count'"); }
else { ivars->count = Obj_To_I64(count); }
// Get list of field nums.
- VArray *source_by_num = (VArray*)Hash_Fetch_Str(my_metadata,
- "field_names", 11);
+ VArray *source_by_num = (VArray*)Hash_Fetch_Utf8(my_metadata,
+ "field_names", 11);
uint32_t num_fields = source_by_num ? VA_Get_Size(source_by_num) : 0;
if (source_by_num == NULL) {
THROW(ERR, "Failed to extract 'field_names' from metadata");
@@ -144,12 +144,12 @@ Seg_Write_File_IMP(Segment *self, Folder *folder) {
Hash *my_metadata = Hash_new(16);
// Store metadata specific to this Segment object.
- Hash_Store_Str(my_metadata, "count", 5,
- (Obj*)Str_newf("%i64", ivars->count));
- Hash_Store_Str(my_metadata, "name", 4, (Obj*)Str_Clone(ivars->name));
- Hash_Store_Str(my_metadata, "field_names", 11, INCREF(ivars->by_num));
- Hash_Store_Str(my_metadata, "format", 6, (Obj*)Str_newf("%i32", 1));
- Hash_Store_Str(ivars->metadata, "segmeta", 7, (Obj*)my_metadata);
+ Hash_Store_Utf8(my_metadata, "count", 5,
+ (Obj*)Str_newf("%i64", ivars->count));
+ Hash_Store_Utf8(my_metadata, "name", 4, (Obj*)Str_Clone(ivars->name));
+ Hash_Store_Utf8(my_metadata, "field_names", 11, INCREF(ivars->by_num));
+ Hash_Store_Utf8(my_metadata, "format", 6, (Obj*)Str_newf("%i32", 1));
+ Hash_Store_Utf8(ivars->metadata, "segmeta", 7, (Obj*)my_metadata);
String *filename = Str_newf("%o/segmeta.json", ivars->name);
bool result = Json_spew_json((Obj*)ivars->metadata, folder, filename);
@@ -209,8 +209,8 @@ Seg_Store_Metadata_IMP(Segment *self, const String *key, Obj *value) {
}
void
-Seg_Store_Metadata_Str_IMP(Segment *self, const char *key, size_t key_len,
- Obj *value) {
+Seg_Store_Metadata_Utf8_IMP(Segment *self, const char *key, size_t key_len,
+ Obj *value) {
StackString *k = SSTR_WRAP_STR((char*)key, key_len);
Seg_Store_Metadata(self, (String*)k, value);
}
@@ -222,9 +222,9 @@ Seg_Fetch_Metadata_IMP(Segment *self, const String *key) {
}
Obj*
-Seg_Fetch_Metadata_Str_IMP(Segment *self, const char *key, size_t len) {
+Seg_Fetch_Metadata_Utf8_IMP(Segment *self, const char *key, size_t len) {
SegmentIVARS *const ivars = Seg_IVARS(self);
- return Hash_Fetch_Str(ivars->metadata, key, len);
+ return Hash_Fetch_Utf8(ivars->metadata, key, len);
}
Hash*
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/Segment.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Segment.cfh b/core/Lucy/Index/Segment.cfh
index 3231938..43ca509 100644
--- a/core/Lucy/Index/Segment.cfh
+++ b/core/Lucy/Index/Segment.cfh
@@ -77,8 +77,8 @@ public class Lucy::Index::Segment cnick Seg inherits Clownfish::Obj {
decremented Obj *metadata);
void
- Store_Metadata_Str(Segment *self, const char *key, size_t len,
- decremented Obj *value);
+ Store_Metadata_Utf8(Segment *self, const char *key, size_t len,
+ decremented Obj *value);
/** Fetch a value from the Segment's metadata hash.
*/
@@ -86,7 +86,7 @@ public class Lucy::Index::Segment cnick Seg inherits Clownfish::Obj {
Fetch_Metadata(Segment *self, const String *key);
nullable Obj*
- Fetch_Metadata_Str(Segment *self, const char *key, size_t len);
+ Fetch_Metadata_Utf8(Segment *self, const char *key, size_t len);
/** Given a field name, return its field number for this segment (which
* may differ from its number in other segments). Return 0 (an invalid
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/Similarity.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Similarity.c b/core/Lucy/Index/Similarity.c
index ddfbcf5..c43d9b4 100644
--- a/core/Lucy/Index/Similarity.c
+++ b/core/Lucy/Index/Similarity.c
@@ -83,8 +83,8 @@ Sim_Get_Norm_Decoder_IMP(Similarity *self) {
Obj*
Sim_Dump_IMP(Similarity *self) {
Hash *dump = Hash_new(0);
- Hash_Store_Str(dump, "_class", 6,
- (Obj*)Str_Clone(Sim_Get_Class_Name(self)));
+ Hash_Store_Utf8(dump, "_class", 6,
+ (Obj*)Str_Clone(Sim_Get_Class_Name(self)));
return (Obj*)dump;
}
@@ -92,7 +92,7 @@ Similarity*
Sim_Load_IMP(Similarity *self, Obj *dump) {
Hash *source = (Hash*)CERTIFY(dump, HASH);
String *class_name
- = (String*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), STRING);
+ = (String*)CERTIFY(Hash_Fetch_Utf8(source, "_class", 6), STRING);
VTable *vtable = VTable_singleton(class_name, NULL);
Similarity *loaded = (Similarity*)VTable_Make_Obj(vtable);
UNUSED_VAR(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/Lucy/Index/Snapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Snapshot.c b/core/Lucy/Index/Snapshot.c
index 5ea097d..a8b2afe 100644
--- a/core/Lucy/Index/Snapshot.c
+++ b/core/Lucy/Index/Snapshot.c
@@ -114,9 +114,9 @@ Snapshot_Read_File_IMP(Snapshot *self, Folder *folder, const String *path) {
Hash *snap_data
= (Hash*)CERTIFY(Json_slurp_json(folder, ivars->path), HASH);
Obj *format_obj
- = CERTIFY(Hash_Fetch_Str(snap_data, "format", 6), OBJ);
+ = CERTIFY(Hash_Fetch_Utf8(snap_data, "format", 6), OBJ);
int32_t format = (int32_t)Obj_To_I64(format_obj);
- Obj *subformat_obj = Hash_Fetch_Str(snap_data, "subformat", 9);
+ Obj *subformat_obj = Hash_Fetch_Utf8(snap_data, "subformat", 9);
int32_t subformat = subformat_obj
? (int32_t)Obj_To_I64(subformat_obj)
: 0;
@@ -129,7 +129,7 @@ Snapshot_Read_File_IMP(Snapshot *self, Folder *folder, const String *path) {
// Build up list of entries.
VArray *list = (VArray*)CERTIFY(
- Hash_Fetch_Str(snap_data, "entries", 7),
+ Hash_Fetch_Utf8(snap_data, "entries", 7),
VARRAY);
INCREF(list);
if (format == 1 || (format == 2 && subformat < 1)) {
@@ -160,7 +160,7 @@ S_clean_segment_contents(VArray *orig) {
for (uint32_t i = 0, max = VA_Get_Size(orig); i < max; i++) {
String *name = (String*)VA_Fetch(orig, i);
if (!Seg_valid_seg_name(name)) {
- if (Str_Starts_With_Str(name, "seg_", 4)) {
+ if (Str_Starts_With_Utf8(name, "seg_", 4)) {
continue; // Skip this file.
}
}
@@ -197,13 +197,13 @@ Snapshot_Write_File_IMP(Snapshot *self, Folder *folder, const String *path) {
// Sort, then store file names.
VA_Sort(list, NULL, NULL);
- Hash_Store_Str(all_data, "entries", 7, (Obj*)list);
+ Hash_Store_Utf8(all_data, "entries", 7, (Obj*)list);
// Create a JSON-izable data structure.
- Hash_Store_Str(all_data, "format", 6,
- (Obj*)Str_newf("%i32", (int32_t)Snapshot_current_file_format));
- Hash_Store_Str(all_data, "subformat", 9,
- (Obj*)Str_newf("%i32", (int32_t)Snapshot_current_file_subformat));
+ Hash_Store_Utf8(all_data, "format", 6,
+ (Obj*)Str_newf("%i32", (int32_t)Snapshot_current_file_format));
+ Hash_Store_Utf8(all_data, "subformat", 9,
+ (Obj*)Str_newf("%i32", (int32_t)Snapshot_current_file_subformat));
// Write out JSON-ized data to the new file.
Json_spew_json((Obj*)all_data, folder, ivars->path);
[lucy-commits] [50/50] [abbrv] git commit: refs/heads/master - String's "steal"
constructors shouldn't take const strings
Posted by nw...@apache.org.
String's "steal" constructors shouldn't take const strings
The stolen buffer will be freed later, so it must not be const.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/668e82a9
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/668e82a9
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/668e82a9
Branch: refs/heads/master
Commit: 668e82a940c800c4957d292fac834d20b6bdbb49
Parents: 0232035
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Oct 10 16:57:17 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:22 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 6 +++---
clownfish/runtime/core/Clownfish/String.cfh | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/668e82a9/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 41ecab2..9f691ad 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -84,7 +84,7 @@ Str_init_from_trusted_utf8(String *self, const char *utf8, size_t size) {
}
String*
-Str_new_steal_utf8(const char *utf8, size_t size) {
+Str_new_steal_utf8(char *utf8, size_t size) {
if (!StrHelp_utf8_valid(utf8, size)) {
DIE_INVALID_UTF8(utf8, size);
}
@@ -93,13 +93,13 @@ Str_new_steal_utf8(const char *utf8, size_t size) {
}
String*
-Str_new_steal_trusted_utf8(const char *utf8, size_t size) {
+Str_new_steal_trusted_utf8(char *utf8, size_t size) {
String *self = (String*)VTable_Make_Obj(STRING);
return Str_init_steal_trusted_utf8(self, utf8, size);
}
String*
-Str_init_steal_trusted_utf8(String *self, const char *utf8, size_t size) {
+Str_init_steal_trusted_utf8(String *self, char *utf8, size_t size) {
self->ptr = utf8;
self->size = size;
self->origin = self;
http://git-wip-us.apache.org/repos/asf/lucy/blob/668e82a9/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index ff4047a..8a065cb 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -49,19 +49,19 @@ class Clownfish::String cnick Str
* passed-in string. Check validity of supplied UTF-8.
*/
inert incremented String*
- new_steal_utf8(const char *utf8, size_t size);
+ new_steal_utf8(char *utf8, size_t size);
/** Return a pointer to a new String which assumes ownership of the
* passed-in string. Do not check validity of supplied UTF-8.
*/
inert incremented String*
- new_steal_trusted_utf8(const char *utf8, size_t size);
+ new_steal_trusted_utf8(char *utf8, size_t size);
/** Initialize the String using the passed-in string. Do not check
* validity of supplied UTF-8.
*/
public inert String*
- init_steal_trusted_utf8(String *self, const char *utf8, size_t size);
+ init_steal_trusted_utf8(String *self, char *utf8, size_t size);
/** Return a pointer to a new String which wraps an external buffer
* containing UTF-8. The buffer must stay unchanged for the lifetime
[lucy-commits] [11/50] [abbrv] git commit: refs/heads/master - Make Str_Get_Ptr8
return a const char pointer.
Posted by nw...@apache.org.
Make Str_Get_Ptr8 return a const char pointer.
Also make CB_Get_Ptr8 return a char pointer and const a couple of other
pointers in the process.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/c120b678
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/c120b678
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/c120b678
Branch: refs/heads/master
Commit: c120b678457dafe018a17ed3d01d07462b8bc24b
Parents: 6299372
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 14 19:03:48 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:16 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/CharBuf.c | 4 +-
clownfish/runtime/core/Clownfish/CharBuf.cfh | 2 +-
clownfish/runtime/core/Clownfish/String.c | 4 +-
clownfish/runtime/core/Clownfish/String.cfh | 2 +-
.../runtime/core/Clownfish/Util/StringHelper.c | 2 +-
.../core/Clownfish/Util/StringHelper.cfh | 2 +-
clownfish/runtime/perl/xs/XSBind.c | 6 +--
clownfish/runtime/ruby/ext/Bind.c | 2 +-
core/Lucy/Analysis/Analyzer.c | 2 +-
core/Lucy/Analysis/PolyAnalyzer.c | 6 +--
core/Lucy/Analysis/RegexTokenizer.c | 2 +-
core/Lucy/Analysis/StandardTokenizer.c | 2 +-
core/Lucy/Index/DocWriter.c | 4 +-
core/Lucy/Index/Inverter.c | 2 +-
core/Lucy/Index/Posting/MatchPosting.c | 22 ++++-----
core/Lucy/Index/Posting/RawPosting.c | 2 +-
core/Lucy/Index/Posting/RawPosting.cfh | 2 +-
core/Lucy/Index/Posting/RichPosting.c | 22 ++++-----
core/Lucy/Index/Posting/ScorePosting.c | 22 ++++-----
core/Lucy/Index/PostingPool.c | 6 +--
core/Lucy/Index/SortFieldWriter.c | 2 +-
core/Lucy/Plan/TextType.c | 16 +++----
core/Lucy/Store/FSDirHandle.c | 8 ++--
core/Lucy/Store/FSFolder.c | 4 +-
core/Lucy/Test/Analysis/TestNormalizer.c | 3 +-
core/Lucy/Test/Search/TestQueryParserLogic.c | 12 ++---
core/Lucy/Test/Search/TestQueryParserSyntax.c | 10 ++--
core/Lucy/Test/Store/TestFSFileHandle.c | 18 +++----
core/Lucy/Test/TestUtils.c | 2 +-
core/Lucy/Util/Freezer.c | 4 +-
core/Lucy/Util/Json.c | 50 ++++++++++----------
perl/xs/Lucy/Document/Doc.c | 6 +--
32 files changed, 128 insertions(+), 125 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 9f48caa..7b407ad 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -406,9 +406,9 @@ CB_Get_Size_IMP(CharBuf *self) {
return self->size;
}
-uint8_t*
+char*
CB_Get_Ptr8_IMP(CharBuf *self) {
- return (uint8_t*)self->ptr;
+ return self->ptr;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/clownfish/runtime/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.cfh b/clownfish/runtime/core/Clownfish/CharBuf.cfh
index da48822..64d38da 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.cfh
+++ b/clownfish/runtime/core/Clownfish/CharBuf.cfh
@@ -130,7 +130,7 @@ class Clownfish::CharBuf cnick CB
/** Return the internal backing array for the CharBuf if its internal
* encoding is UTF-8. If it is not encoded as UTF-8 throw an exception.
*/
- uint8_t*
+ char*
Get_Ptr8(CharBuf *self);
public incremented CharBuf*
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 0fb4c5f..df85e29 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -449,9 +449,9 @@ Str_Get_Size_IMP(String *self) {
return self->size;
}
-uint8_t*
+const char*
Str_Get_Ptr8_IMP(String *self) {
- return (uint8_t*)self->ptr;
+ return self->ptr;
}
StringIterator*
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index 41ca029..e639fa4 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -170,7 +170,7 @@ class Clownfish::String cnick Str
/** Return the internal backing array for the String if its internal
* encoding is UTF-8. If it is not encoded as UTF-8 throw an exception.
*/
- uint8_t*
+ const char*
Get_Ptr8(String *self);
/** Return a NULL-terminated copy of the string data in UTF-8 encoding.
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/clownfish/runtime/core/Clownfish/Util/StringHelper.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/StringHelper.c b/clownfish/runtime/core/Clownfish/Util/StringHelper.c
index 89bd319..98e7f11 100644
--- a/clownfish/runtime/core/Clownfish/Util/StringHelper.c
+++ b/clownfish/runtime/core/Clownfish/Util/StringHelper.c
@@ -222,7 +222,7 @@ StrHelp_decode_utf8_char(const char *ptr) {
}
const char*
-StrHelp_back_utf8_char(const char *ptr, char *start) {
+StrHelp_back_utf8_char(const char *ptr, const char *start) {
while (--ptr >= start) {
if ((*ptr & 0xC0) != 0x80) { return ptr; }
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh b/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
index 482666f..905613d 100644
--- a/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
+++ b/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
@@ -67,7 +67,7 @@ inert class Clownfish::Util::StringHelper cnick StrHelp {
* If backtracking progresses beyond the supplied start, return NULL.
*/
inert nullable const char*
- back_utf8_char(const char *utf8, char *start);
+ back_utf8_char(const char *utf8, const char *start);
}
__C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 0f21e50..ea7700d 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -88,7 +88,7 @@ XSBind_maybe_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable, void *allocation) {
// Assume that the class name is always NULL-terminated. Somewhat
// dangerous but should be safe.
if (sv_isobject(sv)
- && sv_derived_from(sv, (char*)CFISH_Str_Get_Ptr8(CFISH_VTable_Get_Name(vtable)))
+ && sv_derived_from(sv, CFISH_Str_Get_Ptr8(CFISH_VTable_Get_Name(vtable)))
) {
// Unwrap a real Clownfish object.
IV tmp = SvIV(SvRV(sv));
@@ -231,7 +231,7 @@ XSBind_str_to_sv(const cfish_String *str) {
return newSV(0);
}
else {
- SV *sv = newSVpvn((char*)CFISH_Str_Get_Ptr8(str), CFISH_Str_Get_Size(str));
+ SV *sv = newSVpvn(CFISH_Str_Get_Ptr8(str), CFISH_Str_Get_Size(str));
SvUTF8_on(sv);
return sv;
}
@@ -603,7 +603,7 @@ S_lazy_init_host_obj(cfish_Obj *self) {
// Connect class association.
cfish_String *class_name = CFISH_VTable_Get_Name(self->vtable);
- HV *stash = gv_stashpvn((char*)CFISH_Str_Get_Ptr8(class_name),
+ HV *stash = gv_stashpvn(CFISH_Str_Get_Ptr8(class_name),
CFISH_Str_Get_Size(class_name), TRUE);
SvSTASH_set(inner_obj, (HV*)SvREFCNT_inc(stash));
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/clownfish/runtime/ruby/ext/Bind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/ruby/ext/Bind.c b/clownfish/runtime/ruby/ext/Bind.c
index 2113176..9fa2fbd 100644
--- a/clownfish/runtime/ruby/ext/Bind.c
+++ b/clownfish/runtime/ruby/ext/Bind.c
@@ -35,7 +35,7 @@ Bind_str_to_ruby(const cfish_String *str) {
return rb_str_new2("");
}
else {
- return rb_str_new((char*)CFISH_Str_Get_Ptr8(str), CFISH_Str_Get_Size(str));
+ return rb_str_new(CFISH_Str_Get_Ptr8(str), CFISH_Str_Get_Size(str));
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Analysis/Analyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Analyzer.c b/core/Lucy/Analysis/Analyzer.c
index 4683276..0e52eb7 100644
--- a/core/Lucy/Analysis/Analyzer.c
+++ b/core/Lucy/Analysis/Analyzer.c
@@ -31,7 +31,7 @@ Analyzer_init(Analyzer *self) {
Inversion*
Analyzer_Transform_Text_IMP(Analyzer *self, String *text) {
size_t token_len = Str_Get_Size(text);
- Token *seed = Token_new((char*)Str_Get_Ptr8(text), token_len, 0,
+ Token *seed = Token_new(Str_Get_Ptr8(text), token_len, 0,
token_len, 1.0, 1);
Inversion *starter = Inversion_new(seed);
Inversion *retval = Analyzer_Transform(self, starter);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Analysis/PolyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/PolyAnalyzer.c b/core/Lucy/Analysis/PolyAnalyzer.c
index 59ba1d9..92dd9bf 100644
--- a/core/Lucy/Analysis/PolyAnalyzer.c
+++ b/core/Lucy/Analysis/PolyAnalyzer.c
@@ -91,9 +91,9 @@ PolyAnalyzer_Transform_Text_IMP(PolyAnalyzer *self, String *text) {
Inversion *retval;
if (num_analyzers == 0) {
- size_t token_len = Str_Get_Size(text);
- char *buf = (char*)Str_Get_Ptr8(text);
- Token *seed = Token_new(buf, token_len, 0, token_len, 1.0f, 1);
+ size_t token_len = Str_Get_Size(text);
+ const char *buf = Str_Get_Ptr8(text);
+ Token *seed = Token_new(buf, token_len, 0, token_len, 1.0f, 1);
retval = Inversion_new(seed);
DECREF(seed);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/RegexTokenizer.c b/core/Lucy/Analysis/RegexTokenizer.c
index 3b9e6fa..07215a5 100644
--- a/core/Lucy/Analysis/RegexTokenizer.c
+++ b/core/Lucy/Analysis/RegexTokenizer.c
@@ -45,7 +45,7 @@ RegexTokenizer_Transform_IMP(RegexTokenizer *self, Inversion *inversion) {
Inversion*
RegexTokenizer_Transform_Text_IMP(RegexTokenizer *self, String *text) {
Inversion *new_inversion = Inversion_new(NULL);
- RegexTokenizer_Tokenize_Utf8(self, (char*)Str_Get_Ptr8(text),
+ RegexTokenizer_Tokenize_Utf8(self, Str_Get_Ptr8(text),
Str_Get_Size(text), new_inversion);
return new_inversion;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Analysis/StandardTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/StandardTokenizer.c b/core/Lucy/Analysis/StandardTokenizer.c
index 8db94ec..9992927 100644
--- a/core/Lucy/Analysis/StandardTokenizer.c
+++ b/core/Lucy/Analysis/StandardTokenizer.c
@@ -97,7 +97,7 @@ StandardTokenizer_Transform_IMP(StandardTokenizer *self, Inversion *inversion) {
Inversion*
StandardTokenizer_Transform_Text_IMP(StandardTokenizer *self, String *text) {
Inversion *new_inversion = Inversion_new(NULL);
- StandardTokenizer_Tokenize_Utf8(self, (char*)Str_Get_Ptr8(text),
+ StandardTokenizer_Tokenize_Utf8(self, Str_Get_Ptr8(text),
Str_Get_Size(text), new_inversion);
return new_inversion;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Index/DocWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DocWriter.c b/core/Lucy/Index/DocWriter.c
index 16f86ef..d1e316e 100644
--- a/core/Lucy/Index/DocWriter.c
+++ b/core/Lucy/Index/DocWriter.c
@@ -115,8 +115,8 @@ DocWriter_Add_Inverted_Doc_IMP(DocWriter *self, Inverter *inverter,
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);
- size_t size = Str_Get_Size((String*)value);
+ const char *buf = Str_Get_Ptr8((String*)value);
+ size_t size = Str_Get_Size((String*)value);
OutStream_Write_C32(dat_out, size);
OutStream_Write_Bytes(dat_out, buf, size);
break;
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Inverter.c b/core/Lucy/Index/Inverter.c
index 0147732..d24e14f 100644
--- a/core/Lucy/Index/Inverter.c
+++ b/core/Lucy/Index/Inverter.c
@@ -166,7 +166,7 @@ Inverter_Add_Field_IMP(Inverter *self, InverterEntry *entry) {
else if (entry_ivars->indexed || entry_ivars->highlightable) {
String *value = (String*)entry_ivars->value;
size_t token_len = Str_Get_Size(value);
- Token *seed = Token_new((char*)Str_Get_Ptr8(value),
+ Token *seed = Token_new(Str_Get_Ptr8(value),
token_len, 0, token_len, 1.0f, 1);
DECREF(entry_ivars->inversion);
entry_ivars->inversion = Inversion_new(seed);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Index/Posting/MatchPosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/MatchPosting.c b/core/Lucy/Index/Posting/MatchPosting.c
index c794660..55c9734 100644
--- a/core/Lucy/Index/Posting/MatchPosting.c
+++ b/core/Lucy/Index/Posting/MatchPosting.c
@@ -98,17 +98,17 @@ RawPosting*
MatchPost_Read_Raw_IMP(MatchPosting *self, InStream *instream,
int32_t last_doc_id, String *term_text,
MemoryPool *mem_pool) {
- char *const text_buf = (char*)Str_Get_Ptr8(term_text);
- const size_t text_size = Str_Get_Size(term_text);
- const uint32_t doc_code = InStream_Read_C32(instream);
- const uint32_t delta_doc = doc_code >> 1;
- const int32_t doc_id = last_doc_id + delta_doc;
- const uint32_t freq = (doc_code & 1)
- ? 1
- : InStream_Read_C32(instream);
- const size_t base_size = VTable_Get_Obj_Alloc_Size(RAWPOSTING);
- size_t raw_post_bytes = MAX_RAW_POSTING_LEN(base_size, text_size);
- void *const allocation = MemPool_Grab(mem_pool, raw_post_bytes);
+ const char *const text_buf = Str_Get_Ptr8(term_text);
+ const size_t text_size = Str_Get_Size(term_text);
+ const uint32_t doc_code = InStream_Read_C32(instream);
+ const uint32_t delta_doc = doc_code >> 1;
+ const int32_t doc_id = last_doc_id + delta_doc;
+ const uint32_t freq = (doc_code & 1)
+ ? 1
+ : InStream_Read_C32(instream);
+ const size_t base_size = VTable_Get_Obj_Alloc_Size(RAWPOSTING);
+ size_t raw_post_bytes = MAX_RAW_POSTING_LEN(base_size, text_size);
+ void *const allocation = MemPool_Grab(mem_pool, raw_post_bytes);
UNUSED_VAR(self);
return RawPost_new(allocation, doc_id, freq, text_buf, text_size);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Index/Posting/RawPosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/RawPosting.c b/core/Lucy/Index/Posting/RawPosting.c
index 90ba43f..5f5e8d4 100644
--- a/core/Lucy/Index/Posting/RawPosting.c
+++ b/core/Lucy/Index/Posting/RawPosting.c
@@ -32,7 +32,7 @@
RawPosting*
RawPost_new(void *pre_allocated_memory, int32_t doc_id, uint32_t freq,
- char *term_text, size_t term_text_len) {
+ const char *term_text, size_t term_text_len) {
RawPosting *self
= (RawPosting*)VTable_Init_Obj(RAWPOSTING, pre_allocated_memory);
RawPostingIVARS *const ivars = RawPost_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Index/Posting/RawPosting.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/RawPosting.cfh b/core/Lucy/Index/Posting/RawPosting.cfh
index aab5846..e82c390 100644
--- a/core/Lucy/Index/Posting/RawPosting.cfh
+++ b/core/Lucy/Index/Posting/RawPosting.cfh
@@ -48,7 +48,7 @@ class Lucy::Index::RawPosting cnick RawPost
*/
inert incremented RawPosting*
new(void *pre_allocated_memory, int32_t doc_id, uint32_t freq,
- char *term_text, size_t term_text_len);
+ const char *term_text, size_t term_text_len);
uint32_t
Get_RefCount(RawPosting* self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Index/Posting/RichPosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/RichPosting.c b/core/Lucy/Index/Posting/RichPosting.c
index e50eb48..f5af4ce 100644
--- a/core/Lucy/Index/Posting/RichPosting.c
+++ b/core/Lucy/Index/Posting/RichPosting.c
@@ -155,17 +155,17 @@ RawPosting*
RichPost_Read_Raw_IMP(RichPosting *self, InStream *instream,
int32_t last_doc_id, String *term_text,
MemoryPool *mem_pool) {
- char *const text_buf = (char*)Str_Get_Ptr8(term_text);
- const size_t text_size = Str_Get_Size(term_text);
- const uint32_t doc_code = InStream_Read_C32(instream);
- const uint32_t delta_doc = doc_code >> 1;
- const int32_t doc_id = last_doc_id + delta_doc;
- const uint32_t freq = (doc_code & 1)
- ? 1
- : InStream_Read_C32(instream);
- const size_t base_size = VTable_Get_Obj_Alloc_Size(RAWPOSTING);
- size_t raw_post_bytes = MAX_RAW_POSTING_LEN(base_size, text_size, freq);
- void *const allocation = MemPool_Grab(mem_pool, raw_post_bytes);
+ const char *const text_buf = Str_Get_Ptr8(term_text);
+ const size_t text_size = Str_Get_Size(term_text);
+ const uint32_t doc_code = InStream_Read_C32(instream);
+ const uint32_t delta_doc = doc_code >> 1;
+ const int32_t doc_id = last_doc_id + delta_doc;
+ const uint32_t freq = (doc_code & 1)
+ ? 1
+ : InStream_Read_C32(instream);
+ const size_t base_size = VTable_Get_Obj_Alloc_Size(RAWPOSTING);
+ size_t raw_post_bytes = MAX_RAW_POSTING_LEN(base_size, text_size, freq);
+ void *const allocation = MemPool_Grab(mem_pool, raw_post_bytes);
RawPosting *const raw_posting
= RawPost_new(allocation, doc_id, freq, text_buf, text_size);
RawPostingIVARS *const raw_post_ivars = RawPost_IVARS(raw_posting);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Index/Posting/ScorePosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/ScorePosting.c b/core/Lucy/Index/Posting/ScorePosting.c
index 321065f..b2d3265 100644
--- a/core/Lucy/Index/Posting/ScorePosting.c
+++ b/core/Lucy/Index/Posting/ScorePosting.c
@@ -174,17 +174,17 @@ RawPosting*
ScorePost_Read_Raw_IMP(ScorePosting *self, InStream *instream,
int32_t last_doc_id, String *term_text,
MemoryPool *mem_pool) {
- char *const text_buf = (char*)Str_Get_Ptr8(term_text);
- const size_t text_size = Str_Get_Size(term_text);
- const uint32_t doc_code = InStream_Read_C32(instream);
- const uint32_t delta_doc = doc_code >> 1;
- const int32_t doc_id = last_doc_id + delta_doc;
- const uint32_t freq = (doc_code & 1)
- ? 1
- : InStream_Read_C32(instream);
- const size_t base_size = VTable_Get_Obj_Alloc_Size(RAWPOSTING);
- size_t raw_post_bytes = MAX_RAW_POSTING_LEN(base_size, text_size, freq);
- void *const allocation = MemPool_Grab(mem_pool, raw_post_bytes);
+ const char *const text_buf = Str_Get_Ptr8(term_text);
+ const size_t text_size = Str_Get_Size(term_text);
+ const uint32_t doc_code = InStream_Read_C32(instream);
+ const uint32_t delta_doc = doc_code >> 1;
+ const int32_t doc_id = last_doc_id + delta_doc;
+ const uint32_t freq = (doc_code & 1)
+ ? 1
+ : InStream_Read_C32(instream);
+ const size_t base_size = VTable_Get_Obj_Alloc_Size(RAWPOSTING);
+ size_t raw_post_bytes = MAX_RAW_POSTING_LEN(base_size, text_size, freq);
+ void *const allocation = MemPool_Grab(mem_pool, raw_post_bytes);
RawPosting *const raw_posting
= RawPost_new(allocation, doc_id, freq, text_buf, text_size);
RawPostingIVARS *const raw_post_ivars = RawPost_IVARS(raw_posting);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index 86eab72..a969fd5 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -379,8 +379,8 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
RawPostingIVARS *post_ivars = RawPost_IVARS(posting);
String *last_term_text
= Str_new_from_utf8(post_ivars->blob, post_ivars->content_len);
- char *last_text_buf = (char*)Str_Get_Ptr8(last_term_text);
- uint32_t last_text_size = Str_Get_Size(last_term_text);
+ const char *last_text_buf = Str_Get_Ptr8(last_term_text);
+ uint32_t last_text_size = Str_Get_Size(last_term_text);
SkipStepper_Set_ID_And_Filepos(skip_stepper, 0, 0);
// Initialize sentinel to be used on the last iter, using an empty string
@@ -429,7 +429,7 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
DECREF(last_term_text);
last_term_text
= Str_new_from_utf8(post_ivars->blob, post_ivars->content_len);
- last_text_buf = (char*)Str_Get_Ptr8(last_term_text);
+ last_text_buf = Str_Get_Ptr8(last_term_text);
last_text_size = Str_Get_Size(last_term_text);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 5e4f173..86bb84d 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -265,7 +265,7 @@ S_write_val(Obj *val, int8_t prim_id, OutStream *ix_out, OutStream *dat_out,
String *string = (String*)val;
int64_t dat_pos = OutStream_Tell(dat_out) - dat_start;
OutStream_Write_I64(ix_out, dat_pos);
- OutStream_Write_Bytes(dat_out, (char*)Str_Get_Ptr8(string),
+ OutStream_Write_Bytes(dat_out, Str_Get_Ptr8(string),
Str_Get_Size(string));
break;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Plan/TextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.c b/core/Lucy/Plan/TextType.c
index f9e6fcc..487317c 100644
--- a/core/Lucy/Plan/TextType.c
+++ b/core/Lucy/Plan/TextType.c
@@ -93,8 +93,8 @@ void
TextTermStepper_Write_Key_Frame_IMP(TextTermStepper *self,
OutStream *outstream, Obj *value) {
TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
- uint8_t *buf = Str_Get_Ptr8((String*)value);
- size_t size = Str_Get_Size((String*)value);
+ const char *buf = Str_Get_Ptr8((String*)value);
+ size_t size = Str_Get_Size((String*)value);
OutStream_Write_C32(outstream, size);
OutStream_Write_Bytes(outstream, buf, size);
Obj_Mimic(ivars->value, value);
@@ -107,12 +107,12 @@ void
TextTermStepper_Write_Delta_IMP(TextTermStepper *self, OutStream *outstream,
Obj *value) {
TextTermStepperIVARS *const ivars = TextTermStepper_IVARS(self);
- String *new_value = (String*)CERTIFY(value, STRING);
- CharBuf *last_value = (CharBuf*)ivars->value;
- char *new_text = (char*)Str_Get_Ptr8(new_value);
- size_t new_size = Str_Get_Size(new_value);
- char *last_text = (char*)CB_Get_Ptr8(last_value);
- size_t last_size = CB_Get_Size(last_value);
+ String *new_value = (String*)CERTIFY(value, STRING);
+ CharBuf *last_value = (CharBuf*)ivars->value;
+ const char *new_text = Str_Get_Ptr8(new_value);
+ size_t new_size = Str_Get_Size(new_value);
+ const char *last_text = CB_Get_Ptr8(last_value);
+ size_t last_size = CB_Get_Size(last_value);
// Count how many bytes the strings share at the top.
const int32_t overlap = StrHelp_overlap(last_text, new_text,
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Store/FSDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSDirHandle.c b/core/Lucy/Store/FSDirHandle.c
index 6fcf793..5f1a23f 100644
--- a/core/Lucy/Store/FSDirHandle.c
+++ b/core/Lucy/Store/FSDirHandle.c
@@ -65,10 +65,10 @@ SI_is_updir(const char *name, size_t len) {
FSDirHandle*
FSDH_do_open(FSDirHandle *self, const String *dir) {
- size_t dir_path_size = Str_Get_Size(dir);
- char *dir_path_ptr = (char*)Str_Get_Ptr8(dir);
- char search_string[MAX_PATH + 1];
- char *path_ptr = search_string;
+ size_t dir_path_size = Str_Get_Size(dir);
+ const char *dir_path_ptr = Str_Get_Ptr8(dir);
+ char search_string[MAX_PATH + 1];
+ char *path_ptr = search_string;
DH_init((DirHandle*)self, dir);
FSDirHandleIVARS *const ivars = FSDH_IVARS(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index eb1c54f..cb4d09e 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -289,8 +289,8 @@ S_fullpath_ptr(FSFolder *self, const String *path) {
size_t folder_size = Str_Get_Size(ivars->path);
size_t path_size = Str_Get_Size(path);
size_t full_size = folder_size + 1 + path_size;
- const char *folder_ptr = (char*)Str_Get_Ptr8(ivars->path);
- const char *path_ptr = (char*)Str_Get_Ptr8(path);
+ const char *folder_ptr = Str_Get_Ptr8(ivars->path);
+ const char *path_ptr = Str_Get_Ptr8(path);
char *buf = (char*)MALLOCATE(full_size + 1);
memcpy(buf, folder_ptr, folder_size);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Test/Analysis/TestNormalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestNormalizer.c b/core/Lucy/Test/Analysis/TestNormalizer.c
index b1fea5c..9bea51c 100644
--- a/core/Lucy/Test/Analysis/TestNormalizer.c
+++ b/core/Lucy/Test/Analysis/TestNormalizer.c
@@ -119,7 +119,8 @@ test_utf8proc_normalization(TestBatchRunner *runner) {
// Normalize once.
uint8_t *normalized;
- int32_t check = utf8proc_map(Str_Get_Ptr8(source), Str_Get_Size(source),
+ int32_t check = utf8proc_map((const uint8_t*)Str_Get_Ptr8(source),
+ Str_Get_Size(source),
&normalized,
UTF8PROC_STABLE |
UTF8PROC_COMPOSE |
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Test/Search/TestQueryParserLogic.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserLogic.c b/core/Lucy/Test/Search/TestQueryParserLogic.c
index 6083fac..902c257 100644
--- a/core/Lucy/Test/Search/TestQueryParserLogic.c
+++ b/core/Lucy/Test/Search/TestQueryParserLogic.c
@@ -906,9 +906,9 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(runner, Query_Equals(tree, (Obj*)test_case->tree),
- "tree() OR %s", (char*)Str_Get_Ptr8(test_case->query_string));
+ "tree() OR %s", Str_Get_Ptr8(test_case->query_string));
TEST_INT_EQ(runner, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: OR %s", (char*)Str_Get_Ptr8(test_case->query_string));
+ "hits: OR %s", Str_Get_Ptr8(test_case->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(tree);
@@ -925,9 +925,9 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(runner, Query_Equals(tree, (Obj*)test_case->tree),
- "tree() AND %s", (char*)Str_Get_Ptr8(test_case->query_string));
+ "tree() AND %s", Str_Get_Ptr8(test_case->query_string));
TEST_INT_EQ(runner, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: AND %s", (char*)Str_Get_Ptr8(test_case->query_string));
+ "hits: AND %s", Str_Get_Ptr8(test_case->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(tree);
@@ -949,11 +949,11 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
Hits *hits;
TEST_TRUE(runner, Query_Equals(pruned, (Obj*)wanted),
- "prune() %s", (char*)Str_Get_Ptr8(qstring));
+ "prune() %s", Str_Get_Ptr8(qstring));
expanded = QParser_Expand(or_parser, pruned);
hits = IxSearcher_Hits(searcher, (Obj*)expanded, 0, 10, NULL);
TEST_INT_EQ(runner, Hits_Total_Hits(hits), test_case->num_hits,
- "hits: %s", (char*)Str_Get_Ptr8(qstring));
+ "hits: %s", Str_Get_Ptr8(qstring));
DECREF(hits);
DECREF(expanded);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Test/Search/TestQueryParserSyntax.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserSyntax.c b/core/Lucy/Test/Search/TestQueryParserSyntax.c
index 6a074b3..fde587d 100644
--- a/core/Lucy/Test/Search/TestQueryParserSyntax.c
+++ b/core/Lucy/Test/Search/TestQueryParserSyntax.c
@@ -405,11 +405,11 @@ test_query_parser_syntax(TestBatchRunner *runner) {
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(runner, Query_Equals(tree, (Obj*)ivars->tree),
- "tree() %s", (char*)Str_Get_Ptr8(ivars->query_string));
+ "tree() %s", Str_Get_Ptr8(ivars->query_string));
TEST_TRUE(runner, Query_Equals(expanded, (Obj*)ivars->expanded),
- "expand_leaf() %s", (char*)Str_Get_Ptr8(ivars->query_string));
+ "expand_leaf() %s", Str_Get_Ptr8(ivars->query_string));
TEST_INT_EQ(runner, Hits_Total_Hits(hits), ivars->num_hits,
- "hits: %s", (char*)Str_Get_Ptr8(ivars->query_string));
+ "hits: %s", Str_Get_Ptr8(ivars->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(expanded);
@@ -426,9 +426,9 @@ test_query_parser_syntax(TestBatchRunner *runner) {
Hits *hits = IxSearcher_Hits(searcher, (Obj*)parsed, 0, 10, NULL);
TEST_TRUE(runner, Query_Equals(tree, (Obj*)ivars->tree),
- "tree() %s", (char*)Str_Get_Ptr8(ivars->query_string));
+ "tree() %s", Str_Get_Ptr8(ivars->query_string));
TEST_INT_EQ(runner, Hits_Total_Hits(hits), ivars->num_hits,
- "hits: %s", (char*)Str_Get_Ptr8(ivars->query_string));
+ "hits: %s", Str_Get_Ptr8(ivars->query_string));
DECREF(hits);
DECREF(parsed);
DECREF(tree);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Test/Store/TestFSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFileHandle.c b/core/Lucy/Test/Store/TestFSFileHandle.c
index d9faa32..f1f78fb 100644
--- a/core/Lucy/Test/Store/TestFSFileHandle.c
+++ b/core/Lucy/Test/Store/TestFSFileHandle.c
@@ -44,7 +44,7 @@ test_open(TestBatchRunner *runner) {
FSFileHandle *fh;
String *test_filename = (String*)SSTR_WRAP_STR("_fstest", 7);
- remove((char*)Str_Get_Ptr8(test_filename));
+ remove(Str_Get_Ptr8(test_filename));
Err_set_error(NULL);
fh = FSFH_open(test_filename, FH_READ_ONLY);
@@ -98,7 +98,7 @@ test_open(TestBatchRunner *runner) {
"open() read only -- no errors");
DECREF(fh);
- remove((char*)Str_Get_Ptr8(test_filename));
+ remove(Str_Get_Ptr8(test_filename));
}
static void
@@ -110,7 +110,7 @@ test_Read_Write(TestBatchRunner *runner) {
char *buf = buffer;
String *test_filename = (String*)SSTR_WRAP_STR("_fstest", 7);
- remove((char*)Str_Get_Ptr8(test_filename));
+ remove(Str_Get_Ptr8(test_filename));
fh = FSFH_open(test_filename,
FH_CREATE | FH_WRITE_ONLY | FH_EXCLUSIVE);
@@ -157,7 +157,7 @@ test_Read_Write(TestBatchRunner *runner) {
"Writing to a read-only handle sets error");
DECREF(fh);
- remove((char*)Str_Get_Ptr8(test_filename));
+ remove(Str_Get_Ptr8(test_filename));
}
static void
@@ -165,7 +165,7 @@ test_Close(TestBatchRunner *runner) {
String *test_filename = (String*)SSTR_WRAP_STR("_fstest", 7);
FSFileHandle *fh;
- remove((char*)Str_Get_Ptr8(test_filename));
+ remove(Str_Get_Ptr8(test_filename));
fh = FSFH_open(test_filename,
FH_CREATE | FH_WRITE_ONLY | FH_EXCLUSIVE);
TEST_TRUE(runner, FSFH_Close(fh), "Close returns true for write-only");
@@ -173,7 +173,7 @@ test_Close(TestBatchRunner *runner) {
// Simulate an OS error when closing the file descriptor. This
// approximates what would happen if, say, we run out of disk space.
- remove((char*)Str_Get_Ptr8(test_filename));
+ remove(Str_Get_Ptr8(test_filename));
fh = FSFH_open(test_filename,
FH_CREATE | FH_WRITE_ONLY | FH_EXCLUSIVE);
#ifdef _MSC_VER
@@ -195,7 +195,7 @@ test_Close(TestBatchRunner *runner) {
TEST_TRUE(runner, FSFH_Close(fh), "Close returns true for read-only");
DECREF(fh);
- remove((char*)Str_Get_Ptr8(test_filename));
+ remove(Str_Get_Ptr8(test_filename));
}
static void
@@ -206,7 +206,7 @@ test_Window(TestBatchRunner *runner) {
FileWindowIVARS *const window_ivars = FileWindow_IVARS(window);
uint32_t i;
- remove((char*)Str_Get_Ptr8(test_filename));
+ remove(Str_Get_Ptr8(test_filename));
fh = FSFH_open(test_filename,
FH_CREATE | FH_WRITE_ONLY | FH_EXCLUSIVE);
for (i = 0; i < 1024; i++) {
@@ -245,7 +245,7 @@ test_Window(TestBatchRunner *runner) {
DECREF(window);
DECREF(fh);
- remove((char*)Str_Get_Ptr8(test_filename));
+ remove(Str_Get_Ptr8(test_filename));
}
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c
index 6da1d7f..38576a6 100644
--- a/core/Lucy/Test/TestUtils.c
+++ b/core/Lucy/Test/TestUtils.c
@@ -131,7 +131,7 @@ void
TestUtils_test_analyzer(TestBatchRunner *runner, Analyzer *analyzer,
String *source, VArray *expected,
const char *message) {
- Token *seed = Token_new((char*)Str_Get_Ptr8(source), Str_Get_Size(source),
+ Token *seed = Token_new(Str_Get_Ptr8(source), Str_Get_Size(source),
0, 0, 1.0f, 1);
Inversion *starter = Inversion_new(seed);
Inversion *transformed = Analyzer_Transform(analyzer, starter);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Util/Freezer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c
index 521ea03..5452728 100644
--- a/core/Lucy/Util/Freezer.c
+++ b/core/Lucy/Util/Freezer.c
@@ -204,8 +204,8 @@ Freezer_deserialize(Obj *obj, InStream *instream) {
void
Freezer_serialize_string(String *string, OutStream *outstream) {
- size_t size = Str_Get_Size(string);
- uint8_t *buf = Str_Get_Ptr8(string);
+ size_t size = Str_Get_Size(string);
+ const char *buf = Str_Get_Ptr8(string);
OutStream_Write_C64(outstream, size);
OutStream_Write_Bytes(outstream, buf, size);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index c564c55..5fedf1e 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -46,31 +46,32 @@ S_to_json(Obj *dump, CharBuf *buf, int32_t depth);
// Parse JSON from raw UTF-8 in memory.
static Obj*
-S_parse_json(char *text, size_t size);
+S_parse_json(const char *text, size_t size);
static Obj*
-S_do_parse_json(void *json_parser, char *json, size_t len);
+S_do_parse_json(void *json_parser, const char *json, size_t len);
// Parse a JSON number. Advance the text buffer just past the number.
static Float64*
-S_parse_number(char **json_ptr, char *const limit);
+S_parse_number(const char **json_ptr, const char *limit);
// Parse a JSON string. Advance the text buffer from pointing at the opening
// double quote to pointing just after the closing double quote.
static String*
-S_parse_string(char **json_ptr, char *const limit);
+S_parse_string(const char **json_ptr, const char *limit);
// Unescape JSON string text. Expects pointers bookending the text data (i.e.
// pointing just after the opening double quote and directly at the closing
// double quote), and assumes that escapes have already been sanity checked
// for length.
static String*
-S_unescape_text(char *const top, char *const end);
+S_unescape_text(const char *top, const char *end);
// Check that the supplied text begins with the specified keyword, which must
// then end on a word boundary (i.e. match "null" but not the first four
// letters of "nullify").
static CFISH_INLINE bool
-SI_check_keyword(char *json, char* end, const char *keyword, size_t len);
+SI_check_keyword(const char *json, const char* end, const char *keyword,
+ size_t len);
// Make it possible to be loosen constraints during testing.
static bool tolerant = false;
@@ -85,14 +86,14 @@ S_cat_whitespace(CharBuf *buf, int32_t depth);
// Set Err_error, appending escaped JSON in the vicinity of the error.
static void
-S_set_error(CharBuf *buf, char *json, char *limit, int line,
+S_set_error(CharBuf *buf, const char *json, const char *limit, int line,
const char *func);
#define SET_ERROR(_mess, _json, _end) \
S_set_error(_mess, _json, _end, __LINE__, CFISH_ERR_FUNC_MACRO)
Obj*
Json_from_json(String *json) {
- Obj *dump = S_parse_json((char*)Str_Get_Ptr8(json), Str_Get_Size(json));
+ Obj *dump = S_parse_json(Str_Get_Ptr8(json), Str_Get_Size(json));
if (!dump) {
ERR_ADD_FRAME(Err_get_error());
}
@@ -372,7 +373,7 @@ S_to_json(Obj *dump, CharBuf *buf, int32_t depth) {
}
static Obj*
-S_parse_json(char *text, size_t size) {
+S_parse_json(const char *text, size_t size) {
void *json_parser = LucyParseJsonAlloc(Memory_wrapped_malloc);
if (json_parser == NULL) {
String *mess = MAKE_MESS("Failed to allocate JSON parser");
@@ -385,17 +386,17 @@ S_parse_json(char *text, size_t size) {
}
static Obj*
-S_do_parse_json(void *json_parser, char *json, size_t len) {
+S_do_parse_json(void *json_parser, const char *json, size_t len) {
lucy_JsonParserState state;
state.result = NULL;
state.errors = false;
- char *text = json;
- char *const end = text + len;
+ const char *text = json;
+ const char *const end = text + len;
while (text < end) {
int token_type = -1;
Obj *value = NULL;
- char *const save = text;
+ const char *const save = text;
switch (*text) {
case ' ': case '\n': case '\r': case '\t':
// Skip insignificant whitespace, which the JSON RFC defines
@@ -491,9 +492,9 @@ S_do_parse_json(void *json_parser, char *json, size_t len) {
}
static Float64*
-S_parse_number(char **json_ptr, char *const limit) {
- char *top = *json_ptr;
- char *end = top;
+S_parse_number(const char **json_ptr, const char *limit) {
+ const char *top = *json_ptr;
+ const char *end = top;
bool terminated = false;
// We can't assume NULL termination for the JSON string, so we need to
@@ -529,12 +530,12 @@ S_parse_number(char **json_ptr, char *const limit) {
}
static String*
-S_parse_string(char **json_ptr, char *const limit) {
+S_parse_string(const char **json_ptr, const char *limit) {
// Find terminating double quote, determine whether there are any escapes.
- char *top = *json_ptr + 1;
- char *end = NULL;
+ const char *top = *json_ptr + 1;
+ const char *end = NULL;
bool saw_backslash = false;
- for (char *text = top; text < limit; text++) {
+ for (const char *text = top; text < limit; text++) {
if (*text == '"') {
end = text;
break;
@@ -573,7 +574,7 @@ S_parse_string(char **json_ptr, char *const limit) {
}
static String*
-S_unescape_text(char *const top, char *const end) {
+S_unescape_text(const char *top, const char *end) {
// The unescaped string will never be longer than the escaped string
// because only a \u escape can theoretically be too long and
// StrHelp_encode_utf8_char guards against sequences over 4 bytes.
@@ -581,7 +582,7 @@ S_unescape_text(char *const top, char *const end) {
size_t cap = end - top + 1;
char *target_buf = (char*)MALLOCATE(cap);
size_t target_size = 0;
- for (char *text = top; text < end; text++) {
+ for (const char *text = top; text < end; text++) {
if (*text != '\\') {
target_buf[target_size++] = *text;
}
@@ -657,7 +658,8 @@ S_unescape_text(char *const top, char *const end) {
}
static CFISH_INLINE bool
-SI_check_keyword(char *json, char* end, const char *keyword, size_t len) {
+SI_check_keyword(const char *json, const char* end, const char *keyword,
+ size_t len) {
if ((size_t)(end - json) > len
&& strncmp(json, keyword, len) == 0
&& json[len] != '_'
@@ -669,7 +671,7 @@ SI_check_keyword(char *json, char* end, const char *keyword, size_t len) {
}
static void
-S_set_error(CharBuf *buf, char *json, char *limit, int line,
+S_set_error(CharBuf *buf, const char *json, const char *limit, int line,
const char *func) {
if (func) {
CB_catf(buf, " at %s %s line %i32 near ", func, __FILE__,
http://git-wip-us.apache.org/repos/asf/lucy/blob/c120b678/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index 1d6723a..f31eca3 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -54,8 +54,8 @@ LUCY_Doc_Get_Size_IMP(lucy_Doc *self) {
void
LUCY_Doc_Store_IMP(lucy_Doc *self, const cfish_String *field, cfish_Obj *value) {
lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self);
- char *key = (char*)CFISH_Str_Get_Ptr8(field);
- size_t key_size = CFISH_Str_Get_Size(field);
+ const char *key = CFISH_Str_Get_Ptr8(field);
+ size_t key_size = CFISH_Str_Get_Size(field);
SV *key_sv = newSVpvn(key, key_size);
SV *val_sv = value == NULL
? newSV(0)
@@ -146,7 +146,7 @@ cfish_Obj*
LUCY_Doc_Extract_IMP(lucy_Doc *self, cfish_String *field) {
lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self);
cfish_Obj *retval = NULL;
- SV **sv_ptr = hv_fetch((HV*)ivars->fields, (char*)CFISH_Str_Get_Ptr8(field),
+ SV **sv_ptr = hv_fetch((HV*)ivars->fields, CFISH_Str_Get_Ptr8(field),
CFISH_Str_Get_Size(field), 0);
if (sv_ptr && XSBind_sv_defined(*sv_ptr)) {
[lucy-commits] [15/50] [abbrv] Rename _UTF8 and _Str to _Utf8
Posted by nw...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/core/LucyX/Search/ProximityQuery.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.c b/core/LucyX/Search/ProximityQuery.c
index 903995a..ee76917 100644
--- a/core/LucyX/Search/ProximityQuery.c
+++ b/core/LucyX/Search/ProximityQuery.c
@@ -104,10 +104,10 @@ ProximityQuery_Dump_IMP(ProximityQuery *self) {
ProximityQuery_Dump_t super_dump
= SUPER_METHOD_PTR(PROXIMITYQUERY, LUCY_ProximityQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
- Hash_Store_Str(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
- Hash_Store_Str(dump, "terms", 5, Freezer_dump((Obj*)ivars->terms));
- Hash_Store_Str(dump, "within", 6,
- (Obj*)Str_newf("%i64", (int64_t)ivars->within));
+ Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
+ Hash_Store_Utf8(dump, "terms", 5, Freezer_dump((Obj*)ivars->terms));
+ Hash_Store_Utf8(dump, "within", 6,
+ (Obj*)Str_newf("%i64", (int64_t)ivars->within));
return (Obj*)dump;
}
@@ -118,11 +118,11 @@ ProximityQuery_Load_IMP(ProximityQuery *self, Obj *dump) {
= SUPER_METHOD_PTR(PROXIMITYQUERY, LUCY_ProximityQuery_Load);
ProximityQuery *loaded = (ProximityQuery*)super_load(self, dump);
ProximityQueryIVARS *loaded_ivars = ProximityQuery_IVARS(loaded);
- Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+ Obj *field = CERTIFY(Hash_Fetch_Utf8(source, "field", 5), OBJ);
loaded_ivars->field = (String*)CERTIFY(Freezer_load(field), STRING);
- Obj *terms = CERTIFY(Hash_Fetch_Str(source, "terms", 5), OBJ);
+ Obj *terms = CERTIFY(Hash_Fetch_Utf8(source, "terms", 5), OBJ);
loaded_ivars->terms = (VArray*)CERTIFY(Freezer_load(terms), VARRAY);
- Obj *within = CERTIFY(Hash_Fetch_Str(source, "within", 6), OBJ);
+ Obj *within = CERTIFY(Hash_Fetch_Utf8(source, "within", 6), OBJ);
loaded_ivars->within = (uint32_t)Obj_To_I64(within);
return (Obj*)loaded;
}
@@ -151,17 +151,17 @@ ProximityQuery_To_String_IMP(ProximityQuery *self) {
ProximityQueryIVARS *const ivars = ProximityQuery_IVARS(self);
uint32_t num_terms = VA_Get_Size(ivars->terms);
CharBuf *buf = CB_new_from_str(ivars->field);
- CB_Cat_Trusted_UTF8(buf, ":\"", 2);
+ CB_Cat_Trusted_Utf8(buf, ":\"", 2);
for (uint32_t i = 0; i < num_terms; i++) {
Obj *term = VA_Fetch(ivars->terms, i);
String *term_string = Obj_To_String(term);
CB_Cat(buf, term_string);
DECREF(term_string);
if (i < num_terms - 1) {
- CB_Cat_Trusted_UTF8(buf, " ", 1);
+ CB_Cat_Trusted_Utf8(buf, " ", 1);
}
}
- CB_Cat_Trusted_UTF8(buf, "\"", 1);
+ CB_Cat_Trusted_Utf8(buf, "\"", 1);
CB_catf(buf, "~%u32", ivars->within);
String *retval = CB_Yield_String(buf);
DECREF(buf);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/perl/xs/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c
index cba3ab0..59baf40 100644
--- a/perl/xs/Lucy/Analysis/RegexTokenizer.c
+++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c
@@ -45,8 +45,8 @@ lucy_RegexTokenizer_init(lucy_RegexTokenizer *self,
lucy_RegexTokenizerIVARS *const ivars = lucy_RegexTokenizer_IVARS(self);
#define DEFAULT_PATTERN "\\w+(?:['\\x{2019}]\\w+)*"
if (pattern) {
- if (CFISH_Str_Find_Str(pattern, "\\p", 2) != -1
- || CFISH_Str_Find_Str(pattern, "\\P", 2) != -1
+ if (CFISH_Str_Find_Utf8(pattern, "\\p", 2) != -1
+ || CFISH_Str_Find_Utf8(pattern, "\\P", 2) != -1
) {
CFISH_DECREF(self);
THROW(CFISH_ERR, "\\p and \\P constructs forbidden");
@@ -137,9 +137,9 @@ LUCY_RegexTokenizer_Destroy_IMP(lucy_RegexTokenizer *self) {
}
void
-LUCY_RegexTokenizer_Tokenize_Str_IMP(lucy_RegexTokenizer *self,
- const char *string, size_t string_len,
- lucy_Inversion *inversion) {
+LUCY_RegexTokenizer_Tokenize_Utf8_IMP(lucy_RegexTokenizer *self,
+ const char *string, size_t string_len,
+ lucy_Inversion *inversion) {
lucy_RegexTokenizerIVARS *const ivars = lucy_RegexTokenizer_IVARS(self);
uint32_t num_code_points = 0;
SV *wrapper = sv_newmortal();
http://git-wip-us.apache.org/repos/asf/lucy/blob/c3ccd8cd/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index 224f0bb..1d6723a 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -178,12 +178,12 @@ cfish_Hash*
LUCY_Doc_Dump_IMP(lucy_Doc *self) {
lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self);
cfish_Hash *dump = cfish_Hash_new(0);
- CFISH_Hash_Store_Str(dump, "_class", 6,
- (cfish_Obj*)CFISH_Str_Clone(LUCY_Doc_Get_Class_Name(self)));
- CFISH_Hash_Store_Str(dump, "doc_id", 7,
- (cfish_Obj*)cfish_Str_newf("%i32", ivars->doc_id));
- CFISH_Hash_Store_Str(dump, "fields", 6,
- XSBind_perl_to_cfish((SV*)ivars->fields));
+ CFISH_Hash_Store_Utf8(dump, "_class", 6,
+ (cfish_Obj*)CFISH_Str_Clone(LUCY_Doc_Get_Class_Name(self)));
+ CFISH_Hash_Store_Utf8(dump, "doc_id", 7,
+ (cfish_Obj*)cfish_Str_newf("%i32", ivars->doc_id));
+ CFISH_Hash_Store_Utf8(dump, "fields", 6,
+ XSBind_perl_to_cfish((SV*)ivars->fields));
return dump;
}
@@ -191,15 +191,15 @@ lucy_Doc*
LUCY_Doc_Load_IMP(lucy_Doc *self, cfish_Obj *dump) {
cfish_Hash *source = (cfish_Hash*)CFISH_CERTIFY(dump, CFISH_HASH);
cfish_String *class_name = (cfish_String*)CFISH_CERTIFY(
- CFISH_Hash_Fetch_Str(source, "_class", 6),
+ CFISH_Hash_Fetch_Utf8(source, "_class", 6),
CFISH_STRING);
cfish_VTable *vtable = cfish_VTable_singleton(class_name, NULL);
lucy_Doc *loaded = (lucy_Doc*)CFISH_VTable_Make_Obj(vtable);
cfish_Obj *doc_id = CFISH_CERTIFY(
- CFISH_Hash_Fetch_Str(source, "doc_id", 7),
+ CFISH_Hash_Fetch_Utf8(source, "doc_id", 7),
CFISH_OBJ);
cfish_Hash *fields = (cfish_Hash*)CFISH_CERTIFY(
- CFISH_Hash_Fetch_Str(source, "fields", 6),
+ CFISH_Hash_Fetch_Utf8(source, "fields", 6),
CFISH_HASH);
SV *fields_sv = XSBind_cfish_to_perl((cfish_Obj*)fields);
CHY_UNUSED_VAR(self);
[lucy-commits] [31/50] [abbrv] git commit: refs/heads/master - Make StrIter_Next and
StrIter_Prev return an int32_t
Posted by nw...@apache.org.
Make StrIter_Next and StrIter_Prev return an int32_t
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/9355ca33
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/9355ca33
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/9355ca33
Branch: refs/heads/master
Commit: 9355ca33e0b5464cdb2811a2c32007cfa35bf6a0
Parents: 3e07444
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 23 14:55:48 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:18 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 36 ++++++++++----------
clownfish/runtime/core/Clownfish/String.cfh | 6 ++--
.../runtime/core/Clownfish/Test/TestString.c | 4 +--
clownfish/runtime/core/Clownfish/VTable.c | 2 +-
core/Lucy/Highlight/Highlighter.c | 8 ++---
core/Lucy/Index/Segment.c | 2 +-
core/Lucy/Search/QueryParser.c | 4 +--
core/Lucy/Search/QueryParser/QueryLexer.c | 12 +++----
core/Lucy/Store/Folder.c | 2 +-
core/Lucy/Store/Lock.c | 2 +-
core/Lucy/Store/SharedLock.c | 2 +-
core/Lucy/Util/IndexFileNames.c | 4 +--
core/Lucy/Util/Json.c | 2 +-
13 files changed, 43 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index ab4d34e..28f27e6 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -204,7 +204,7 @@ Str_Hash_Sum_IMP(String *self) {
const StrIter_Next_t next
= METHOD_PTR(STRINGITERATOR, CFISH_StrIter_Next);
- uint32_t code_point;
+ int32_t code_point;
while (STRITER_DONE != (code_point = next((StringIterator*)iter))) {
hashvalue = ((hashvalue << 5) + hashvalue) ^ code_point;
}
@@ -231,7 +231,7 @@ String*
Str_Swap_Chars_IMP(String *self, uint32_t match, uint32_t replacement) {
CharBuf *charbuf = CB_new(self->size);
StackStringIterator *iter = STR_STACKTOP(self);
- uint32_t code_point;
+ int32_t code_point;
while (STRITER_DONE != (code_point = SStrIter_Next(iter))) {
if (code_point == match) { code_point = replacement; }
@@ -253,7 +253,7 @@ Str_BaseX_To_I64_IMP(String *self, uint32_t base) {
StackStringIterator *iter = STR_STACKTOP(self);
int64_t retval = 0;
bool is_negative = false;
- uint32_t code_point = SStrIter_Next(iter);
+ int32_t code_point = SStrIter_Next(iter);
// Advance past minus sign.
if (code_point == '-') {
@@ -455,7 +455,7 @@ uint32_t
Str_Code_Point_At_IMP(String *self, size_t tick) {
StackStringIterator *iter = STR_STACKTOP(self);
SStrIter_Advance(iter, tick);
- uint32_t code_point = SStrIter_Next(iter);
+ int32_t code_point = SStrIter_Next(iter);
return code_point == STRITER_DONE ? 0 : code_point;
}
@@ -464,7 +464,7 @@ Str_Code_Point_From_IMP(String *self, size_t tick) {
if (tick == 0) { return 0; }
StackStringIterator *iter = STR_STACKTAIL(self);
SStrIter_Recede(iter, tick - 1);
- uint32_t code_point = SStrIter_Prev(iter);
+ int32_t code_point = SStrIter_Prev(iter);
return code_point == STRITER_DONE ? 0 : code_point;
}
@@ -677,7 +677,7 @@ StrIter_Has_Prev_IMP(StringIterator *self) {
return self->byte_offset != 0;
}
-uint32_t
+int32_t
StrIter_Next_IMP(StringIterator *self) {
String *string = self->string;
size_t byte_offset = self->byte_offset;
@@ -686,7 +686,7 @@ StrIter_Next_IMP(StringIterator *self) {
if (byte_offset >= size) { return STRITER_DONE; }
const uint8_t *const ptr = (const uint8_t*)string->ptr;
- uint32_t retval = ptr[byte_offset++];
+ int32_t retval = ptr[byte_offset++];
if (retval >= 0x80) {
/*
@@ -713,7 +713,7 @@ StrIter_Next_IMP(StringIterator *self) {
* is tested. After the second iteration, the fourth, and so on.
*/
- uint32_t mask = 1 << 6;
+ int32_t mask = 1 << 6;
do {
if (byte_offset >= size) {
@@ -731,14 +731,14 @@ StrIter_Next_IMP(StringIterator *self) {
return retval;
}
-uint32_t
+int32_t
StrIter_Prev_IMP(StringIterator *self) {
size_t byte_offset = self->byte_offset;
if (byte_offset == 0) { return STRITER_DONE; }
const uint8_t *const ptr = (const uint8_t*)self->string->ptr;
- uint32_t retval = ptr[--byte_offset];
+ int32_t retval = ptr[--byte_offset];
if (retval >= 0x80) {
// Construct the result from right to left.
@@ -749,8 +749,8 @@ StrIter_Prev_IMP(StringIterator *self) {
retval &= 0x3F;
int shift = 6;
- uint32_t first_byte_mask = 0x1F;
- uint32_t byte = ptr[--byte_offset];
+ int32_t first_byte_mask = 0x1F;
+ int32_t byte = ptr[--byte_offset];
while ((byte & 0xC0) == 0x80) {
if (byte_offset == 0) {
@@ -822,9 +822,9 @@ StrIter_Recede_IMP(StringIterator *self, size_t num) {
size_t
StrIter_Skip_Next_Whitespace_IMP(StringIterator *self) {
- size_t num_skipped = 0;
- size_t byte_offset = self->byte_offset;
- uint32_t code_point;
+ size_t num_skipped = 0;
+ size_t byte_offset = self->byte_offset;
+ int32_t code_point;
while (STRITER_DONE != (code_point = StrIter_Next(self))) {
if (!StrHelp_is_whitespace(code_point)) { break; }
@@ -838,9 +838,9 @@ StrIter_Skip_Next_Whitespace_IMP(StringIterator *self) {
size_t
StrIter_Skip_Prev_Whitespace_IMP(StringIterator *self) {
- size_t num_skipped = 0;
- size_t byte_offset = self->byte_offset;
- uint32_t code_point;
+ size_t num_skipped = 0;
+ size_t byte_offset = self->byte_offset;
+ int32_t code_point;
while (STRITER_DONE != (code_point = StrIter_Prev(self))) {
if (!StrHelp_is_whitespace(code_point)) { break; }
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index e060aa5..1151589 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -350,13 +350,13 @@ class Clownfish::StringIterator cnick StrIter
/** Return the code point after the current position and advance the
* iterator. Return CFISH_STRITER_DONE at the end of the string.
*/
- public uint32_t
+ public int32_t
Next(StringIterator *self);
/** Return the code point before the current position and go one step back.
* Return CFISH_STRITER_DONE at the start of the string.
*/
- public uint32_t
+ public int32_t
Prev(StringIterator *self);
/** Skip code points.
@@ -436,7 +436,7 @@ __C__
#define CFISH_SSTR_WRAP_STR(ptr, size) \
cfish_SStr_wrap_str(cfish_alloca(cfish_SStr_size()), ptr, size)
-#define CFISH_STRITER_DONE UINT32_MAX
+#define CFISH_STRITER_DONE -1
#ifdef CFISH_USE_SHORT_NAMES
#define SSTR_BLANK CFISH_SSTR_BLANK
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/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 851ff81..652c8e9 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestString.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestString.c
@@ -362,7 +362,7 @@ test_iterator(TestBatchRunner *runner) {
for (int i = 0; i < num_code_points; ++i) {
TEST_TRUE(runner, StrIter_Has_Next(iter), "Has_Next %d", i);
- uint32_t code_point = StrIter_Next(iter);
+ int32_t code_point = StrIter_Next(iter);
TEST_INT_EQ(runner, code_point, code_points[i], "Next %d", i);
}
@@ -383,7 +383,7 @@ test_iterator(TestBatchRunner *runner) {
for (int i = num_code_points - 1; i >= 0; --i) {
TEST_TRUE(runner, StrIter_Has_Prev(iter), "Has_Prev %d", i);
- uint32_t code_point = StrIter_Prev(iter);
+ int32_t code_point = StrIter_Prev(iter);
TEST_INT_EQ(runner, code_point, code_points[i], "Prev %d", i);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/clownfish/runtime/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VTable.c b/clownfish/runtime/core/Clownfish/VTable.c
index c2bfde8..6596018 100644
--- a/clownfish/runtime/core/Clownfish/VTable.c
+++ b/clownfish/runtime/core/Clownfish/VTable.c
@@ -329,7 +329,7 @@ static String*
S_scrunch_string(String *source) {
CharBuf *buf = CB_new(Str_Get_Size(source));
StringIterator *iter = Str_Top(source);
- uint32_t code_point;
+ int32_t code_point;
while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
if (code_point > 127) {
THROW(ERR, "Can't fold case for %o", source);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index 2d55639..b181115 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -224,7 +224,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip,
StringIterator *iter = StrIter_Clone(top);
while (true) {
- uint32_t code_point = StrIter_Prev(iter);
+ int32_t code_point = StrIter_Prev(iter);
if (code_point == STRITER_DONE || code_point == '.') {
// Skip remaining whitespace.
@@ -249,7 +249,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip,
StrIter_Assign(iter, top);
for (uint32_t i = 0; i < max_skip; ++i) {
- uint32_t code_point = StrIter_Next(iter);
+ int32_t code_point = StrIter_Next(iter);
if (code_point == STRITER_DONE || code_point == '.') {
found_edge = true;
@@ -286,7 +286,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip,
bool
S_find_ending_boundary(StringIterator *tail, uint32_t max_skip,
uint32_t *num_skipped_ptr) {
- uint32_t code_point;
+ int32_t code_point;
// Check if we're at an ending boundary already. Don't check for a word
// boundary because we need space for a trailing ellipsis.
@@ -587,7 +587,7 @@ S_encode_entities(String *text, CharBuf *buf) {
const int MAX_ENTITY_BYTES = 9; // &#dddddd;
// Scan first so that we only allocate once.
- uint32_t code_point;
+ int32_t code_point;
while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
if (code_point > 127
|| (!isgraph(code_point) && !isspace(code_point))
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/core/Lucy/Index/Segment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c
index 21a3f66..50b4e8a 100644
--- a/core/Lucy/Index/Segment.c
+++ b/core/Lucy/Index/Segment.c
@@ -68,7 +68,7 @@ Seg_valid_seg_name(const String *name) {
if (Str_Starts_With_Utf8(name, "seg_", 4)) {
StringIterator *iter = Str_Top(name);
StrIter_Advance(iter, 4);
- uint32_t code_point;
+ int32_t code_point;
while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
if (!isalnum(code_point)) {
DECREF(iter);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/core/Lucy/Search/QueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c
index 037d6b1..4d4c86d 100644
--- a/core/Lucy/Search/QueryParser.c
+++ b/core/Lucy/Search/QueryParser.c
@@ -827,7 +827,7 @@ QParser_Expand_IMP(QueryParser *self, Query *query) {
static String*
S_unescape(QueryParser *self, String *orig, CharBuf *buf) {
StringIterator *iter = Str_Top(orig);
- uint32_t code_point;
+ int32_t code_point;
UNUSED_VAR(self);
CB_Set_Size(buf, 0);
@@ -835,7 +835,7 @@ S_unescape(QueryParser *self, String *orig, CharBuf *buf) {
while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
if (code_point == '\\') {
- uint32_t next_code_point = StrIter_Next(iter);
+ int32_t next_code_point = StrIter_Next(iter);
if (next_code_point == ':'
|| next_code_point == '"'
|| next_code_point == '\\'
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/core/Lucy/Search/QueryParser/QueryLexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.c b/core/Lucy/Search/QueryParser/QueryLexer.c
index de9e66f..1f819d6 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.c
+++ b/core/Lucy/Search/QueryParser/QueryLexer.c
@@ -94,7 +94,7 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, const String *query_string) {
}
}
- uint32_t code_point = StrIter_Next(iter);
+ int32_t code_point = StrIter_Next(iter);
switch (code_point) {
case '(':
elem = ParserElem_new(TOKEN_OPEN_PAREN, NULL);
@@ -168,7 +168,7 @@ S_consume_keyword(StringIterator *iter, const char *keyword,
}
StringIterator *temp = StrIter_Clone(iter);
StrIter_Advance(temp, keyword_len);
- uint32_t lookahead = StrIter_Next(temp);
+ int32_t lookahead = StrIter_Next(temp);
if (lookahead == STRITER_DONE) {
DECREF(temp);
return NULL;
@@ -194,7 +194,7 @@ S_consume_field(StringIterator *iter) {
StringIterator *temp = StrIter_Clone(iter);
// Field names constructs must start with a letter or underscore.
- uint32_t code_point = StrIter_Next(temp);
+ int32_t code_point = StrIter_Next(temp);
if (code_point == STRITER_DONE) {
DECREF(temp);
return NULL;
@@ -217,7 +217,7 @@ S_consume_field(StringIterator *iter) {
}
// Field name constructs must be followed by something sensible.
- uint32_t lookahead = StrIter_Next(temp);
+ int32_t lookahead = StrIter_Next(temp);
if (lookahead == STRITER_DONE) {
DECREF(temp);
return NULL;
@@ -247,7 +247,7 @@ S_consume_text(StringIterator *iter) {
StringIterator *temp = StrIter_Clone(iter);
while (1) {
- uint32_t code_point = StrIter_Next(temp);
+ int32_t code_point = StrIter_Next(temp);
if (code_point == '\\') {
code_point = StrIter_Next(temp);
if (code_point == STRITER_DONE) {
@@ -282,7 +282,7 @@ S_consume_quoted_string(StringIterator *iter) {
}
while (1) {
- uint32_t code_point = StrIter_Next(temp);
+ int32_t code_point = StrIter_Next(temp);
if (code_point == STRITER_DONE || code_point == '"') {
break;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index c45169f..935c794 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -431,7 +431,7 @@ Folder_Consolidate_IMP(Folder *self, const String *path) {
static Folder*
S_enclosing_folder(Folder *self, StringIterator *path) {
- uint32_t code_point;
+ int32_t code_point;
// Find first component of the file path.
String *path_component = NULL;
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index fc6efc7..907b16b 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -40,7 +40,7 @@ Lock_init(Lock *self, Folder *folder, const String *name,
THROW(ERR, "Invalid value for 'interval': %i32", interval);
}
StringIterator *iter = Str_Top(name);
- uint32_t code_point;
+ int32_t code_point;
while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
if (isalnum(code_point)
|| code_point == '.'
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/core/Lucy/Store/SharedLock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.c b/core/Lucy/Store/SharedLock.c
index 9d33b7b..f89f6f0 100644
--- a/core/Lucy/Store/SharedLock.c
+++ b/core/Lucy/Store/SharedLock.c
@@ -141,7 +141,7 @@ ShLock_Is_Locked_IMP(SharedLock *self) {
if (Str_Starts_With(entry, ivars->name)) {
StringIterator *iter = Str_Top(entry);
StrIter_Advance(iter, Str_Length(ivars->name));
- uint32_t code_point = StrIter_Next(iter);
+ int32_t code_point = StrIter_Next(iter);
if (code_point == '-') {
code_point = StrIter_Next(iter);
if (code_point != STRITER_DONE && isdigit(code_point)) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/core/Lucy/Util/IndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/IndexFileNames.c b/core/Lucy/Util/IndexFileNames.c
index ee5d237..5d616f2 100644
--- a/core/Lucy/Util/IndexFileNames.c
+++ b/core/Lucy/Util/IndexFileNames.c
@@ -56,7 +56,7 @@ IxFileNames_extract_gen(const String *name) {
// Advance past first underscore. Bail if we run out of string or if we
// encounter a NULL.
while (1) {
- uint32_t code_point = StrIter_Next(iter);
+ int32_t code_point = StrIter_Next(iter);
if (code_point == STRITER_DONE) { return 0; }
else if (code_point == '_') { break; }
}
@@ -72,7 +72,7 @@ IxFileNames_extract_gen(const String *name) {
String*
IxFileNames_local_part(const String *path) {
StringIterator *top = Str_Tail(path);
- uint32_t code_point = StrIter_Prev(top);
+ int32_t code_point = StrIter_Prev(top);
// Trim trailing slash.
while (code_point == '/') {
http://git-wip-us.apache.org/repos/asf/lucy/blob/9355ca33/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index c877b74..9b751ad 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -182,7 +182,7 @@ S_append_json_string(String *dump, CharBuf *buf) {
// Process string data.
StringIterator *iter = Str_Top(dump);
- uint32_t code_point;
+ int32_t code_point;
while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
if (code_point > 127) {
// There is no need to escape any high characters, including those
[lucy-commits] [48/50] [abbrv] git commit: refs/heads/master - Change
String#Swap_Chars parameters to int32_t
Posted by nw...@apache.org.
Change String#Swap_Chars parameters to int32_t
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/d099713f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/d099713f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/d099713f
Branch: refs/heads/master
Commit: d099713f96c82994363defa8ac4186a2ae231900
Parents: a249e55
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Sep 28 19:29:11 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/core/Clownfish/String.c | 2 +-
clownfish/runtime/core/Clownfish/String.cfh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/d099713f/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index ee5b283..6396dc9 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -228,7 +228,7 @@ Str_To_String_IMP(String *self) {
}
String*
-Str_Swap_Chars_IMP(String *self, uint32_t match, uint32_t replacement) {
+Str_Swap_Chars_IMP(String *self, int32_t match, int32_t replacement) {
CharBuf *charbuf = CB_new(self->size);
StackStringIterator *iter = STR_STACKTOP(self);
int32_t code_point;
http://git-wip-us.apache.org/repos/asf/lucy/blob/d099713f/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index 4d18706..ff4047a 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -131,7 +131,7 @@ class Clownfish::String cnick Str
* @return a new String with the characters replaced.
*/
incremented String*
- Swap_Chars(String *self, uint32_t match, uint32_t replacement);
+ Swap_Chars(String *self, int32_t match, int32_t replacement);
public int64_t
To_I64(String *self);