You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/09/01 22:16:50 UTC
[lucy-commits] [02/24] git commit: refs/heads/cfish-string-prep1 - Rename
ZombieCharBuf to StackString (cnick SStr)
Rename ZombieCharBuf to StackString (cnick SStr)
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/a7926f49
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/a7926f49
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/a7926f49
Branch: refs/heads/cfish-string-prep1
Commit: a7926f498a2bc880570348607185b792f95a2f89
Parents: f503d90
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Aug 28 22:25:27 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Aug 28 22:30:43 2013 +0200
----------------------------------------------------------------------
c/src/Lucy/Index/DocReader.c | 4 +-
clownfish/compiler/src/CFCPerl.c | 6 +-
clownfish/compiler/src/CFCPerlSub.c | 2 +-
clownfish/compiler/src/CFCPerlTypeMap.c | 4 +-
clownfish/compiler/src/CFCRuby.c | 2 +-
clownfish/runtime/core/Clownfish/CharBuf.c | 80 ++++++------
clownfish/runtime/core/Clownfish/CharBuf.cfh | 34 ++---
clownfish/runtime/core/Clownfish/Hash.c | 8 +-
.../runtime/core/Clownfish/Test/TestCharBuf.c | 10 +-
.../runtime/core/Clownfish/Test/TestHash.c | 18 +--
clownfish/runtime/core/Clownfish/Test/TestObj.c | 12 +-
.../runtime/core/Clownfish/Test/TestVArray.c | 2 +-
clownfish/runtime/core/Clownfish/VTable.c | 6 +-
.../perl/buildlib/Clownfish/Build/Binding.pm | 4 +-
clownfish/runtime/perl/lib/Clownfish.pm | 4 +-
clownfish/runtime/perl/xs/XSBind.c | 18 +--
clownfish/runtime/perl/xs/XSBind.h | 12 +-
core/Lucy/Highlight/Highlighter.c | 124 +++++++++----------
core/Lucy/Index/FilePurger.c | 2 +-
core/Lucy/Index/IndexManager.c | 16 +--
core/Lucy/Index/PolyReader.c | 2 +-
core/Lucy/Index/Segment.c | 10 +-
core/Lucy/Index/ZombieKeyedHash.c | 4 +-
core/Lucy/Plan/Schema.c | 2 +-
core/Lucy/Search/QueryParser.c | 24 ++--
core/Lucy/Search/QueryParser/QueryLexer.c | 84 ++++++-------
core/Lucy/Store/CompoundFileReader.c | 20 +--
core/Lucy/Store/CompoundFileWriter.c | 12 +-
core/Lucy/Store/FSFolder.c | 6 +-
core/Lucy/Store/Folder.c | 38 +++---
core/Lucy/Store/Lock.c | 16 +--
core/Lucy/Store/RAMFolder.c | 12 +-
core/Lucy/Store/SharedLock.c | 18 +--
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 | 86 ++++++-------
core/Lucy/Test/Index/TestSegment.c | 12 +-
core/Lucy/Test/Index/TestSnapshot.c | 12 +-
core/Lucy/Test/Plan/TestFieldMisc.c | 2 +-
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 | 4 +-
core/Lucy/Test/Store/TestCompoundFileReader.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/TestFolderCommon.c | 2 +-
core/Lucy/Test/Store/TestInStream.c | 4 +-
core/Lucy/Test/Store/TestRAMDirHandle.c | 6 +-
core/Lucy/Test/Store/TestRAMFolder.c | 2 +-
core/Lucy/Test/TestSchema.c | 4 +-
core/Lucy/Test/TestUtils.c | 16 +--
core/Lucy/Test/Util/TestIndexFileNames.c | 36 +++---
core/Lucy/Test/Util/TestJson.c | 8 +-
core/Lucy/Util/IndexFileNames.c | 26 ++--
core/Lucy/Util/IndexFileNames.cfh | 4 +-
core/Lucy/Util/Json.c | 8 +-
perl/buildlib/Lucy/Build/Binding/Misc.pm | 4 +-
perl/xs/Lucy/Index/DocReader.c | 6 +-
perl/xs/Lucy/Index/Inverter.c | 2 +-
65 files changed, 467 insertions(+), 467 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index 4c4eb28..f2c8b98 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -66,8 +66,8 @@ 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.
- ZombieCharBuf *field_name_zcb
- = ZCB_WRAP_STR(field_name, field_name_len);
+ StackString *field_name_zcb
+ = SSTR_WRAP_STR(field_name, field_name_len);
type = Schema_Fetch_Type(schema, (CharBuf*)field_name_zcb);
// Read the field value.
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/clownfish/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerl.c b/clownfish/compiler/src/CFCPerl.c
index 0b58fbf..9868a50 100644
--- a/clownfish/compiler/src/CFCPerl.c
+++ b/clownfish/compiler/src/CFCPerl.c
@@ -241,8 +241,8 @@ S_write_boot_c(CFCPerl *self) {
// There's at least one alias, so include the buffer.
alias_adds
= CFCUtil_cat(alias_adds,
- " cfish_ZombieCharBuf *alias "
- "= CFISH_ZCB_WRAP_STR(\"\", 0);\n",
+ " cfish_StackString *alias "
+ "= CFISH_SStr_WRAP_STR(\"\", 0);\n",
NULL);
has_aliases = 1;
}
@@ -251,7 +251,7 @@ S_write_boot_c(CFCPerl *self) {
size_t alias_len = strlen(alias);
const char pattern[] =
"%s"
- " CFISH_ZCB_Assign_Str(alias, \"%s\", %u);\n"
+ " CFISH_SStr_Assign_Str(alias, \"%s\", %u);\n"
" cfish_VTable_add_alias_to_registry(%s,\n"
" (cfish_CharBuf*)alias);\n";
char *new_alias_adds
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/clownfish/compiler/src/CFCPerlSub.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlSub.c b/clownfish/compiler/src/CFCPerlSub.c
index 2b35ac5..4cb9878 100644
--- a/clownfish/compiler/src/CFCPerlSub.c
+++ b/clownfish/compiler/src/CFCPerlSub.c
@@ -153,7 +153,7 @@ S_allot_params_arg(CFCType *type, const char *label, int required) {
use_sv_buffer = true;
}
const char *zcb_allocation = use_sv_buffer
- ? "alloca(cfish_ZCB_size())"
+ ? "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,
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/clownfish/compiler/src/CFCPerlTypeMap.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlTypeMap.c b/clownfish/compiler/src/CFCPerlTypeMap.c
index bcd17c1..9613b4d 100644
--- a/clownfish/compiler/src/CFCPerlTypeMap.c
+++ b/clownfish/compiler/src/CFCPerlTypeMap.c
@@ -47,7 +47,7 @@ CFCPerlTypeMap_from_perl(CFCType *type, const char *xs_var) {
) {
// Share buffers rather than copy between Perl scalars and
// Clownfish string types.
- allocation = "alloca(cfish_ZCB_size())";
+ allocation = "alloca(cfish_SStr_size())";
}
else {
allocation = "NULL";
@@ -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_CharBuf*)CFISH_ZCB_WRAP_STR(SvPVutf8_nolen($arg), SvCUR($arg));\n"
+ " $var = (const cfish_CharBuf*)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/a7926f49/clownfish/compiler/src/CFCRuby.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCRuby.c b/clownfish/compiler/src/CFCRuby.c
index 64b3466..19055b2 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_ZombieCharBuf *alias = CFISH_ZCB_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/a7926f49/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 356bf76..590209c 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -16,7 +16,7 @@
#define C_CFISH_CHARBUF
#define C_CFISH_VIEWCHARBUF
-#define C_CFISH_ZOMBIECHARBUF
+#define C_CFISH_STACKSTRING
#define CFISH_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
@@ -136,7 +136,7 @@ CB_Destroy_IMP(CharBuf *self) {
int32_t
CB_Hash_Sum_IMP(CharBuf *self) {
uint32_t hashvalue = 5381;
- ZombieCharBuf *iterator = ZCB_WRAP(self);
+ StackString *iterator = SSTR_WRAP(self);
const ViewCB_Nibble_t nibble = METHOD_PTR(iterator->vtable,
CFISH_ViewCB_Nibble);
@@ -377,19 +377,19 @@ CB_To_I64_IMP(CharBuf *self) {
int64_t
CB_BaseX_To_I64_IMP(CharBuf *self, uint32_t base) {
- ZombieCharBuf *iterator = ZCB_WRAP(self);
+ StackString *iterator = SSTR_WRAP(self);
int64_t retval = 0;
bool is_negative = false;
// Advance past minus sign.
- if (ZCB_Code_Point_At(iterator, 0) == '-') {
- ZCB_Nibble(iterator);
+ if (SStr_Code_Point_At(iterator, 0) == '-') {
+ SStr_Nibble(iterator);
is_negative = true;
}
// Accumulate.
while (iterator->size) {
- int32_t code_point = ZCB_Nibble(iterator);
+ int32_t code_point = SStr_Nibble(iterator);
if (isalnum(code_point)) {
int32_t addend = isdigit(code_point)
? code_point - '0'
@@ -554,14 +554,14 @@ CB_Find_IMP(CharBuf *self, const CharBuf *substring) {
int64_t
CB_Find_Str_IMP(CharBuf *self, const char *ptr, size_t size) {
- ZombieCharBuf *iterator = ZCB_WRAP(self);
+ StackString *iterator = SSTR_WRAP(self);
int64_t location = 0;
while (iterator->size) {
- if (ZCB_Starts_With_Str(iterator, ptr, size)) {
+ if (SStr_Starts_With_Str(iterator, ptr, size)) {
return location;
}
- ZCB_Nip(iterator, 1);
+ SStr_Nip(iterator, 1);
location++;
}
@@ -634,8 +634,8 @@ CB_Length_IMP(CharBuf *self) {
size_t
CB_Truncate_IMP(CharBuf *self, size_t count) {
uint32_t num_code_points;
- ZombieCharBuf *iterator = ZCB_WRAP(self);
- num_code_points = ZCB_Nip(iterator, count);
+ StackString *iterator = SSTR_WRAP(self);
+ num_code_points = SStr_Nip(iterator, count);
self->size -= iterator->size;
return num_code_points;
}
@@ -673,13 +673,13 @@ CB_Code_Point_From_IMP(CharBuf *self, size_t tick) {
CharBuf*
CB_SubString_IMP(CharBuf *self, size_t offset, size_t len) {
- ZombieCharBuf *iterator = ZCB_WRAP(self);
+ StackString *iterator = SSTR_WRAP(self);
char *sub_start;
size_t byte_len;
- ZCB_Nip(iterator, offset);
+ SStr_Nip(iterator, offset);
sub_start = iterator->ptr;
- ZCB_Nip(iterator, len);
+ SStr_Nip(iterator, len);
byte_len = iterator->ptr - sub_start;
return CB_new_from_trusted_utf8(sub_start, byte_len);
@@ -689,11 +689,11 @@ int
CB_compare(const void *va, const void *vb) {
const CharBuf *a = *(const CharBuf**)va;
const CharBuf *b = *(const CharBuf**)vb;
- ZombieCharBuf *iterator_a = ZCB_WRAP(a);
- ZombieCharBuf *iterator_b = ZCB_WRAP(b);
+ StackString *iterator_a = SSTR_WRAP(a);
+ StackString *iterator_b = SSTR_WRAP(b);
while (iterator_a->size && iterator_b->size) {
- int32_t code_point_a = ZCB_Nibble(iterator_a);
- int32_t code_point_b = ZCB_Nibble(iterator_b);
+ int32_t code_point_a = SStr_Nibble(iterator_a);
+ int32_t code_point_b = SStr_Nibble(iterator_b);
const int32_t comparison = code_point_a - code_point_b;
if (comparison != 0) { return comparison; }
}
@@ -857,56 +857,56 @@ ViewCB_Grow_IMP(ViewCharBuf *self, size_t size) {
/*****************************************************************/
-ZombieCharBuf*
-ZCB_new(void *allocation) {
+StackString*
+SStr_new(void *allocation) {
static char empty_string[] = "";
- ZombieCharBuf *self
- = (ZombieCharBuf*)VTable_Init_Obj(ZOMBIECHARBUF, allocation);
+ StackString *self
+ = (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
self->cap = 0;
self->size = 0;
self->ptr = empty_string;
return self;
}
-ZombieCharBuf*
-ZCB_newf(void *allocation, size_t alloc_size, const char *pattern, ...) {
- ZombieCharBuf *self
- = (ZombieCharBuf*)VTable_Init_Obj(ZOMBIECHARBUF, allocation);
- self->cap = alloc_size - sizeof(ZombieCharBuf);
+StackString*
+SStr_newf(void *allocation, size_t alloc_size, const char *pattern, ...) {
+ StackString *self
+ = (StackString*)VTable_Init_Obj(STACKSTRING, allocation);
+ self->cap = alloc_size - sizeof(StackString);
self->size = 0;
- self->ptr = ((char*)allocation) + sizeof(ZombieCharBuf);
+ self->ptr = ((char*)allocation) + sizeof(StackString);
va_list args;
va_start(args, pattern);
- ZCB_VCatF(self, pattern, args);
+ SStr_VCatF(self, pattern, args);
va_end(args);
return self;
}
-ZombieCharBuf*
-ZCB_wrap_str(void *allocation, const char *ptr, size_t size) {
- ZombieCharBuf *self
- = (ZombieCharBuf*)VTable_Init_Obj(ZOMBIECHARBUF, allocation);
+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;
}
-ZombieCharBuf*
-ZCB_wrap(void *allocation, const CharBuf *source) {
- return ZCB_wrap_str(allocation, source->ptr, source->size);
+StackString*
+SStr_wrap(void *allocation, const CharBuf *source) {
+ return SStr_wrap_str(allocation, source->ptr, source->size);
}
size_t
-ZCB_size() {
- return sizeof(ZombieCharBuf);
+SStr_size() {
+ return sizeof(StackString);
}
void
-ZCB_Destroy_IMP(ZombieCharBuf *self) {
- THROW(ERR, "Can't destroy a ZombieCharBuf ('%o')", self);
+SStr_Destroy_IMP(StackString *self) {
+ THROW(ERR, "Can't destroy a StackString ('%o')", self);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/clownfish/runtime/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.cfh b/clownfish/runtime/core/Clownfish/CharBuf.cfh
index 1832df7..a224f4a 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.cfh
+++ b/clownfish/runtime/core/Clownfish/CharBuf.cfh
@@ -338,30 +338,30 @@ class Clownfish::ViewCharBuf cnick ViewCB
Destroy(ViewCharBuf *self);
}
-class Clownfish::ZombieCharBuf cnick ZCB
+class Clownfish::StackString cnick SStr
inherits Clownfish::ViewCharBuf {
- /** Return a ZombieCharBuf with a blank string.
+ /** Return a StackString with a blank string.
*/
- inert incremented ZombieCharBuf*
+ inert incremented StackString*
new(void *allocation);
/**
* @param allocation A single block of memory which will be used for both
- * the ZombieCharBuf object and its buffer.
+ * the StackString object and its buffer.
* @param alloc_size The size of the allocation.
* @param pattern A format pattern.
*/
- inert incremented ZombieCharBuf*
+ inert incremented StackString*
newf(void *allocation, size_t alloc_size, const char *pattern, ...);
- inert incremented ZombieCharBuf*
+ inert incremented StackString*
wrap(void *allocation, const CharBuf *source);
- inert incremented ZombieCharBuf*
+ inert incremented StackString*
wrap_str(void *allocation, const char *ptr, size_t size);
- /** Return the size for a ZombieCharBuf struct.
+ /** Return the size for a StackString struct.
*/
inert size_t
size();
@@ -369,23 +369,23 @@ class Clownfish::ZombieCharBuf cnick ZCB
/** Throws an error.
*/
public void
- Destroy(ZombieCharBuf *self);
+ Destroy(StackString *self);
}
__C__
-#define CFISH_ZCB_BLANK() cfish_ZCB_new(cfish_alloca(cfish_ZCB_size()))
+#define CFISH_SStr_BLANK() cfish_SStr_new(cfish_alloca(cfish_SStr_size()))
-#define CFISH_ZCB_WRAP(source) \
- cfish_ZCB_wrap(cfish_alloca(cfish_ZCB_size()), source)
+#define CFISH_SStr_WRAP(source) \
+ cfish_SStr_wrap(cfish_alloca(cfish_SStr_size()), source)
-#define CFISH_ZCB_WRAP_STR(ptr, size) \
- cfish_ZCB_wrap_str(cfish_alloca(cfish_ZCB_size()), ptr, size)
+#define CFISH_SStr_WRAP_STR(ptr, size) \
+ cfish_SStr_wrap_str(cfish_alloca(cfish_SStr_size()), ptr, size)
#ifdef CFISH_USE_SHORT_NAMES
- #define ZCB_BLANK CFISH_ZCB_BLANK
- #define ZCB_WRAP CFISH_ZCB_WRAP
- #define ZCB_WRAP_STR CFISH_ZCB_WRAP_STR
+ #define SStr_BLANK CFISH_SStr_BLANK
+ #define SSTR_WRAP CFISH_SStr_WRAP
+ #define SSTR_WRAP_STR CFISH_SStr_WRAP_STR
#endif
__END_C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/clownfish/runtime/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.c b/clownfish/runtime/core/Clownfish/Hash.c
index 9d36d48..1fbfe42 100644
--- a/clownfish/runtime/core/Clownfish/Hash.c
+++ b/clownfish/runtime/core/Clownfish/Hash.c
@@ -160,9 +160,9 @@ 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) {
- ZombieCharBuf *key_buf = ZCB_WRAP_STR((char*)key, key_len);
+ StackString *key_buf = SSTR_WRAP_STR((char*)key, key_len);
Hash_do_store(self, (Obj*)key_buf, value,
- ZCB_Hash_Sum(key_buf), false);
+ SStr_Hash_Sum(key_buf), false);
}
Obj*
@@ -174,7 +174,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) {
- ZombieCharBuf *key_buf = ZCB_WRAP_STR(key, key_len);
+ StackString *key_buf = SSTR_WRAP_STR(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_Str_IMP(Hash *self, const char *key, size_t key_len) {
- ZombieCharBuf *key_buf = ZCB_WRAP_STR(key, 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/a7926f49/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 572c466..50e3c23 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
@@ -152,20 +152,20 @@ static void
test_Nip_and_Chop(TestBatchRunner *runner) {
CharBuf *wanted;
CharBuf *string;
- ZombieCharBuf *got;
+ StackString *got;
wanted = CB_newf("%sb%sc", smiley, smiley);
string = CB_newf("a%s%sb%sc", smiley, smiley, smiley);
- got = ZCB_WRAP(string);
- ZCB_Nip(got, 2);
+ got = SSTR_WRAP(string);
+ SStr_Nip(got, 2);
TEST_TRUE(runner, CB_Equals(wanted, (Obj*)got), "Nip");
DECREF(wanted);
DECREF(string);
wanted = CB_newf("a%s%s", smiley, smiley);
string = CB_newf("a%s%sb%sc", smiley, smiley, smiley);
- got = ZCB_WRAP(string);
- ZCB_Chop(got, 3);
+ got = SSTR_WRAP(string);
+ SStr_Chop(got, 3);
TEST_TRUE(runner, CB_Equals(wanted, (Obj*)got), "Chop");
DECREF(wanted);
DECREF(string);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/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 9d70ca2..d90dba1 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);
- ZombieCharBuf *stuff = ZCB_WRAP_STR("stuff", 5);
+ StackString *stuff = SSTR_WRAP_STR("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);
- ZombieCharBuf *twenty = ZCB_WRAP_STR("20", 2);
- ZombieCharBuf *forty = ZCB_WRAP_STR("40", 2);
- ZombieCharBuf *foo = ZCB_WRAP_STR("foo", 3);
+ StackString *twenty = SSTR_WRAP_STR("20", 2);
+ StackString *forty = SSTR_WRAP_STR("40", 2);
+ StackString *foo = SSTR_WRAP_STR("foo", 3);
for (int32_t i = 0; i < 100; i++) {
CharBuf *cb = CB_newf("%i32", i);
@@ -98,7 +98,7 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
"Fetch against non-existent key returns NULL");
Hash_Store(hash, (Obj*)forty, INCREF(foo));
- TEST_TRUE(runner, ZCB_Equals(foo, Hash_Fetch(hash, (Obj*)forty)),
+ TEST_TRUE(runner, SStr_Equals(foo, Hash_Fetch(hash, (Obj*)forty)),
"Hash_Store replaces existing value");
TEST_FALSE(runner, Hash_Equals(hash, (Obj*)dupe),
"replacement value spoils equals");
@@ -167,11 +167,11 @@ test_Keys_Values_Iter(TestBatchRunner *runner) {
TEST_TRUE(runner, VA_Equals(values, (Obj*)expected), "Values from Iter");
{
- ZombieCharBuf *forty = ZCB_WRAP_STR("40", 2);
- ZombieCharBuf *nope = ZCB_WRAP_STR("nope", 4);
- Obj *key = Hash_Find_Key(hash, (Obj*)forty, ZCB_Hash_Sum(forty));
+ StackString *forty = SSTR_WRAP_STR("40", 2);
+ StackString *nope = SSTR_WRAP_STR("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, ZCB_Hash_Sum(nope)),
+ key = Hash_Find_Key(hash, (Obj*)nope, SStr_Hash_Sum(nope)),
TEST_TRUE(runner, key == NULL,
"Find_Key returns NULL for non-existent key");
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/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 a3fd446..b22add7 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() {
- ZombieCharBuf *klass = ZCB_WRAP_STR("TestObj", 7);
+ StackString *klass = SSTR_WRAP_STR("TestObj", 7);
Obj *obj;
VTable *vtable = VTable_fetch_vtable((CharBuf*)klass);
if (!vtable) {
@@ -67,12 +67,12 @@ static void
test_To_String(TestBatchRunner *runner) {
Obj *testobj = S_new_testobj();
CharBuf *string = Obj_To_String(testobj);
- ZombieCharBuf *temp = ZCB_WRAP(string);
- while (ZCB_Get_Size(temp)) {
- if (ZCB_Starts_With_Str(temp, "TestObj", 7)) { break; }
- ZCB_Nibble(temp);
+ StackString *temp = SSTR_WRAP(string);
+ while (SStr_Get_Size(temp)) {
+ if (SStr_Starts_With_Str(temp, "TestObj", 7)) { break; }
+ SStr_Nibble(temp);
}
- TEST_TRUE(runner, ZCB_Starts_With_Str(temp, "TestObj", 7), "To_String");
+ TEST_TRUE(runner, SStr_Starts_With_Str(temp, "TestObj", 7), "To_String");
DECREF(string);
DECREF(testobj);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/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 06f4890..a1c5c8e 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);
- ZombieCharBuf *stuff = ZCB_WRAP_STR("stuff", 5);
+ StackString *stuff = SSTR_WRAP_STR("stuff", 5);
TEST_TRUE(runner, VA_Equals(array, (Obj*)other),
"Empty arrays are equal");
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/clownfish/runtime/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VTable.c b/clownfish/runtime/core/Clownfish/VTable.c
index 5914dd1..244f08f 100644
--- a/clownfish/runtime/core/Clownfish/VTable.c
+++ b/clownfish/runtime/core/Clownfish/VTable.c
@@ -326,10 +326,10 @@ VTable_singleton(const CharBuf *class_name, VTable *parent) {
static void
S_scrunch_charbuf(CharBuf *source, CharBuf *target) {
- ZombieCharBuf *iterator = ZCB_WRAP(source);
+ StackString *iterator = SSTR_WRAP(source);
CB_Set_Size(target, 0);
- while (ZCB_Get_Size(iterator)) {
- uint32_t code_point = ZCB_Nibble(iterator);
+ while (SStr_Get_Size(iterator)) {
+ uint32_t code_point = SStr_Nibble(iterator);
if (code_point > 127) {
THROW(ERR, "Can't fold case for %o", source);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/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 150e570..419b43b 100644
--- a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -595,7 +595,7 @@ CODE:
CFISH_UNUSED_VAR(unused_sv);
STRLEN size;
char *ptr = SvPVutf8(class_name_sv, size);
- cfish_ZombieCharBuf *class_name = CFISH_ZCB_WRAP_STR(ptr, size);
+ cfish_StackString *class_name = CFISH_SStr_WRAP_STR(ptr, size);
cfish_VTable *vtable
= cfish_VTable_fetch_vtable((cfish_CharBuf*)class_name);
RETVAL = vtable ? (SV*)CFISH_VTable_To_Host(vtable) : &PL_sv_undef;
@@ -613,7 +613,7 @@ CODE:
bool args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
ALLOT_OBJ(&class_name, "class_name", 10, true,
- CFISH_CHARBUF, alloca(cfish_ZCB_size())),
+ CFISH_CHARBUF, alloca(cfish_SStr_size())),
ALLOT_OBJ(&parent, "parent", 6, false,
CFISH_VTABLE, NULL),
NULL);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/clownfish/runtime/perl/lib/Clownfish.pm
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/lib/Clownfish.pm b/clownfish/runtime/perl/lib/Clownfish.pm
index a15c420..b416887 100644
--- a/clownfish/runtime/perl/lib/Clownfish.pm
+++ b/clownfish/runtime/perl/lib/Clownfish.pm
@@ -170,11 +170,11 @@ sub error {$Clownfish::Err::error}
}
{
- package Clownfish::ZombieCharBuf;
+ package Clownfish::StackString;
our $VERSION = '0.003000';
$VERSION = eval $VERSION;
use Carp;
- sub new { confess "ZombieCharBuf objects can only be created from C." }
+ sub new { confess "StackString objects can only be created from C." }
no warnings 'redefine';
sub DESTROY { }
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 6a0da1f..a1d3451 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_ZombieCharBuf *klass = CFISH_ZCB_WRAP_STR(ptr, len);
+ cfish_StackString *klass = CFISH_SStr_WRAP_STR(ptr, len);
vtable = cfish_VTable_singleton((cfish_CharBuf*)klass, NULL);
}
@@ -93,16 +93,16 @@ XSBind_maybe_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable, void *allocation) {
retval = INT2PTR(cfish_Obj*, tmp);
}
else if (allocation &&
- (vtable == CFISH_ZOMBIECHARBUF
+ (vtable == CFISH_STACKSTRING
|| vtable == CFISH_VIEWCHARBUF
|| vtable == CFISH_CHARBUF
|| vtable == CFISH_OBJ)
) {
// Wrap the string from an ordinary Perl scalar inside a
- // ZombieCharBuf.
+ // StackString.
STRLEN size;
char *ptr = SvPVutf8(sv, size);
- retval = (cfish_Obj*)cfish_ZCB_wrap_str(allocation, ptr, size);
+ retval = (cfish_Obj*)cfish_SStr_wrap_str(allocation, ptr, size);
}
else if (SvROK(sv)) {
// Attempt to convert Perl hashes and arrays into their Clownfish
@@ -239,7 +239,7 @@ static cfish_Hash*
S_perl_hash_to_cfish_hash(HV *phash) {
uint32_t num_keys = hv_iterinit(phash);
cfish_Hash *retval = cfish_Hash_new(num_keys);
- cfish_ZombieCharBuf *key = CFISH_ZCB_WRAP_STR("", 0);
+ cfish_StackString *key = CFISH_SStr_WRAP_STR("", 0);
while (num_keys--) {
HE *entry = hv_iternext(phash);
@@ -253,11 +253,11 @@ S_perl_hash_to_cfish_hash(HV *phash) {
// this.
SV *key_sv = HeKEY_sv(entry);
char *key_str = SvPVutf8(key_sv, key_len);
- CFISH_ZCB_Assign_Trusted_Str(key, key_str, key_len);
+ CFISH_SStr_Assign_Trusted_Str(key, key_str, key_len);
CFISH_Hash_Store(retval, (cfish_Obj*)key, value);
}
else if (HeKUTF8(entry)) {
- CFISH_ZCB_Assign_Trusted_Str(key, HeKEY(entry), key_len);
+ CFISH_SStr_Assign_Trusted_Str(key, HeKEY(entry), key_len);
CFISH_Hash_Store(retval, (cfish_Obj*)key, value);
}
else {
@@ -267,13 +267,13 @@ S_perl_hash_to_cfish_hash(HV *phash) {
if ((key_str[i] & 0x80) == 0x80) { pure_ascii = false; }
}
if (pure_ascii) {
- CFISH_ZCB_Assign_Trusted_Str(key, key_str, key_len);
+ CFISH_SStr_Assign_Trusted_Str(key, key_str, key_len);
CFISH_Hash_Store(retval, (cfish_Obj*)key, value);
}
else {
SV *key_sv = HeSVKEY_force(entry);
key_str = SvPVutf8(key_sv, key_len);
- CFISH_ZCB_Assign_Trusted_Str(key, key_str, key_len);
+ CFISH_SStr_Assign_Trusted_Str(key, key_str, key_len);
CFISH_Hash_Store(retval, (cfish_Obj*)key, value);
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/clownfish/runtime/perl/xs/XSBind.h
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.h b/clownfish/runtime/perl/xs/XSBind.h
index a3dffce..63d9f15 100644
--- a/clownfish/runtime/perl/xs/XSBind.h
+++ b/clownfish/runtime/perl/xs/XSBind.h
@@ -58,8 +58,8 @@ cfish_XSBind_sv_defined(SV *sv) {
/** If the SV contains a Clownfish object which passes an "isa" test against the
* passed-in VTable, return a pointer to it. If not, but
- * <code>allocation</code> is non-NULL and a ZombieCharBuf would satisfy the
- * "isa" test, stringify the SV, create a ZombieCharBuf using
+ * <code>allocation</code> is non-NULL and a StackString would satisfy the
+ * "isa" test, stringify the SV, create a StackString using
* <code>allocation</code>, assign the SV's string to it, and return that
* instead. If all else fails, throw an exception.
*/
@@ -150,8 +150,8 @@ cfish_XSBind_enable_overload(void *pobj);
* a NULL-terminated series of ALLOT_ macros.
*
* cfish_XSBind_allot_params(stack, start, num_stack_elems,
- * ALLOT_OBJ(&field, "field", 5, CFISH_CHARBUF, true, alloca(cfish_ZCB_size()),
- * ALLOT_OBJ(&term, "term", 4, CFISH_CHARBUF, true, alloca(cfish_ZCB_size()),
+ * ALLOT_OBJ(&field, "field", 5, CFISH_CHARBUF, true, alloca(cfish_SStr_size()),
+ * ALLOT_OBJ(&term, "term", 4, CFISH_CHARBUF, true, alloca(cfish_SStr_size()),
* NULL);
*
* The following ALLOT_ macros are available for primitive types:
@@ -189,8 +189,8 @@ cfish_XSBind_enable_overload(void *pobj);
*
* The "vtable" argument must be the VTable corresponding to the class of the
* desired object. The "allocation" argument must be a blob of memory
- * allocated on the stack sufficient to hold a ZombieCharBuf. (Use
- * cfish_ZCB_size() to find the allocation size.)
+ * allocated on the stack sufficient to hold a StackString. (Use
+ * cfish_SStr_size() to find the allocation size.)
*
* To extract a Perl scalar, use the following ALLOT_ macro:
*
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index b1e2500..db26eab 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -150,19 +150,19 @@ Highlighter_Get_Excerpt_Length_IMP(Highlighter *self) {
CharBuf*
Highlighter_Create_Excerpt_IMP(Highlighter *self, HitDoc *hit_doc) {
HighlighterIVARS *const ivars = Highlighter_IVARS(self);
- ZombieCharBuf *field_val
- = (ZombieCharBuf*)HitDoc_Extract(hit_doc, ivars->field,
- (ViewCharBuf*)ZCB_BLANK());
+ StackString *field_val
+ = (StackString*)HitDoc_Extract(hit_doc, ivars->field,
+ (ViewCharBuf*)SStr_BLANK());
if (!field_val || !Obj_Is_A((Obj*)field_val, CHARBUF)) {
return NULL;
}
- else if (!ZCB_Get_Size(field_val)) {
+ else if (!SStr_Get_Size(field_val)) {
// Empty string yields empty string.
return CB_new(0);
}
else {
- ZombieCharBuf *fragment = ZCB_WRAP((CharBuf*)field_val);
+ StackString *fragment = SSTR_WRAP((CharBuf*)field_val);
CharBuf *raw_excerpt = CB_new(ivars->excerpt_length + 10);
CharBuf *highlighted = CB_new((ivars->excerpt_length * 3) / 2);
DocVector *doc_vec
@@ -319,9 +319,9 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, const CharBuf *field_val,
// Try to start on the first sentence boundary, but only if
// there's enough relevant material left after it in the
// fragment.
- ZombieCharBuf *temp = ZCB_WRAP(fragment);
- ZCB_Nip(temp, candidate - top);
- uint32_t chars_left = ZCB_Truncate(temp, ivars->excerpt_length);
+ StackString *temp = SSTR_WRAP(fragment);
+ SStr_Nip(temp, candidate - top);
+ uint32_t chars_left = SStr_Truncate(temp, ivars->excerpt_length);
if (chars_left >= min_len
&& S_has_heat(heat_map, candidate, chars_left)
) {
@@ -335,8 +335,8 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, const CharBuf *field_val,
// Try to end on a sentence boundary (but don't try very hard).
if (num_sentences) {
- ZombieCharBuf *start_trimmed = ZCB_WRAP(fragment);
- ZCB_Nip(start_trimmed, start - top);
+ StackString *start_trimmed = SSTR_WRAP(fragment);
+ SStr_Nip(start_trimmed, start - top);
for (uint32_t i = num_sentences; i--;) {
Span *sentence = (Span*)VA_Fetch(sentences, i);
@@ -359,10 +359,10 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, const CharBuf *field_val,
break;
}
else {
- ZombieCharBuf *temp = ZCB_WRAP((CharBuf*)start_trimmed);
- ZCB_Nip(temp, chars_left);
- ZCB_Trim_Tail(temp);
- if (ZCB_Get_Size(temp) == 0) {
+ StackString *temp = SSTR_WRAP((CharBuf*)start_trimmed);
+ SStr_Nip(temp, chars_left);
+ SStr_Trim_Tail(temp);
+ if (SStr_Get_Size(temp) == 0) {
// Short, but ending on a boundary already.
found_ending_edge = true;
end = last_edge;
@@ -377,11 +377,11 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, const CharBuf *field_val,
: (int32_t)ivars->excerpt_length;
if (!this_excerpt_len) { return start; }
- ZombieCharBuf *substring = ZCB_WRAP((CharBuf*)field_val);
+ StackString *substring = SSTR_WRAP((CharBuf*)field_val);
if (found_starting_edge) {
- ZCB_Nip(substring, start);
- ZCB_Truncate(substring, this_excerpt_len);
+ SStr_Nip(substring, start);
+ SStr_Truncate(substring, this_excerpt_len);
}
// If not starting on a sentence boundary, prepend an ellipsis.
else {
@@ -400,11 +400,11 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, const CharBuf *field_val,
if (start) {
this_excerpt_len += 1;
start -= 1;
- ZCB_Nip(substring, start);
+ SStr_Nip(substring, start);
}
do {
- uint32_t code_point = ZCB_Nibble(substring);
+ uint32_t code_point = SStr_Nibble(substring);
start++;
this_excerpt_len--;
@@ -418,44 +418,44 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, const CharBuf *field_val,
break;
}
}
- } while (ZCB_Get_Size(substring));
+ } while (SStr_Get_Size(substring));
- if (ZCB_Get_Size(substring) == 0) {
+ if (SStr_Get_Size(substring) == 0) {
// Word is longer than excerpt_length. Reset to original position
// truncating the word.
- ZCB_Assign(substring, (CharBuf*)field_val);
+ SStr_Assign(substring, (CharBuf*)field_val);
start = orig_start;
this_excerpt_len = orig_len;
int32_t diff = this_excerpt_len - ivars->excerpt_length;
if (diff > 0) {
- ZCB_Nip(substring, diff);
+ SStr_Nip(substring, diff);
start += diff;
this_excerpt_len -= diff;
}
}
- ZCB_Truncate(substring, ivars->excerpt_length - ELLIPSIS_LEN);
+ SStr_Truncate(substring, ivars->excerpt_length - ELLIPSIS_LEN);
}
// If excerpt doesn't end on a sentence boundary, tack on an ellipsis.
if (found_ending_edge) {
- ZCB_Truncate(substring, end - start);
- ZCB_Trim_Tail(substring);
+ SStr_Truncate(substring, end - start);
+ SStr_Trim_Tail(substring);
}
else {
// Remember original excerpt
- ZombieCharBuf *orig_substring = ZCB_WRAP((CharBuf*)substring);
+ StackString *orig_substring = SSTR_WRAP((CharBuf*)substring);
// Check for prepended ellipsis
uint32_t min_size = found_starting_edge ? 0 : 4;
do {
- uint32_t code_point = ZCB_Code_Point_From(substring, 1);
- ZCB_Chop(substring, 1);
+ uint32_t code_point = SStr_Code_Point_From(substring, 1);
+ SStr_Chop(substring, 1);
if (StrHelp_is_whitespace(code_point)) {
- ZCB_Trim_Tail(substring);
+ SStr_Trim_Tail(substring);
// Strip punctuation that collides with an ellipsis.
- code_point = ZCB_Code_Point_From(substring, 1);
+ code_point = SStr_Code_Point_From(substring, 1);
while (code_point == '.'
|| code_point == ','
|| code_point == ';'
@@ -464,19 +464,19 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, const CharBuf *field_val,
|| code_point == '?'
|| code_point == '!'
) {
- ZCB_Chop(substring, 1);
- code_point = ZCB_Code_Point_From(substring, 1);
+ SStr_Chop(substring, 1);
+ code_point = SStr_Code_Point_From(substring, 1);
}
break;
}
- } while (ZCB_Get_Size(substring) > min_size);
+ } while (SStr_Get_Size(substring) > min_size);
- if (ZCB_Get_Size(substring) == min_size) {
+ if (SStr_Get_Size(substring) == min_size) {
// Word is longer than excerpt_length. Reset to original excerpt
// truncating the word.
- ZCB_Assign(substring, (CharBuf*)orig_substring);
- ZCB_Chop(substring, 1);
+ SStr_Assign(substring, (CharBuf*)orig_substring);
+ SStr_Chop(substring, 1);
}
}
@@ -502,7 +502,7 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, VArray *spans,
int32_t top) {
int32_t hl_start = 0;
int32_t hl_end = 0;
- ZombieCharBuf *temp = ZCB_WRAP(raw_excerpt);
+ StackString *temp = SSTR_WRAP(raw_excerpt);
CharBuf *encode_buf = NULL;
int32_t raw_excerpt_end = top + CB_Length(raw_excerpt);
@@ -530,22 +530,22 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, VArray *spans,
if (hl_start < hl_end) {
// Highlight previous section
int32_t highlighted_len = hl_end - hl_start;
- ZombieCharBuf *to_cat = ZCB_WRAP((CharBuf*)temp);
- ZCB_Truncate(to_cat, highlighted_len);
+ StackString *to_cat = SSTR_WRAP((CharBuf*)temp);
+ SStr_Truncate(to_cat, highlighted_len);
encoded = S_do_encode(self, (CharBuf*)to_cat, &encode_buf);
CharBuf *hl_frag = Highlighter_Highlight(self, encoded);
CB_Cat(highlighted, hl_frag);
- ZCB_Nip(temp, highlighted_len);
+ SStr_Nip(temp, highlighted_len);
DECREF(hl_frag);
DECREF(encoded);
}
int32_t non_highlighted_len = relative_start - hl_end;
- ZombieCharBuf *to_cat = ZCB_WRAP((CharBuf*)temp);
- ZCB_Truncate(to_cat, non_highlighted_len);
+ StackString *to_cat = SSTR_WRAP((CharBuf*)temp);
+ SStr_Truncate(to_cat, non_highlighted_len);
encoded = S_do_encode(self, (CharBuf*)to_cat, &encode_buf);
CB_Cat(highlighted, (CharBuf*)encoded);
- ZCB_Nip(temp, non_highlighted_len);
+ SStr_Nip(temp, non_highlighted_len);
DECREF(encoded);
hl_start = relative_start;
@@ -557,18 +557,18 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, VArray *spans,
if (hl_start < hl_end) {
// Highlight final section
int32_t highlighted_len = hl_end - hl_start;
- ZombieCharBuf *to_cat = ZCB_WRAP((CharBuf*)temp);
- ZCB_Truncate(to_cat, highlighted_len);
+ StackString *to_cat = SSTR_WRAP((CharBuf*)temp);
+ SStr_Truncate(to_cat, highlighted_len);
CharBuf *encoded = S_do_encode(self, (CharBuf*)to_cat, &encode_buf);
CharBuf *hl_frag = Highlighter_Highlight(self, encoded);
CB_Cat(highlighted, hl_frag);
- ZCB_Nip(temp, highlighted_len);
+ SStr_Nip(temp, highlighted_len);
DECREF(hl_frag);
DECREF(encoded);
}
// Last text, beyond last highlight span.
- if (ZCB_Get_Size(temp)) {
+ if (SStr_Get_Size(temp)) {
CharBuf *encoded = S_do_encode(self, (CharBuf*)temp, &encode_buf);
CB_Cat(highlighted, encoded);
DECREF(encoded);
@@ -609,8 +609,8 @@ Highlighter_Find_Sentences_IMP(Highlighter *self, CharBuf *text,
int32_t stop = length == 0
? INT32_MAX
: offset + length;
- ZombieCharBuf *fragment = ZCB_WRAP(text);
- int32_t pos = ZCB_Trim_Top(fragment);
+ StackString *fragment = SSTR_WRAP(text);
+ int32_t pos = SStr_Trim_Top(fragment);
UNUSED_VAR(self);
/* Our first task will be to find a sentence that either starts at the top
@@ -622,17 +622,17 @@ Highlighter_Find_Sentences_IMP(Highlighter *self, CharBuf *text,
*/
if (offset <= pos) {
// Assume that first non-whitespace character begins a sentence.
- if (pos < stop && ZCB_Get_Size(fragment) > 0) {
+ if (pos < stop && SStr_Get_Size(fragment) > 0) {
sentence = S_start_sentence(pos);
}
}
else {
- ZCB_Nip(fragment, offset - pos);
+ SStr_Nip(fragment, offset - pos);
pos = offset;
}
while (1) {
- uint32_t code_point = ZCB_Code_Point_At(fragment, 0);
+ uint32_t code_point = SStr_Code_Point_At(fragment, 0);
if (!code_point) {
// End of fragment. If we have a sentence open, close it,
// then bail.
@@ -641,21 +641,21 @@ Highlighter_Find_Sentences_IMP(Highlighter *self, CharBuf *text,
}
else if (code_point == '.') {
uint32_t whitespace_count;
- pos += ZCB_Nip(fragment, 1); // advance past "."
+ pos += SStr_Nip(fragment, 1); // advance past "."
- if (pos == stop && ZCB_Get_Size(fragment) == 0) {
+ if (pos == stop && SStr_Get_Size(fragment) == 0) {
// Period ending the field string.
if (sentence) { S_close_sentence(sentences, &sentence, pos); }
break;
}
- else if (0 != (whitespace_count = ZCB_Trim_Top(fragment))) {
+ else if (0 != (whitespace_count = SStr_Trim_Top(fragment))) {
// We've found a period followed by whitespace. Close out the
// existing sentence, if there is one. */
if (sentence) { S_close_sentence(sentences, &sentence, pos); }
// Advance past whitespace.
pos += whitespace_count;
- if (pos < stop && ZCB_Get_Size(fragment) > 0) {
+ if (pos < stop && SStr_Get_Size(fragment) > 0) {
// Not at the end of the string? Then we've found a
// sentence start.
sentence = S_start_sentence(pos);
@@ -668,7 +668,7 @@ Highlighter_Find_Sentences_IMP(Highlighter *self, CharBuf *text,
if (pos >= stop) { break; }
}
else {
- ZCB_Nip(fragment, 1);
+ SStr_Nip(fragment, 1);
pos++;
}
}
@@ -703,13 +703,13 @@ S_do_encode(Highlighter *self, CharBuf *text, CharBuf **encode_buf) {
static CharBuf*
S_encode_entities(CharBuf *text, CharBuf *encoded) {
- ZombieCharBuf *temp = ZCB_WRAP(text);
+ StackString *temp = SSTR_WRAP(text);
size_t space = 0;
const int MAX_ENTITY_BYTES = 9; // &#dddddd;
// Scan first so that we only allocate once.
uint32_t code_point;
- while (0 != (code_point = ZCB_Nibble(temp))) {
+ while (0 != (code_point = SStr_Nibble(temp))) {
if (code_point > 127
|| (!isgraph(code_point) && !isspace(code_point))
|| code_point == '<'
@@ -726,8 +726,8 @@ S_encode_entities(CharBuf *text, CharBuf *encoded) {
CB_Grow(encoded, space);
CB_Set_Size(encoded, 0);
- ZCB_Assign(temp, text);
- while (0 != (code_point = ZCB_Nibble(temp))) {
+ SStr_Assign(temp, text);
+ while (0 != (code_point = SStr_Nibble(temp))) {
if (code_point > 127
|| (!isgraph(code_point) && !isspace(code_point))
) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Index/FilePurger.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/FilePurger.c b/core/Lucy/Index/FilePurger.c
index 0701bd5..74737bb 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) {
CharBuf *cutoff_seg = Seg_num_to_name(Obj_To_I64(cutoff));
if (Folder_Exists(ivars->folder, cutoff_seg)) {
- ZombieCharBuf *merge_json = ZCB_WRAP_STR("merge.json", 10);
+ StackString *merge_json = SSTR_WRAP_STR("merge.json", 10);
DirHandle *dh = Folder_Open_Dir(ivars->folder, cutoff_seg);
if (!dh) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Index/IndexManager.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/IndexManager.c b/core/Lucy/Index/IndexManager.c
index 31f9c63..5141713 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);
- ZombieCharBuf *write_lock_name = ZCB_WRAP_STR("write", 5);
+ StackString *write_lock_name = SSTR_WRAP_STR("write", 5);
LockFactory *lock_factory = S_obtain_lock_factory(self);
return LockFact_Make_Lock(lock_factory, (CharBuf*)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);
- ZombieCharBuf *lock_name = ZCB_WRAP_STR("deletion", 8);
+ StackString *lock_name = SSTR_WRAP_STR("deletion", 8);
LockFactory *lock_factory = S_obtain_lock_factory(self);
return LockFact_Make_Lock(lock_factory, (CharBuf*)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);
- ZombieCharBuf *merge_lock_name = ZCB_WRAP_STR("merge", 5);
+ StackString *merge_lock_name = SSTR_WRAP_STR("merge", 5);
LockFactory *lock_factory = S_obtain_lock_factory(self);
return LockFact_Make_Lock(lock_factory, (CharBuf*)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);
- ZombieCharBuf *merge_json = ZCB_WRAP_STR("merge.json", 10);
+ StackString *merge_json = SSTR_WRAP_STR("merge.json", 10);
Hash *data = Hash_new(1);
bool success;
Hash_Store_Str(data, "cutoff", 6, (Obj*)CB_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);
- ZombieCharBuf *merge_json = ZCB_WRAP_STR("merge.json", 10);
+ StackString *merge_json = SSTR_WRAP_STR("merge.json", 10);
if (Folder_Exists(ivars->folder, (CharBuf*)merge_json)) {
Hash *stuff
= (Hash*)Json_slurp_json(ivars->folder, (CharBuf*)merge_json);
@@ -297,14 +297,14 @@ IxManager_Read_Merge_Data_IMP(IndexManager *self) {
bool
IxManager_Remove_Merge_Data_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- ZombieCharBuf *merge_json = ZCB_WRAP_STR("merge.json", 10);
+ StackString *merge_json = SSTR_WRAP_STR("merge.json", 10);
return Folder_Delete(ivars->folder, (CharBuf*)merge_json) != 0;
}
Lock*
IxManager_Make_Snapshot_Read_Lock_IMP(IndexManager *self,
const CharBuf *filename) {
- ZombieCharBuf *lock_name = ZCB_WRAP(filename);
+ StackString *lock_name = SSTR_WRAP(filename);
LockFactory *lock_factory = S_obtain_lock_factory(self);
if (!CB_Starts_With_Str(filename, "snapshot_", 9)
@@ -314,7 +314,7 @@ IxManager_Make_Snapshot_Read_Lock_IMP(IndexManager *self,
}
// Truncate ".json" from end of snapshot file name.
- ZCB_Chop(lock_name, sizeof(".json") - 1);
+ SStr_Chop(lock_name, sizeof(".json") - 1);
return LockFact_Make_Shared_Lock(lock_factory, (CharBuf*)lock_name, 1000, 100);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Index/PolyReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyReader.c b/core/Lucy/Index/PolyReader.c
index 28311ab..74b10f2 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) {
- ZombieCharBuf *temp = ZCB_WRAP_STR("temp", 4);
+ StackString *temp = SSTR_WRAP_STR("temp", 4);
if (Folder_Exists(folder, (CharBuf*)temp)) {
bool success = Folder_Rename(folder, (CharBuf*)temp,
PolyReader_race_condition_debug1);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Index/Segment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c
index 6deea89..23681c4 100644
--- a/core/Lucy/Index/Segment.c
+++ b/core/Lucy/Index/Segment.c
@@ -66,13 +66,13 @@ Seg_num_to_name(int64_t number) {
bool
Seg_valid_seg_name(const CharBuf *name) {
if (CB_Starts_With_Str(name, "seg_", 4)) {
- ZombieCharBuf *scratch = ZCB_WRAP(name);
- ZCB_Nip(scratch, 4);
+ StackString *scratch = SSTR_WRAP(name);
+ SStr_Nip(scratch, 4);
uint32_t code_point;
- while (0 != (code_point = ZCB_Nibble(scratch))) {
+ while (0 != (code_point = SStr_Nibble(scratch))) {
if (!isalnum(code_point)) { return false; }
}
- if (ZCB_Get_Size(scratch) == 0) { return true; } // Success!
+ if (SStr_Get_Size(scratch) == 0) { return true; } // Success!
}
return false;
}
@@ -207,7 +207,7 @@ Seg_Store_Metadata_IMP(Segment *self, const CharBuf *key, Obj *value) {
void
Seg_Store_Metadata_Str_IMP(Segment *self, const char *key, size_t key_len,
Obj *value) {
- ZombieCharBuf *k = ZCB_WRAP_STR((char*)key, key_len);
+ StackString *k = SSTR_WRAP_STR((char*)key, key_len);
Seg_Store_Metadata(self, (CharBuf*)k, value);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Index/ZombieKeyedHash.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/ZombieKeyedHash.c b/core/Lucy/Index/ZombieKeyedHash.c
index a909bec..43140a6 100644
--- a/core/Lucy/Index/ZombieKeyedHash.c
+++ b/core/Lucy/Index/ZombieKeyedHash.c
@@ -47,9 +47,9 @@ ZKHash_Make_Key_IMP(ZombieKeyedHash *self, Obj *key, int32_t hash_sum) {
switch (ivars->prim_id & FType_PRIMITIVE_ID_MASK) {
case FType_TEXT: {
CharBuf *source = (CharBuf*)key;
- size_t size = ZCB_size() + CB_Get_Size(source) + 1;
+ size_t size = SStr_size() + CB_Get_Size(source) + 1;
void *allocation = MemPool_Grab(ivars->mem_pool, size);
- retval = (Obj*)ZCB_newf(allocation, size, "%o", source);
+ retval = (Obj*)SStr_newf(allocation, size, "%o", source);
}
break;
case FType_INT32: {
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Plan/Schema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.c b/core/Lucy/Plan/Schema.c
index 11d924b..16429b8 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 CharBuf *filename) {
Hash *dump = Schema_Dump(self);
- ZombieCharBuf *schema_temp = ZCB_WRAP_STR("schema.temp", 11);
+ StackString *schema_temp = SSTR_WRAP_STR("schema.temp", 11);
bool success;
Folder_Delete(folder, (CharBuf*)schema_temp); // Just in case.
Json_spew_json((Obj*)dump, folder, (CharBuf*)schema_temp);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Search/QueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c
index 2346bf2..f9dfefa 100644
--- a/core/Lucy/Search/QueryParser.c
+++ b/core/Lucy/Search/QueryParser.c
@@ -824,16 +824,16 @@ QParser_Expand_IMP(QueryParser *self, Query *query) {
static CharBuf*
S_unescape(QueryParser *self, CharBuf *orig, CharBuf *target) {
- ZombieCharBuf *source = ZCB_WRAP(orig);
+ StackString *source = SSTR_WRAP(orig);
uint32_t code_point;
UNUSED_VAR(self);
CB_Set_Size(target, 0);
CB_Grow(target, CB_Get_Size(orig) + 4);
- while (0 != (code_point = ZCB_Nibble(source))) {
+ while (0 != (code_point = SStr_Nibble(source))) {
if (code_point == '\\') {
- uint32_t next_code_point = ZCB_Nibble(source);
+ uint32_t next_code_point = SStr_Nibble(source);
if (next_code_point == ':'
|| next_code_point == '"'
|| next_code_point == '\\'
@@ -858,24 +858,24 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
QueryParserIVARS *const ivars = QParser_IVARS(self);
LeafQuery *leaf_query = (LeafQuery*)query;
Schema *schema = ivars->schema;
- ZombieCharBuf *source_text = ZCB_BLANK();
+ StackString *source_text = SStr_BLANK();
bool is_phrase = false;
bool ambiguous = false;
// Determine whether we can actually process the input.
if (!Query_Is_A(query, LEAFQUERY)) { return NULL; }
if (!CB_Get_Size(LeafQuery_Get_Text(leaf_query))) { return NULL; }
- ZCB_Assign(source_text, LeafQuery_Get_Text(leaf_query));
+ SStr_Assign(source_text, LeafQuery_Get_Text(leaf_query));
// If quoted, always generate PhraseQuery.
- ZCB_Trim(source_text);
- if (ZCB_Code_Point_At(source_text, 0) == '"') {
+ SStr_Trim(source_text);
+ if (SStr_Code_Point_At(source_text, 0) == '"') {
is_phrase = true;
- ZCB_Nip(source_text, 1);
- if (ZCB_Code_Point_From(source_text, 1) == '"'
- && ZCB_Code_Point_From(source_text, 2) != '\\'
+ SStr_Nip(source_text, 1);
+ if (SStr_Code_Point_From(source_text, 1) == '"'
+ && SStr_Code_Point_From(source_text, 2) != '\\'
) {
- ZCB_Chop(source_text, 1);
+ SStr_Chop(source_text, 1);
}
}
@@ -889,7 +889,7 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
fields = (VArray*)INCREF(ivars->fields);
}
- CharBuf *unescaped = CB_new(ZCB_Get_Size(source_text));
+ CharBuf *unescaped = CB_new(SStr_Get_Size(source_text));
VArray *queries = VA_new(VA_Get_Size(fields));
for (uint32_t i = 0, max = VA_Get_Size(fields); i < max; i++) {
CharBuf *field = (CharBuf*)VA_Fetch(fields, i);
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Search/QueryParser/QueryLexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.c b/core/Lucy/Search/QueryParser/QueryLexer.c
index e5def1c..435d43e 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.c
+++ b/core/Lucy/Search/QueryParser/QueryLexer.c
@@ -35,17 +35,17 @@
#define TOKEN_QUERY LUCY_QPARSER_TOKEN_QUERY
static ParserElem*
-S_consume_keyword(ZombieCharBuf *qstring, const char *keyword,
+S_consume_keyword(StackString *qstring, const char *keyword,
size_t keyword_len, int type);
static ParserElem*
-S_consume_field(ZombieCharBuf *qstring);
+S_consume_field(StackString *qstring);
static ParserElem*
-S_consume_text(ZombieCharBuf *qstring);
+S_consume_text(StackString *qstring);
static ParserElem*
-S_consume_quoted_string(ZombieCharBuf *qstring);
+S_consume_quoted_string(StackString *qstring);
QueryLexer*
QueryLexer_new() {
@@ -76,14 +76,14 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, const CharBuf *query_string) {
CharBuf *copy = query_string
? CB_Clone(query_string)
: CB_new_from_trusted_utf8("", 0);
- ZombieCharBuf *qstring = ZCB_WRAP((CharBuf*)copy);
+ StackString *qstring = SSTR_WRAP((CharBuf*)copy);
VArray *elems = VA_new(0);
- ZCB_Trim(qstring);
+ SStr_Trim(qstring);
- while (ZCB_Get_Size(qstring)) {
+ while (SStr_Get_Size(qstring)) {
ParserElem *elem = NULL;
- if (ZCB_Trim_Top(qstring)) {
+ if (SStr_Trim_Top(qstring)) {
// Fast-forward past whitespace.
continue;
}
@@ -95,37 +95,37 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, const CharBuf *query_string) {
}
}
- uint32_t code_point = ZCB_Code_Point_At(qstring, 0);
+ uint32_t code_point = SStr_Code_Point_At(qstring, 0);
switch (code_point) {
case '(':
- ZCB_Nip(qstring, 1);
+ SStr_Nip(qstring, 1);
elem = ParserElem_new(TOKEN_OPEN_PAREN, NULL);
break;
case ')':
- ZCB_Nip(qstring, 1);
+ SStr_Nip(qstring, 1);
elem = ParserElem_new(TOKEN_CLOSE_PAREN, NULL);
break;
case '+':
- if (ZCB_Get_Size(qstring) > 1
- && !StrHelp_is_whitespace(ZCB_Code_Point_At(qstring, 1))
+ if (SStr_Get_Size(qstring) > 1
+ && !StrHelp_is_whitespace(SStr_Code_Point_At(qstring, 1))
) {
elem = ParserElem_new(TOKEN_PLUS, NULL);
}
else {
elem = ParserElem_new(TOKEN_STRING, (Obj*)CB_newf("+"));
}
- ZCB_Nip(qstring, 1);
+ SStr_Nip(qstring, 1);
break;
case '-':
- if (ZCB_Get_Size(qstring) > 1
- && !StrHelp_is_whitespace(ZCB_Code_Point_At(qstring, 1))
+ if (SStr_Get_Size(qstring) > 1
+ && !StrHelp_is_whitespace(SStr_Code_Point_At(qstring, 1))
) {
elem = ParserElem_new(TOKEN_MINUS, NULL);
}
else {
elem = ParserElem_new(TOKEN_STRING, (Obj*)CB_newf("-"));
}
- ZCB_Nip(qstring, 1);
+ SStr_Nip(qstring, 1);
break;
case '"':
elem = S_consume_quoted_string(qstring);
@@ -161,12 +161,12 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, const CharBuf *query_string) {
static ParserElem*
-S_consume_keyword(ZombieCharBuf *qstring, const char *keyword,
+S_consume_keyword(StackString *qstring, const char *keyword,
size_t keyword_len, int type) {
- if (!ZCB_Starts_With_Str(qstring, keyword, keyword_len)) {
+ if (!SStr_Starts_With_Str(qstring, keyword, keyword_len)) {
return NULL;
}
- uint32_t lookahead = ZCB_Code_Point_At(qstring, keyword_len);
+ uint32_t lookahead = SStr_Code_Point_At(qstring, keyword_len);
if (!lookahead) {
return NULL;
}
@@ -177,18 +177,18 @@ S_consume_keyword(ZombieCharBuf *qstring, const char *keyword,
|| lookahead == '+'
|| lookahead == '-'
) {
- ZCB_Nip(qstring, keyword_len);
+ SStr_Nip(qstring, keyword_len);
return ParserElem_new(type, NULL);
}
return NULL;
}
static ParserElem*
-S_consume_field(ZombieCharBuf *qstring) {
+S_consume_field(StackString *qstring) {
size_t tick = 0;
// Field names constructs must start with a letter or underscore.
- uint32_t code_point = ZCB_Code_Point_At(qstring, tick);
+ uint32_t code_point = SStr_Code_Point_At(qstring, tick);
if (isalpha(code_point) || code_point == '_') {
tick++;
}
@@ -198,7 +198,7 @@ S_consume_field(ZombieCharBuf *qstring) {
// Only alphanumerics and underscores are allowed in field names.
while (1) {
- code_point = ZCB_Code_Point_At(qstring, tick);
+ code_point = SStr_Code_Point_At(qstring, tick);
if (isalnum(code_point) || code_point == '_') {
tick++;
}
@@ -212,7 +212,7 @@ S_consume_field(ZombieCharBuf *qstring) {
}
// Field name constructs must be followed by something sensible.
- uint32_t lookahead = ZCB_Code_Point_At(qstring, tick);
+ uint32_t lookahead = SStr_Code_Point_At(qstring, tick);
if (!(isalnum(lookahead)
|| lookahead == '_'
|| lookahead > 127
@@ -224,20 +224,20 @@ S_consume_field(ZombieCharBuf *qstring) {
}
// Consume string data.
- ZombieCharBuf *field = ZCB_WRAP((CharBuf*)qstring);
- ZCB_Truncate(field, tick - 1);
- ZCB_Nip(qstring, tick);
- return ParserElem_new(TOKEN_FIELD, (Obj*)ZCB_Clone(field));
+ StackString *field = SSTR_WRAP((CharBuf*)qstring);
+ SStr_Truncate(field, tick - 1);
+ SStr_Nip(qstring, tick);
+ return ParserElem_new(TOKEN_FIELD, (Obj*)SStr_Clone(field));
}
static ParserElem*
-S_consume_text(ZombieCharBuf *qstring) {
- ZombieCharBuf *text = ZCB_WRAP((CharBuf*)qstring);
+S_consume_text(StackString *qstring) {
+ StackString *text = SSTR_WRAP((CharBuf*)qstring);
size_t tick = 0;
while (1) {
- uint32_t code_point = ZCB_Nibble(qstring);
+ uint32_t code_point = SStr_Nibble(qstring);
if (code_point == '\\') {
- code_point = ZCB_Nibble(qstring);
+ code_point = SStr_Nibble(qstring);
tick++;
if (code_point == 0) {
break;
@@ -254,20 +254,20 @@ S_consume_text(ZombieCharBuf *qstring) {
tick++;
}
- ZCB_Truncate(text, tick);
- return ParserElem_new(TOKEN_STRING, (Obj*)ZCB_Clone(text));
+ SStr_Truncate(text, tick);
+ return ParserElem_new(TOKEN_STRING, (Obj*)SStr_Clone(text));
}
static ParserElem*
-S_consume_quoted_string(ZombieCharBuf *qstring) {
- ZombieCharBuf *text = ZCB_WRAP((CharBuf*)qstring);
- if (ZCB_Nibble(qstring) != '"') {
+S_consume_quoted_string(StackString *qstring) {
+ StackString *text = SSTR_WRAP((CharBuf*)qstring);
+ if (SStr_Nibble(qstring) != '"') {
THROW(ERR, "Internal error: expected a quote");
}
size_t tick = 1;
while (1) {
- uint32_t code_point = ZCB_Nibble(qstring);
+ uint32_t code_point = SStr_Nibble(qstring);
if (code_point == '"') {
tick += 1;
break;
@@ -276,7 +276,7 @@ S_consume_quoted_string(ZombieCharBuf *qstring) {
break;
}
else if (code_point == '\\') {
- ZCB_Nibble(qstring);
+ SStr_Nibble(qstring);
tick += 2;
}
else {
@@ -284,7 +284,7 @@ S_consume_quoted_string(ZombieCharBuf *qstring) {
}
}
- ZCB_Truncate(text, tick);
- return ParserElem_new(TOKEN_STRING, (Obj*)ZCB_Clone(text));
+ SStr_Truncate(text, tick);
+ return ParserElem_new(TOKEN_STRING, (Obj*)SStr_Clone(text));
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Store/CompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c
index cd59e0d..ccf1c02 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);
- CharBuf *cfmeta_file = (CharBuf*)ZCB_WRAP_STR("cfmeta.json", 11);
+ CharBuf *cfmeta_file = (CharBuf*)SSTR_WRAP_STR("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.
- CharBuf *cf_file = (CharBuf*)ZCB_WRAP_STR("cf.dat", 6);
+ CharBuf *cf_file = (CharBuf*)SSTR_WRAP_STR("cf.dat", 6);
ivars->instream = Folder_Open_In(folder, cf_file);
if (!ivars->instream) {
ERR_ADD_FRAME(Err_get_error());
@@ -87,17 +87,17 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
// Strip directory name from filepaths for old format.
if (ivars->format == 1) {
VArray *files = Hash_Keys(ivars->records);
- ZombieCharBuf *filename = ZCB_BLANK();
- ZombieCharBuf *folder_name
- = IxFileNames_local_part(Folder_Get_Path(folder), ZCB_BLANK());
- size_t folder_name_len = ZCB_Length(folder_name);
+ StackString *filename = SStr_BLANK();
+ StackString *folder_name
+ = IxFileNames_local_part(Folder_Get_Path(folder), SStr_BLANK());
+ size_t folder_name_len = SStr_Length(folder_name);
for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) {
CharBuf *orig = (CharBuf*)VA_Fetch(files, i);
if (CB_Starts_With(orig, (CharBuf*)folder_name)) {
Obj *record = Hash_Delete(ivars->records, (Obj*)orig);
- ZCB_Assign(filename, orig);
- ZCB_Nip(filename, folder_name_len + sizeof(DIR_SEP) - 1);
+ SStr_Assign(filename, orig);
+ SStr_Nip(filename, folder_name_len + sizeof(DIR_SEP) - 1);
Hash_Store(ivars->records, (Obj*)filename, (Obj*)record);
}
}
@@ -166,11 +166,11 @@ CFReader_Local_Delete_IMP(CompoundFileReader *self, const CharBuf *name) {
// Once the number of virtual files falls to 0, remove the compound
// files.
if (Hash_Get_Size(ivars->records) == 0) {
- CharBuf *cf_file = (CharBuf*)ZCB_WRAP_STR("cf.dat", 6);
+ CharBuf *cf_file = (CharBuf*)SSTR_WRAP_STR("cf.dat", 6);
if (!Folder_Delete(ivars->real_folder, cf_file)) {
return false;
}
- CharBuf *cfmeta_file = (CharBuf*)ZCB_WRAP_STR("cfmeta.json", 11);
+ CharBuf *cfmeta_file = (CharBuf*)SSTR_WRAP_STR("cfmeta.json", 11);
if (!Folder_Delete(ivars->real_folder, cfmeta_file)) {
return false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Store/CompoundFileWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileWriter.c b/core/Lucy/Store/CompoundFileWriter.c
index 0337605..4516ecb 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);
- CharBuf *cfmeta_file = (CharBuf*)ZCB_WRAP_STR("cfmeta.json", 11);
+ CharBuf *cfmeta_file = (CharBuf*)SSTR_WRAP_STR("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;
- CharBuf *cfmeta_temp = (CharBuf*)ZCB_WRAP_STR("cfmeta.json.temp", 16);
- CharBuf *cf_file = (CharBuf*)ZCB_WRAP_STR("cf.dat", 6);
+ CharBuf *cfmeta_temp = (CharBuf*)SSTR_WRAP_STR("cfmeta.json.temp", 16);
+ CharBuf *cf_file = (CharBuf*)SSTR_WRAP_STR("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));
- CharBuf *cf_file = (CharBuf*)ZCB_WRAP_STR("cf.dat", 6);
+ CharBuf *cf_file = (CharBuf*)SSTR_WRAP_STR("cf.dat", 6);
OutStream *outstream = Folder_Open_Out(folder, (CharBuf*)cf_file);
bool rename_success;
@@ -143,8 +143,8 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
}
// Write metadata to cfmeta file.
- CharBuf *cfmeta_temp = (CharBuf*)ZCB_WRAP_STR("cfmeta.json.temp", 16);
- CharBuf *cfmeta_file = (CharBuf*)ZCB_WRAP_STR("cfmeta.json", 11);
+ CharBuf *cfmeta_temp = (CharBuf*)SSTR_WRAP_STR("cfmeta.json.temp", 16);
+ CharBuf *cfmeta_file = (CharBuf*)SSTR_WRAP_STR("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/a7926f49/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index d9cc23a..6dd0ee3 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -251,7 +251,7 @@ FSFolder_Local_Find_Folder_IMP(FSFolder *self, const CharBuf *name) {
}
// Try to open a CompoundFileReader. On failure, just use the
// existing folder.
- CharBuf *cfmeta_file = (CharBuf*)ZCB_WRAP_STR("cfmeta.json", 11);
+ CharBuf *cfmeta_file = (CharBuf*)SSTR_WRAP_STR("cfmeta.json", 11);
if (Folder_Local_Exists(subfolder, cfmeta_file)) {
CompoundFileReader *cf_reader = CFReader_open(subfolder);
if (cf_reader) {
@@ -297,9 +297,9 @@ S_create_dir(const CharBuf *path) {
static bool
S_is_local_entry(const CharBuf *path) {
- ZombieCharBuf *scratch = ZCB_WRAP(path);
+ StackString *scratch = SSTR_WRAP(path);
uint32_t code_point;
- while (0 != (code_point = ZCB_Nibble(scratch))) {
+ while (0 != (code_point = SStr_Nibble(scratch))) {
if (code_point == '/') { return false; }
}
return true;
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index b9a7d39..b3c29d7 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -67,7 +67,7 @@ Folder_Open_In_IMP(Folder *self, const CharBuf *path) {
InStream *instream = NULL;
if (enclosing_folder) {
- ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
+ StackString *name = IxFileNames_local_part(path, SStr_BLANK());
instream = Folder_Local_Open_In(enclosing_folder, (CharBuf*)name);
if (!instream) {
ERR_ADD_FRAME(Err_get_error());
@@ -125,7 +125,7 @@ Folder_Open_FileHandle_IMP(Folder *self, const CharBuf *path,
FileHandle *fh = NULL;
if (enclosing_folder) {
- ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
+ StackString *name = IxFileNames_local_part(path, SStr_BLANK());
fh = Folder_Local_Open_FileHandle(enclosing_folder,
(CharBuf*)name, flags);
if (!fh) {
@@ -143,7 +143,7 @@ bool
Folder_Delete_IMP(Folder *self, const CharBuf *path) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
if (enclosing_folder) {
- ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
+ StackString *name = IxFileNames_local_part(path, SStr_BLANK());
bool result = Folder_Local_Delete(enclosing_folder, (CharBuf*)name);
return result;
}
@@ -160,7 +160,7 @@ Folder_Delete_Tree_IMP(Folder *self, const CharBuf *path) {
if (!path || !CB_Get_Size(path)) { return false; }
if (enclosing_folder) {
- ZombieCharBuf *local = IxFileNames_local_part(path, ZCB_BLANK());
+ StackString *local = IxFileNames_local_part(path, SStr_BLANK());
if (Folder_Local_Is_Directory(enclosing_folder, (CharBuf*)local)) {
Folder *inner_folder
= Folder_Local_Find_Folder(enclosing_folder, (CharBuf*)local);
@@ -258,7 +258,7 @@ Folder_Open_Dir_IMP(Folder *self, const CharBuf *path) {
folder = Folder_Find_Folder(self, path);
}
else {
- ZombieCharBuf *empty = ZCB_BLANK();
+ StackString *empty = SStr_BLANK();
folder = Folder_Find_Folder(self, (CharBuf*)empty);
}
if (!folder) {
@@ -286,7 +286,7 @@ Folder_MkDir_IMP(Folder *self, const CharBuf *path) {
path)));
}
else {
- ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
+ StackString *name = IxFileNames_local_part(path, SStr_BLANK());
result = Folder_Local_MkDir(enclosing_folder, (CharBuf*)name);
if (!result) {
ERR_ADD_FRAME(Err_get_error());
@@ -301,7 +301,7 @@ Folder_Exists_IMP(Folder *self, const CharBuf *path) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
bool retval = false;
if (enclosing_folder) {
- ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
+ StackString *name = IxFileNames_local_part(path, SStr_BLANK());
if (Folder_Local_Exists(enclosing_folder, (CharBuf*)name)) {
retval = true;
}
@@ -314,7 +314,7 @@ Folder_Is_Directory_IMP(Folder *self, const CharBuf *path) {
Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
bool retval = false;
if (enclosing_folder) {
- ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
+ StackString *name = IxFileNames_local_part(path, SStr_BLANK());
if (Folder_Local_Is_Directory(enclosing_folder, (CharBuf*)name)) {
retval = true;
}
@@ -412,7 +412,7 @@ Folder_Consolidate_IMP(Folder *self, const CharBuf *path) {
CFWriter_Consolidate(cf_writer);
DECREF(cf_writer);
if (CB_Get_Size(path)) {
- ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
+ StackString *name = IxFileNames_local_part(path, SStr_BLANK());
CompoundFileReader *cf_reader = CFReader_open(folder);
if (!cf_reader) { RETHROW(INCREF(Err_get_error())); }
Hash *entries = Folder_IVARS(enclosing_folder)->entries;
@@ -423,27 +423,27 @@ Folder_Consolidate_IMP(Folder *self, const CharBuf *path) {
}
static Folder*
-S_enclosing_folder(Folder *self, ZombieCharBuf *path) {
+S_enclosing_folder(Folder *self, StackString *path) {
size_t path_component_len = 0;
uint32_t code_point;
// Strip trailing slash.
- if (ZCB_Code_Point_From(path, 0) == '/') { ZCB_Chop(path, 1); }
+ if (SStr_Code_Point_From(path, 0) == '/') { SStr_Chop(path, 1); }
// Find first component of the file path.
- ZombieCharBuf *scratch = ZCB_WRAP((CharBuf*)path);
- ZombieCharBuf *path_component = ZCB_WRAP((CharBuf*)path);
- while (0 != (code_point = ZCB_Nibble(scratch))) {
+ StackString *scratch = SSTR_WRAP((CharBuf*)path);
+ StackString *path_component = SSTR_WRAP((CharBuf*)path);
+ while (0 != (code_point = SStr_Nibble(scratch))) {
if (code_point == '/') {
- ZCB_Truncate(path_component, path_component_len);
- ZCB_Nip(path, path_component_len + 1);
+ SStr_Truncate(path_component, path_component_len);
+ SStr_Nip(path, path_component_len + 1);
break;
}
path_component_len++;
}
// If we've eaten up the entire filepath, self is enclosing folder.
- if (ZCB_Get_Size(scratch) == 0) { return self; }
+ if (SStr_Get_Size(scratch) == 0) { return self; }
Folder *local_folder
= Folder_Local_Find_Folder(self, (CharBuf*)path_component);
@@ -461,7 +461,7 @@ S_enclosing_folder(Folder *self, ZombieCharBuf *path) {
Folder*
Folder_Enclosing_Folder_IMP(Folder *self, const CharBuf *path) {
- ZombieCharBuf *scratch = ZCB_WRAP(path);
+ StackString *scratch = SSTR_WRAP(path);
return S_enclosing_folder(self, scratch);
}
@@ -471,7 +471,7 @@ Folder_Find_Folder_IMP(Folder *self, const CharBuf *path) {
return self;
}
else {
- ZombieCharBuf *scratch = ZCB_WRAP(path);
+ StackString *scratch = SSTR_WRAP(path);
Folder *enclosing_folder = S_enclosing_folder(self, scratch);
if (!enclosing_folder) {
return NULL;
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index 71a6f49..e7fb7a1 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -39,9 +39,9 @@ Lock_init(Lock *self, Folder *folder, const CharBuf *name,
DECREF(self);
THROW(ERR, "Invalid value for 'interval': %i32", interval);
}
- ZombieCharBuf *scratch = ZCB_WRAP(name);
+ StackString *scratch = SSTR_WRAP(name);
uint32_t code_point;
- while (0 != (code_point = ZCB_Nibble(scratch))) {
+ while (0 != (code_point = SStr_Nibble(scratch))) {
if (isalnum(code_point)
|| code_point == '.'
|| code_point == '-'
@@ -147,7 +147,7 @@ LFLock_Request_IMP(LockFileLock *self) {
}
// Create the "locks" subdirectory if necessary.
- CharBuf *lock_dir_name = (CharBuf*)ZCB_WRAP_STR("locks", 5);
+ CharBuf *lock_dir_name = (CharBuf*)SSTR_WRAP_STR("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);
@@ -230,15 +230,15 @@ LFLock_Maybe_Delete_File_IMP(LockFileLock *self, const CharBuf *path,
LockFileLockIVARS *const ivars = LFLock_IVARS(self);
Folder *folder = ivars->folder;
bool success = false;
- ZombieCharBuf *scratch = ZCB_WRAP(path);
+ StackString *scratch = SSTR_WRAP(path);
// Only delete locks that start with our lock name.
- CharBuf *lock_dir_name = (CharBuf*)ZCB_WRAP_STR("locks", 5);
- if (!ZCB_Starts_With(scratch, lock_dir_name)) {
+ CharBuf *lock_dir_name = (CharBuf*)SSTR_WRAP_STR("locks", 5);
+ if (!SStr_Starts_With(scratch, lock_dir_name)) {
return false;
}
- ZCB_Nip(scratch, CB_Get_Size(lock_dir_name) + 1);
- if (!ZCB_Starts_With(scratch, ivars->name)) {
+ SStr_Nip(scratch, CB_Get_Size(lock_dir_name) + 1);
+ if (!SStr_Starts_With(scratch, ivars->name)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/a7926f49/core/Lucy/Store/RAMFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFolder.c b/core/Lucy/Store/RAMFolder.c
index d25fb78..bf9600f 100644
--- a/core/Lucy/Store/RAMFolder.c
+++ b/core/Lucy/Store/RAMFolder.c
@@ -141,7 +141,7 @@ RAMFolder_Local_Is_Directory_IMP(RAMFolder *self, const CharBuf *name) {
static bool
S_rename_or_hard_link(RAMFolder *self, const CharBuf* from, const CharBuf *to,
Folder *from_folder, Folder *to_folder,
- ZombieCharBuf *from_name, ZombieCharBuf *to_name,
+ StackString *from_name, StackString *to_name,
int op) {
Obj *elem = NULL;
RAMFolder *inner_from_folder = NULL;
@@ -210,7 +210,7 @@ S_rename_or_hard_link(RAMFolder *self, const CharBuf* from, const CharBuf *to,
// Return success fast if file is copied on top of itself.
if (inner_from_folder == inner_to_folder
- && ZCB_Equals(from_name, (Obj*)to_name)
+ && SStr_Equals(from_name, (Obj*)to_name)
) {
return true;
}
@@ -278,8 +278,8 @@ RAMFolder_Rename_IMP(RAMFolder *self, const CharBuf* from,
const CharBuf *to) {
Folder *from_folder = RAMFolder_Enclosing_Folder(self, from);
Folder *to_folder = RAMFolder_Enclosing_Folder(self, to);
- ZombieCharBuf *from_name = IxFileNames_local_part(from, ZCB_BLANK());
- ZombieCharBuf *to_name = IxFileNames_local_part(to, ZCB_BLANK());
+ StackString *from_name = IxFileNames_local_part(from, SStr_BLANK());
+ StackString *to_name = IxFileNames_local_part(to, SStr_BLANK());
bool result = S_rename_or_hard_link(self, from, to, from_folder,
to_folder, from_name, to_name,
OP_RENAME);
@@ -292,8 +292,8 @@ RAMFolder_Hard_Link_IMP(RAMFolder *self, const CharBuf *from,
const CharBuf *to) {
Folder *from_folder = RAMFolder_Enclosing_Folder(self, from);
Folder *to_folder = RAMFolder_Enclosing_Folder(self, to);
- ZombieCharBuf *from_name = IxFileNames_local_part(from, ZCB_BLANK());
- ZombieCharBuf *to_name = IxFileNames_local_part(to, ZCB_BLANK());
+ StackString *from_name = IxFileNames_local_part(from, SStr_BLANK());
+ StackString *to_name = IxFileNames_local_part(to, SStr_BLANK());
bool result = S_rename_or_hard_link(self, from, to, from_folder,
to_folder, from_name, to_name,
OP_HARD_LINK);