Repository: lucy
Updated Branches:
  refs/heads/master cd34d6b8d -> 555e275fb


Eliminate StackString


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/555e275f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/555e275f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/555e275f

Branch: refs/heads/master
Commit: 555e275fb611f95cbf9cb9311d2167ba9a12a8f2
Parents: cd34d6b
Author: Nick Wellnhofer <[email protected]>
Authored: Sun May 10 23:08:12 2015 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Sun May 10 23:08:12 2015 +0200

----------------------------------------------------------------------
 c/src/Lucy/Index/DocReader.c                    |  5 ++--
 core/Lucy/Index/FilePurger.c                    |  4 +--
 core/Lucy/Index/IndexManager.c                  | 27 ++++++++++----------
 core/Lucy/Index/PolyReader.c                    |  8 +++---
 core/Lucy/Index/Segment.c                       |  4 +--
 core/Lucy/Plan/Schema.c                         |  8 +++---
 core/Lucy/Store/Folder.c                        |  4 +--
 core/Lucy/Test/Analysis/TestRegexTokenizer.c    |  6 ++---
 core/Lucy/Test/Analysis/TestStandardTokenizer.c |  4 +--
 core/Lucy/Test/Index/TestSegment.c              | 22 ++++++++--------
 core/Lucy/Test/Index/TestSortWriter.c           |  4 +--
 core/Lucy/Test/Plan/TestFieldType.c             | 19 ++++++--------
 core/Lucy/Test/Plan/TestFullTextType.c          | 13 ++++------
 core/Lucy/Test/Search/TestQueryParserLogic.c    |  4 +--
 core/Lucy/Test/Search/TestSortSpec.c            |  2 +-
 core/Lucy/Test/Store/TestCompoundFileReader.c   |  4 +--
 core/Lucy/Test/Store/TestFileHandle.c           | 12 ++++-----
 core/Lucy/Test/Store/TestFolderCommon.c         |  4 +--
 core/Lucy/Test/Store/TestInStream.c             |  8 +++---
 core/Lucy/Test/Store/TestRAMFolder.c            |  4 +--
 core/Lucy/Test/Util/TestIndexFileNames.c        |  9 +++----
 core/Lucy/Test/Util/TestJson.c                  |  4 +--
 core/Lucy/Util/Json.c                           |  4 +--
 perl/buildlib/Lucy/Build/Binding/Misc.pm        |  5 ++--
 perl/xs/Lucy/Index/DocReader.c                  |  4 +--
 perl/xs/Lucy/Index/Inverter.c                   | 12 ++++-----
 26 files changed, 95 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index a908680..59a5a10 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -65,9 +65,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.
