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/13 20:31:49 UTC
[lucy-commits] [17/17] git commit: refs/heads/cfish-string-prep1 - Remove Str_new
and Str_init
Remove Str_new and Str_init
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/9c5e8200
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/9c5e8200
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/9c5e8200
Branch: refs/heads/cfish-string-prep1
Commit: 9c5e8200127d2d55342e612751c16380dddd6fa3
Parents: 8a7a3e0
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Sep 10 02:54:08 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Sep 13 20:16:12 2013 +0200
----------------------------------------------------------------------
clownfish/runtime/c/src/Clownfish/Err.c | 5 +----
clownfish/runtime/core/Clownfish/String.c | 20 --------------------
clownfish/runtime/core/Clownfish/String.cfh | 6 ------
clownfish/runtime/core/Clownfish/Test/TestObj.c | 2 +-
clownfish/runtime/perl/xs/XSBind.c | 5 +----
core/Lucy/Highlight/Highlighter.c | 4 ++--
core/Lucy/Plan/BlobType.c | 6 ------
core/Lucy/Plan/BlobType.cfh | 3 ---
core/Lucy/Plan/TextType.c | 6 ------
core/Lucy/Plan/TextType.cfh | 3 ---
core/Lucy/Store/FileHandle.c | 2 +-
core/Lucy/Store/Folder.c | 2 +-
12 files changed, 7 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/clownfish/runtime/c/src/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/Err.c b/clownfish/runtime/c/src/Clownfish/Err.c
index cba995a..ae13494 100644
--- a/clownfish/runtime/c/src/Clownfish/Err.c
+++ b/clownfish/runtime/c/src/Clownfish/Err.c
@@ -72,10 +72,7 @@ Err_To_Host_IMP(Err *self) {
void
Err_throw_mess(VTable *vtable, String *message) {
- Err *err = (Err*)VTable_Make_Obj(vtable);
- Err_init(err, Str_new(0));
- Err_Cat_Mess(err, message);
- DECREF(message);
+ Err *err = Err_new(message);
Err_do_throw(err);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 6e74a4e..33074de 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -53,26 +53,6 @@ S_die_invalid_utf8(const char *text, size_t size, const char *file, int line,
const char *func);
String*
-Str_new(size_t size) {
- String *self = (String*)VTable_Make_Obj(STRING);
- return Str_init(self, size);
-}
-
-String*
-Str_init(String *self, size_t size) {
- // Derive.
- self->ptr = (char*)MALLOCATE(size + 1);
-
- // Init.
- *self->ptr = '\0'; // Empty string.
-
- // Assign.
- self->size = 0;
-
- return self;
-}
-
-String*
Str_new_from_utf8(const char *ptr, size_t size) {
if (!StrHelp_utf8_valid(ptr, size)) {
DIE_INVALID_UTF8(ptr, size);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index 8f666ac..d54f473 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -26,12 +26,6 @@ class Clownfish::String cnick Str
char *ptr;
size_t size;
- inert incremented String*
- new(size_t size);
-
- inert String*
- init(String *self, size_t size);
-
/** Return a new String which holds a copy of the passed-in string.
* Check for UTF-8 validity.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/clownfish/runtime/core/Clownfish/Test/TestObj.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestObj.c b/clownfish/runtime/core/Clownfish/Test/TestObj.c
index 7e06955..c848b7d 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestObj.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestObj.c
@@ -98,7 +98,7 @@ test_Hash_Sum(TestBatchRunner *runner) {
static void
test_Is_A(TestBatchRunner *runner) {
- String *string = Str_new(0);
+ String *string = Str_new_from_trusted_utf8("", 0);
VTable *str_vtable = Str_Get_VTable(string);
String *klass = Str_Get_Class_Name(string);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 2cfaaade..b466cf6 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -853,10 +853,7 @@ CFISH_Err_To_Host_IMP(cfish_Err *self) {
void
cfish_Err_throw_mess(cfish_VTable *vtable, cfish_String *message) {
- cfish_Err *err = (cfish_Err*)CFISH_VTable_Make_Obj(vtable);
- cfish_Err_init(err, cfish_Str_new(0));
- CFISH_Err_Cat_Mess(err, message);
- CFISH_DECREF(message);
+ cfish_Err *err = cfish_Err_new(message);
cfish_Err_do_throw(err);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index 31759da..35585a1 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -160,7 +160,7 @@ Highlighter_Create_Excerpt_IMP(Highlighter *self, HitDoc *hit_doc) {
}
else if (!Str_Get_Size(field_val)) {
// Empty string yields empty string.
- retval = Str_new(0);
+ retval = Str_new_from_trusted_utf8("", 0);
}
else {
DocVector *doc_vec
@@ -431,7 +431,7 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, const String *field_val,
String *raw_excerpt;
if (!excerpt_len) {
- raw_excerpt = Str_new(0);
+ raw_excerpt = Str_new_from_trusted_utf8("", 0);
}
else {
String *substring = StrIter_substring(top, tail);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/core/Lucy/Plan/BlobType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/BlobType.c b/core/Lucy/Plan/BlobType.c
index 878ef31..90ccc4f 100644
--- a/core/Lucy/Plan/BlobType.c
+++ b/core/Lucy/Plan/BlobType.c
@@ -45,12 +45,6 @@ BlobType_Set_Sortable_IMP(BlobType *self, bool sortable) {
if (sortable) { THROW(ERR, "BlobType fields can't be sortable"); }
}
-ViewByteBuf*
-BlobType_Make_Blank_IMP(BlobType *self) {
- UNUSED_VAR(self);
- return ViewBB_new(NULL, 0);
-}
-
int8_t
BlobType_Primitive_ID_IMP(BlobType *self) {
UNUSED_VAR(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/core/Lucy/Plan/BlobType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/BlobType.cfh b/core/Lucy/Plan/BlobType.cfh
index 3679ddc..35db51c 100644
--- a/core/Lucy/Plan/BlobType.cfh
+++ b/core/Lucy/Plan/BlobType.cfh
@@ -42,9 +42,6 @@ public class Lucy::Plan::BlobType inherits Lucy::Plan::FieldType {
public void
Set_Sortable(BlobType *self, bool sortable);
- incremented ViewByteBuf*
- Make_Blank(BlobType *self);
-
int8_t
Primitive_ID(BlobType *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/core/Lucy/Plan/TextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.c b/core/Lucy/Plan/TextType.c
index d4b6ae8..f9e6fcc 100644
--- a/core/Lucy/Plan/TextType.c
+++ b/core/Lucy/Plan/TextType.c
@@ -24,12 +24,6 @@
#include "Clownfish/CharBuf.h"
#include "Clownfish/Util/StringHelper.h"
-String*
-TextType_Make_Blank_IMP(TextType *self) {
- UNUSED_VAR(self);
- return Str_new(0);
-}
-
TermStepper*
TextType_Make_Term_Stepper_IMP(TextType *self) {
UNUSED_VAR(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/core/Lucy/Plan/TextType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/TextType.cfh b/core/Lucy/Plan/TextType.cfh
index 654a06a..33b70ec 100644
--- a/core/Lucy/Plan/TextType.cfh
+++ b/core/Lucy/Plan/TextType.cfh
@@ -17,9 +17,6 @@
parcel Lucy;
class Lucy::Plan::TextType inherits Lucy::Plan::FieldType {
- incremented String*
- Make_Blank(TextType *self);
-
incremented TermStepper*
Make_Term_Stepper(TextType *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/core/Lucy/Store/FileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FileHandle.c b/core/Lucy/Store/FileHandle.c
index 27e2bb6..afb8035 100644
--- a/core/Lucy/Store/FileHandle.c
+++ b/core/Lucy/Store/FileHandle.c
@@ -24,7 +24,7 @@ int32_t FH_object_count = 0;
FileHandle*
FH_do_open(FileHandle *self, const String *path, uint32_t flags) {
FileHandleIVARS *const ivars = FH_IVARS(self);
- ivars->path = path ? Str_Clone(path) : Str_new(0);
+ ivars->path = path ? Str_Clone(path) : Str_new_from_trusted_utf8("", 0);
ivars->flags = flags;
// Track number of live FileHandles released into the wild.
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c5e8200/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index 371dcc6..c002e9d 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -354,7 +354,7 @@ Folder_List_R_IMP(Folder *self, const String *path) {
Folder *local_folder = Folder_Find_Folder(self, path);
VArray *list = VA_new(0);
if (local_folder) {
- String *dir = Str_new(20);
+ String *dir = Str_new_from_trusted_utf8("", 0);
S_add_to_file_list(local_folder, list, dir, path);
DECREF(dir);
}