-        StackString *field_name_str
-            = SSTR_WRAP_UTF8(field_name, field_name_len);
-        type = Schema_Fetch_Type(schema, (String*)field_name_str);
+        String *field_name_str = SSTR_WRAP_UTF8(field_name, field_name_len);
+        type = Schema_Fetch_Type(schema, 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/555e275f/core/Lucy/Index/FilePurger.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/FilePurger.c b/core/Lucy/Index/FilePurger.c
index da9a673..3e3bc28 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_UTF8("merge.json", 10);
+                String *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
                 DirHandle *dh = Folder_Open_Dir(ivars->folder, cutoff_seg);
 
                 if (!dh) {
@@ -163,7 +163,7 @@ S_zap_dead_merge(FilePurger *self, Hash *candidates) {
                 }
 
                 Hash_Store(candidates, cutoff_seg, (Obj*)CFISH_TRUE);
-                Hash_Store(candidates, (String*)merge_json, (Obj*)CFISH_TRUE);
+                Hash_Store(candidates, merge_json, (Obj*)CFISH_TRUE);
                 while (DH_Next(dh)) {
                     // TODO: recursively delete subdirs within seg dir.
                     String *entry = DH_Get_Entry(dh);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Index/IndexManager.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/IndexManager.c b/core/Lucy/Index/IndexManager.c
index 9ba2d5f..06ff53b 100644
--- a/core/Lucy/Index/IndexManager.c
+++ b/core/Lucy/Index/IndexManager.c
@@ -234,9 +234,9 @@ 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_UTF8("write", 5);
+    String *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,
+    return LockFact_Make_Lock(lock_factory, write_lock_name,
                               ivars->write_lock_timeout,
                               ivars->write_lock_interval);
 }
@@ -244,9 +244,9 @@ 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_UTF8("deletion", 8);
+    String *lock_name = SSTR_WRAP_UTF8("deletion", 8);
     LockFactory *lock_factory = S_obtain_lock_factory(self);
-    return LockFact_Make_Lock(lock_factory, (String*)lock_name,
+    return LockFact_Make_Lock(lock_factory, lock_name,
                               ivars->deletion_lock_timeout,
                               ivars->deletion_lock_interval);
 }
@@ -254,9 +254,9 @@ 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_UTF8("merge", 5);
+    String *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,
+    return LockFact_Make_Lock(lock_factory, merge_lock_name,
                               ivars->merge_lock_timeout,
                               ivars->merge_lock_interval);
 }
@@ -264,11 +264,11 @@ 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_UTF8("merge.json", 10);
+    String *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));
-    success = Json_spew_json((Obj*)data, ivars->folder, (String*)merge_json);
+    success = Json_spew_json((Obj*)data, ivars->folder, merge_json);
     DECREF(data);
     if (!success) {
         THROW(ERR, "Failed to write to %o", merge_json);
@@ -278,10 +278,9 @@ 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_UTF8("merge.json", 10);
-    if (Folder_Exists(ivars->folder, (String*)merge_json)) {
-        Hash *stuff
-            = (Hash*)Json_slurp_json(ivars->folder, (String*)merge_json);
+    String *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
+    if (Folder_Exists(ivars->folder, merge_json)) {
+        Hash *stuff = (Hash*)Json_slurp_json(ivars->folder, merge_json);
         if (stuff) {
             CERTIFY(stuff, HASH);
             return stuff;
@@ -298,8 +297,8 @@ 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_UTF8("merge.json", 10);
-    return Folder_Delete(ivars->folder, (String*)merge_json) != 0;
+    String *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
+    return Folder_Delete(ivars->folder, merge_json) != 0;
 }
 
 Lock*

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Index/PolyReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyReader.c b/core/Lucy/Index/PolyReader.c
index b3af7fa..4133569 100644
--- a/core/Lucy/Index/PolyReader.c
+++ b/core/Lucy/Index/PolyReader.c
@@ -384,10 +384,10 @@ PolyReader_do_open(PolyReader *self, Obj *index, Snapshot 
*snapshot,
 
         // Testing only.
         if (PolyReader_race_condition_debug1) {
-            StackString *temp = SSTR_WRAP_UTF8("temp", 4);
-            if (Folder_Exists(folder, (String*)temp)) {
-                bool success = Folder_Rename(folder, (String*)temp,
-                                               
PolyReader_race_condition_debug1);
+            String *temp = SSTR_WRAP_UTF8("temp", 4);
+            if (Folder_Exists(folder, temp)) {
+                bool success = Folder_Rename(folder, temp,
+                                             PolyReader_race_condition_debug1);
                 if (!success) { RETHROW(INCREF(Err_get_error())); }
             }
             PolyReader_debug1_num_passes++;

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Index/Segment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c
index 17a3a5f..0e96acb 100644
--- a/core/Lucy/Index/Segment.c
+++ b/core/Lucy/Index/Segment.c
@@ -211,8 +211,8 @@ Seg_Store_Metadata_IMP(Segment *self, 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_UTF8((char*)key, key_len);
-    Seg_Store_Metadata(self, (String*)k, value);
+    String *k = SSTR_WRAP_UTF8((char*)key, key_len);
+    Seg_Store_Metadata(self, k, value);
 }
 
 Obj*

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Plan/Schema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.c b/core/Lucy/Plan/Schema.c
index 5c40b04..db3a838 100644
--- a/core/Lucy/Plan/Schema.c
+++ b/core/Lucy/Plan/Schema.c
@@ -422,11 +422,11 @@ Schema_Eat_IMP(Schema *self, Schema *other) {
 void
 Schema_Write_IMP(Schema *self, Folder *folder, String *filename) {
     Hash *dump = Schema_Dump(self);
-    StackString *schema_temp = SSTR_WRAP_UTF8("schema.temp", 11);
+    String *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);
-    success = Folder_Rename(folder, (String*)schema_temp, filename);
+    Folder_Delete(folder, schema_temp); // Just in case.
+    Json_spew_json((Obj*)dump, folder, schema_temp);
+    success = Folder_Rename(folder, schema_temp, filename);
     DECREF(dump);
     if (!success) { RETHROW(INCREF(Err_get_error())); }
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index 244446a..ccdde5a 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -265,8 +265,8 @@ Folder_Open_Dir_IMP(Folder *self, String *path) {
         folder = Folder_Find_Folder(self, path);
     }
     else {
-        StackString *empty = SSTR_BLANK();
-        folder = Folder_Find_Folder(self, (String*)empty);
+        String *empty = SSTR_BLANK();
+        folder = Folder_Find_Folder(self, empty);
     }
     if (!folder) {
         Err_set_error(Err_new(Str_newf("Invalid path: '%o'", path)));

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Analysis/TestRegexTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestRegexTokenizer.c 
b/core/Lucy/Test/Analysis/TestRegexTokenizer.c
index ae80921..d1873b1 100644
--- a/core/Lucy/Test/Analysis/TestRegexTokenizer.c
+++ b/core/Lucy/Test/Analysis/TestRegexTokenizer.c
@@ -36,12 +36,10 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
         return;
     }
 
-    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_new(SSTR_WRAP_UTF8("\\w+", 3));
     RegexTokenizer *whitespace_tokenizer
-        = RegexTokenizer_new((String*)whitespace_pattern);
+        = RegexTokenizer_new(SSTR_WRAP_UTF8("\\S+", 3));
     Obj *word_char_dump  = RegexTokenizer_Dump(word_char_tokenizer);
     Obj *whitespace_dump = RegexTokenizer_Dump(whitespace_tokenizer);
     RegexTokenizer *word_char_clone

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Analysis/TestStandardTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestStandardTokenizer.c 
b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
index 918e184..54e0b0e 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_UTF8(
+    String *word = SSTR_WRAP_UTF8(
                               " ."
                               "tha\xCC\x82t's"
                               ":"
@@ -61,7 +61,7 @@ test_tokenizer(TestBatchRunner *runner) {
                               "a"
                               "/",
                               35);
-    Vector *got = StandardTokenizer_Split(tokenizer, (String*)word);
+    Vector *got = StandardTokenizer_Split(tokenizer, word);
     String *token = (String*)Vec_Fetch(got, 0);
     TEST_TRUE(runner,
               token

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Index/TestSegment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSegment.c 
b/core/Lucy/Test/Index/TestSegment.c
index 6bdebfe..aafeef9 100644
--- a/core/Lucy/Test/Index/TestSegment.c
+++ b/core/Lucy/Test/Index/TestSegment.c
@@ -32,27 +32,27 @@ TestSeg_new() {
 static void
 test_fields(TestBatchRunner *runner) {
     Segment *segment = Seg_new(1);
-    StackString *foo = SSTR_WRAP_UTF8("foo", 3);
-    StackString *bar = SSTR_WRAP_UTF8("bar", 3);
-    StackString *baz = SSTR_WRAP_UTF8("baz", 3);
+    String *foo = SSTR_WRAP_UTF8("foo", 3);
+    String *bar = SSTR_WRAP_UTF8("bar", 3);
+    String *baz = SSTR_WRAP_UTF8("baz", 3);
     int32_t field_num;
 
-    field_num = Seg_Add_Field(segment, (String*)foo);
+    field_num = Seg_Add_Field(segment, foo);
     TEST_TRUE(runner, field_num == 1,
               "Add_Field returns field number, and field numbers start at 1");
-    field_num = Seg_Add_Field(segment, (String*)bar);
+    field_num = Seg_Add_Field(segment, bar);
     TEST_TRUE(runner, field_num == 2, "add a second field");
-    field_num = Seg_Add_Field(segment, (String*)foo);
+    field_num = Seg_Add_Field(segment, foo);
     TEST_TRUE(runner, field_num == 1,
               "Add_Field returns existing field number if field is already 
known");
 
-    TEST_TRUE(runner, SStr_Equals(bar, (Obj*)Seg_Field_Name(segment, 2)),
+    TEST_TRUE(runner, Str_Equals(bar, (Obj*)Seg_Field_Name(segment, 2)),
               "Field_Name");
     TEST_TRUE(runner, Seg_Field_Name(segment, 3) == NULL,
               "Field_Name returns NULL for unknown field number");
-    TEST_TRUE(runner, Seg_Field_Num(segment, (String*)bar) == 2,
+    TEST_TRUE(runner, Seg_Field_Num(segment, bar) == 2,
               "Field_Num");
-    TEST_TRUE(runner, Seg_Field_Num(segment, (String*)baz) == 0,
+    TEST_TRUE(runner, Seg_Field_Num(segment, baz) == 0,
               "Field_Num returns 0 for unknown field name");
 
     DECREF(segment);
@@ -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_UTF8("flotsam", 7);
-    String    *jetsam  = (String*)SSTR_WRAP_UTF8("jetsam", 6);
+    String    *flotsam = SSTR_WRAP_UTF8("flotsam", 7);
+    String    *jetsam  = 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/555e275f/core/Lucy/Test/Index/TestSortWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSortWriter.c 
b/core/Lucy/Test/Index/TestSortWriter.c
index 4127d3e..bfac610 100644
--- a/core/Lucy/Test/Index/TestSortWriter.c
+++ b/core/Lucy/Test/Index/TestSortWriter.c
@@ -108,7 +108,7 @@ S_create_schema() {
 static void
 S_store_field(Doc *doc, String *field, const char *value) {
     if (value) {
-        StackString *string = SSTR_WRAP_UTF8(value, strlen(value));
+        String *string = SSTR_WRAP_UTF8(value, strlen(value));
         Doc_Store(doc, field, (Obj*)string);
     }
 }
@@ -231,7 +231,7 @@ test_sort_writer(TestBatchRunner *runner) {
     {
         // Consolidate everything, to test merging.
         Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
-        StackString *bike_str = SSTR_WRAP_UTF8("bike", 4);
+        String *bike_str = SSTR_WRAP_UTF8("bike", 4);
         Indexer_Delete_By_Term(indexer, name_str, (Obj*)bike_str);
         // no "wheels" field -- test NULL/undef
         S_add_doc(indexer, "elephant", "0020", "6000", "land", NULL, NULL);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Plan/TestFieldType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFieldType.c 
b/core/Lucy/Test/Plan/TestFieldType.c
index 2636259..f4c658d 100644
--- a/core/Lucy/Test/Plan/TestFieldType.c
+++ b/core/Lucy/Test/Plan/TestFieldType.c
@@ -37,8 +37,8 @@ DummyFieldType_new() {
 
 static FieldType*
 S_alt_field_type() {
-    StackString *name = SSTR_WRAP_UTF8("DummyFieldType2", 15);
-    Class *klass = Class_singleton((String*)name, DUMMYFIELDTYPE);
+    String *name = SSTR_WRAP_UTF8("DummyFieldType2", 15);
+    Class *klass = Class_singleton(name, DUMMYFIELDTYPE);
     FieldType *self = (FieldType*)Class_Make_Obj(klass);
     return FType_init(self);
 }
@@ -83,18 +83,15 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
 
 static void
 test_Compare_Values(TestBatchRunner *runner) {
-    FieldType     *type = (FieldType*)DummyFieldType_new();
-    StackString *a    = SSTR_WRAP_UTF8("a", 1);
-    StackString *b    = SSTR_WRAP_UTF8("b", 1);
+    FieldType *type = (FieldType*)DummyFieldType_new();
+    Obj       *a    = (Obj*)SSTR_WRAP_UTF8("a", 1);
+    Obj       *b    = (Obj*)SSTR_WRAP_UTF8("b", 1);
 
-    TEST_TRUE(runner,
-              FType_Compare_Values(type, (Obj*)a, (Obj*)b) < 0,
+    TEST_TRUE(runner, FType_Compare_Values(type, a, b) < 0,
               "a less than b");
-    TEST_TRUE(runner,
-              FType_Compare_Values(type, (Obj*)b, (Obj*)a) > 0,
+    TEST_TRUE(runner, FType_Compare_Values(type, b, a) > 0,
               "b greater than a");
-    TEST_TRUE(runner,
-              FType_Compare_Values(type, (Obj*)b, (Obj*)b) == 0,
+    TEST_TRUE(runner, FType_Compare_Values(type, b, b) == 0,
               "b equals b");
 
     DECREF(type);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Plan/TestFullTextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFullTextType.c 
b/core/Lucy/Test/Plan/TestFullTextType.c
index be50dc0..f27c718 100644
--- a/core/Lucy/Test/Plan/TestFullTextType.c
+++ b/core/Lucy/Test/Plan/TestFullTextType.c
@@ -88,17 +88,14 @@ static void
 test_Compare_Values(TestBatchRunner *runner) {
     StandardTokenizer *tokenizer = StandardTokenizer_new();
     FullTextType      *type      = FullTextType_new((Analyzer*)tokenizer);
-    StackString       *a         = SSTR_WRAP_UTF8("a", 1);
-    StackString       *b         = SSTR_WRAP_UTF8("b", 1);
+    Obj *a = (Obj*)SSTR_WRAP_UTF8("a", 1);
+    Obj *b = (Obj*)SSTR_WRAP_UTF8("b", 1);
 
-    TEST_TRUE(runner,
-              FullTextType_Compare_Values(type, (Obj*)a, (Obj*)b) < 0,
+    TEST_TRUE(runner, FullTextType_Compare_Values(type, a, b) < 0,
               "a less than b");
-    TEST_TRUE(runner,
-              FullTextType_Compare_Values(type, (Obj*)b, (Obj*)a) > 0,
+    TEST_TRUE(runner, FullTextType_Compare_Values(type, b, a) > 0,
               "b greater than a");
-    TEST_TRUE(runner,
-              FullTextType_Compare_Values(type, (Obj*)b, (Obj*)b) == 0,
+    TEST_TRUE(runner, FullTextType_Compare_Values(type, b, b) == 0,
               "b equals b");
 
     DECREF(type);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Search/TestQueryParserLogic.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserLogic.c 
b/core/Lucy/Test/Search/TestQueryParserLogic.c
index e4cd66d..ace8aa8 100644
--- a/core/Lucy/Test/Search/TestQueryParserLogic.c
+++ b/core/Lucy/Test/Search/TestQueryParserLogic.c
@@ -890,9 +890,9 @@ 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_UTF8("AND", 3);
+    String        *AND        = SSTR_WRAP_UTF8("AND", 3);
     QueryParser   *and_parser = QParser_new(IxSearcher_Get_Schema(searcher),
-                                            NULL, (String*)AND, NULL);
+                                            NULL, AND, NULL);
     QParser_Set_Heed_Colons(or_parser, true);
     QParser_Set_Heed_Colons(and_parser, true);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c 
b/core/Lucy/Test/Search/TestSortSpec.c
index fb84516..a148d9a 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -432,7 +432,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_UTF8(name_buf, 2);
+        String *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/555e275f/core/Lucy/Test/Store/TestCompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestCompoundFileReader.c 
b/core/Lucy/Test/Store/TestCompoundFileReader.c
index a7be1d2..f3cb6f3 100644
--- a/core/Lucy/Test/Store/TestCompoundFileReader.c
+++ b/core/Lucy/Test/Store/TestCompoundFileReader.c
@@ -78,8 +78,8 @@ S_folder_with_contents() {
     OutStream_Close(bar_out);
     DECREF(foo_out);
     DECREF(bar_out);
-    StackString *empty = SSTR_BLANK();
-    RAMFolder_Consolidate(folder, (String*)empty);
+    String *empty = SSTR_BLANK();
+    RAMFolder_Consolidate(folder, empty);
     return (Folder*)folder;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Store/TestFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFileHandle.c 
b/core/Lucy/Test/Store/TestFileHandle.c
index 69ce82f..c09e4fa 100644
--- a/core/Lucy/Test/Store/TestFileHandle.c
+++ b/core/Lucy/Test/Store/TestFileHandle.c
@@ -38,11 +38,11 @@ S_no_op_method(const void *vself) {
 
 static FileHandle*
 S_new_filehandle() {
-    StackString *class_name = SSTR_WRAP_UTF8("TestFileHandle", 14);
+    String *class_name = SSTR_WRAP_UTF8("TestFileHandle", 14);
     FileHandle *fh;
-    Class *klass = Class_fetch_class((String*)class_name);
+    Class *klass = Class_fetch_class(class_name);
     if (!klass) {
-        klass = Class_singleton((String*)class_name, FILEHANDLE);
+        klass = Class_singleton(class_name, FILEHANDLE);
     }
     Class_Override(klass, S_no_op_method, LUCY_FH_Close_OFFSET);
     fh = (FileHandle*)Class_Make_Obj(klass);
@@ -53,11 +53,11 @@ void
 TestFH_Run_IMP(TestFileHandle *self, TestBatchRunner *runner) {
     TestBatchRunner_Plan(runner, (TestBatch*)self, 2);
 
-    FileHandle    *fh    = S_new_filehandle();
-    StackString *foo   = SSTR_WRAP_UTF8("foo", 3);
+    FileHandle *fh  = S_new_filehandle();
+    String     *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);
+    FH_Set_Path(fh, foo);
     TEST_TRUE(runner, Str_Equals(FH_Get_Path(fh), (Obj*)foo), "Set_Path");
 
     DECREF(fh);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Store/TestFolderCommon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFolderCommon.c 
b/core/Lucy/Test/Store/TestFolderCommon.c
index 27fcf33..346d078 100644
--- a/core/Lucy/Test/Store/TestFolderCommon.c
+++ b/core/Lucy/Test/Store/TestFolderCommon.c
@@ -137,8 +137,8 @@ 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();
-    local = Folder_Local_Find_Folder(folder, (String*)empty);
+    String *empty = SSTR_BLANK();
+    local = Folder_Local_Find_Folder(folder, empty);
     TEST_TRUE(runner, local == NULL, "Empty string yields NULL");
 
     local = Folder_Local_Find_Folder(folder, foo_bar);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Store/TestInStream.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestInStream.c 
b/core/Lucy/Test/Store/TestInStream.c
index 8f73575..248e4f2 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_UTF8("foo", 3);
-    StackString *bar       = SSTR_WRAP_UTF8("bar", 3);
+    String        *foo       = SSTR_WRAP_UTF8("foo", 3);
+    String        *bar       = SSTR_WRAP_UTF8("bar", 3);
     RAMFile       *file      = RAMFile_new(NULL, false);
     OutStream     *outstream = OutStream_open((Obj*)file);
     RAMFileHandle *fh;
@@ -110,7 +110,7 @@ test_Clone_and_Reopen(TestBatchRunner *runner) {
     }
     OutStream_Close(outstream);
 
-    fh = RAMFH_open((String*)foo, FH_READ_ONLY, file);
+    fh = RAMFH_open(foo, FH_READ_ONLY, file);
     instream = InStream_open((Obj*)fh);
     InStream_Seek(instream, 1);
     TEST_TRUE(runner, Str_Equals(InStream_Get_Filename(instream), (Obj*)foo),
@@ -124,7 +124,7 @@ test_Clone_and_Reopen(TestBatchRunner *runner) {
     TEST_TRUE(runner, InStream_Read_U8(instream) == InStream_Read_U8(clone),
               "Clones start at same file position");
 
-    reopened = InStream_Reopen(instream, (String*)bar, 25, 1);
+    reopened = InStream_Reopen(instream, bar, 25, 1);
     TEST_TRUE(runner, Str_Equals(InStream_Get_Filename(reopened), (Obj*)bar),
               "Reopened InStreams take new filename");
     TEST_TRUE(runner, InStream_Read_U8(reopened) == 'z',

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Store/TestRAMFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestRAMFolder.c 
b/core/Lucy/Test/Store/TestRAMFolder.c
index 7532354..97cc8b4 100644
--- a/core/Lucy/Test/Store/TestRAMFolder.c
+++ b/core/Lucy/Test/Store/TestRAMFolder.c
@@ -139,8 +139,8 @@ 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();
-    local = (RAMFolder*)RAMFolder_Local_Find_Folder(folder, (String*)empty);
+    String *empty = SSTR_BLANK();
+    local = (RAMFolder*)RAMFolder_Local_Find_Folder(folder, empty);
     TEST_TRUE(runner, local == NULL, "Empty string yields NULL");
 
     local = (RAMFolder*)RAMFolder_Local_Find_Folder(folder, foo_bar);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Util/TestIndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestIndexFileNames.c 
b/core/Lucy/Test/Util/TestIndexFileNames.c
index 6b6395d..98f6cfb 100644
--- a/core/Lucy/Test/Util/TestIndexFileNames.c
+++ b/core/Lucy/Test/Util/TestIndexFileNames.c
@@ -30,8 +30,8 @@ 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_UTF8(source, strlen(source));
-    String *got = IxFileNames_local_part((String*)source_str);
+    String *source_str = SSTR_WRAP_UTF8(source, strlen(source));
+    String *got = IxFileNames_local_part(source_str);
     TEST_TRUE(runner, Str_Equals_Utf8(got, wanted, strlen(wanted)), test_name);
     DECREF(got);
 }
@@ -51,9 +51,8 @@ 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_UTF8(name, strlen(name));
-    TEST_TRUE(runner, IxFileNames_extract_gen((String*)source) == gen,
-              test_name);
+    String *source = SSTR_WRAP_UTF8(name, strlen(name));
+    TEST_TRUE(runner, IxFileNames_extract_gen(source) == gen, test_name);
 }
 
 static void

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Test/Util/TestJson.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestJson.c b/core/Lucy/Test/Util/TestJson.c
index af24ea3..f6dc731 100644
--- a/core/Lucy/Test/Util/TestJson.c
+++ b/core/Lucy/Test/Util/TestJson.c
@@ -247,9 +247,9 @@ 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_UTF8(bad, strlen(bad));
+    String *has_errors = SSTR_WRAP_UTF8(bad, strlen(bad));
     Err_set_error(NULL);
-    Obj *not_json = Json_from_json((String*)has_errors);
+    Obj *not_json = Json_from_json(has_errors);
     TEST_TRUE(runner, not_json == NULL, "from_json returns NULL: %s", mess);
     TEST_TRUE(runner, Err_get_error() != NULL,
               "from_json sets global error: %s", mess);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index cb60c3b..20a93a8 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -691,8 +691,8 @@ S_set_error(CharBuf *buf, const char *json, const char 
*limit, int line,
     else if (len < 0) {
         len = 0; // sanity check
     }
-    StackString *snippet = SSTR_WRAP_UTF8(json, (size_t)len);
-    S_append_json_string((String*)snippet, buf);
+    String *snippet = SSTR_WRAP_UTF8(json, (size_t)len);
+    S_append_json_string(snippet, buf);
 
     String *mess = CB_Yield_String(buf);
     DECREF(buf);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/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 8d20418..889e0d0 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -113,10 +113,9 @@ STORABLE_thaw(blank_obj, cloning, serialized_sv)
 PPCODE:
 {
     char *class_name = HvNAME(SvSTASH(SvRV(blank_obj)));
-    cfish_StackString *class_name_str
+    cfish_String *class_name_str
         = CFISH_SSTR_WRAP_UTF8(class_name, strlen(class_name));
-    cfish_Class *klass
-        = cfish_Class_singleton((cfish_String*)class_name_str, NULL);
+    cfish_Class *klass = cfish_Class_singleton(class_name_str, NULL);
     STRLEN len;
     char *ptr = SvPV(serialized_sv, len);
     cfish_ByteBuf *contents = cfish_BB_new_bytes(ptr, len);

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/perl/xs/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/DocReader.c b/perl/xs/Lucy/Index/DocReader.c
index d725887..8eda8bc 100644
--- a/perl/xs/Lucy/Index/DocReader.c
+++ b/perl/xs/Lucy/Index/DocReader.c
@@ -62,9 +62,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_str
+        cfish_String *field_name_str
             = CFISH_SSTR_WRAP_UTF8(field_name_ptr, field_name_len);
-        type = LUCY_Schema_Fetch_Type(schema, (cfish_String*)field_name_str);
+        type = LUCY_Schema_Fetch_Type(schema, field_name_str);
 
         // Read the field value.
         switch (LUCY_FType_Primitive_ID(type) & lucy_FType_PRIMITIVE_ID_MASK) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/555e275f/perl/xs/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c
index 9f3d6ef..4ad6e2d 100644
--- a/perl/xs/Lucy/Index/Inverter.c
+++ b/perl/xs/Lucy/Index/Inverter.c
@@ -50,16 +50,14 @@ S_fetch_entry(pTHX_ lucy_Inverter *self, HE *hash_entry) {
         }
     }
 
-    cfish_StackString *field = CFISH_SSTR_WRAP_UTF8(key, key_len);
-    int32_t field_num
-        = LUCY_Seg_Field_Num(ivars->segment, (cfish_String*)field);
+    cfish_String *field = CFISH_SSTR_WRAP_UTF8(key, key_len);
+    int32_t field_num = LUCY_Seg_Field_Num(ivars->segment, field);
     if (!field_num) {
         // This field seems not to be in the segment yet.  Try to find it in
         // the Schema.
-        if (LUCY_Schema_Fetch_Type(schema, (cfish_String*)field)) {
+        if (LUCY_Schema_Fetch_Type(schema, field)) {
             // The field is in the Schema.  Get a field num from the Segment.
-            field_num = LUCY_Seg_Add_Field(ivars->segment,
-                                           (cfish_String*)field);
+            field_num = LUCY_Seg_Add_Field(ivars->segment, field);
         }
         else {
             // We've truly failed to find the field.  The user must
@@ -71,7 +69,7 @@ S_fetch_entry(pTHX_ lucy_Inverter *self, HE *hash_entry) {
     lucy_InverterEntry *entry
         = (lucy_InverterEntry*)CFISH_Vec_Fetch(ivars->entry_pool, field_num);
     if (!entry) {
-        entry = lucy_InvEntry_new(schema, (cfish_String*)field, field_num);
+        entry = lucy_InvEntry_new(schema, field, field_num);
         CFISH_Vec_Store(ivars->entry_pool, field_num, (cfish_Obj*)entry);
     }
     return entry;

Reply via email to