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 2015/10/30 15:52:00 UTC
[1/8] lucy git commit: Adjust for Str_Swap_Chars removal
Repository: lucy
Updated Branches:
refs/heads/master 61d45291a -> 25759e097
Adjust for Str_Swap_Chars removal
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/aa350716
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/aa350716
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/aa350716
Branch: refs/heads/master
Commit: aa350716b27d37b1aff166f11006465dd3a93d39
Parents: 8be7674
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Oct 22 16:40:07 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Oct 22 16:47:06 2015 +0200
----------------------------------------------------------------------
core/Lucy/Store/FSFolder.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/aa350716/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index 40c17b8..1570bca 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -39,6 +39,7 @@
#include <direct.h>
#endif
+#include "Clownfish/CharBuf.h"
#include "Lucy/Store/FSFolder.h"
#include "Lucy/Store/CompoundFileReader.h"
#include "Lucy/Store/CompoundFileWriter.h"
@@ -276,7 +277,19 @@ S_fullpath(FSFolder *self, String *path) {
String *fullpath = Str_newf("%o%s%o", ivars->path, CHY_DIR_SEP, path);
String *retval;
if (CHY_DIR_SEP[0] != '/') {
- retval = Str_Swap_Chars(fullpath, '/', CHY_DIR_SEP[0]);
+ // Replace '/' with CHY_DIR_SEP.
+ StringIterator *iter = Str_Top(fullpath);
+ CharBuf *buf = CB_new(Str_Get_Size(fullpath));
+ int32_t cp;
+
+ while (STRITER_DONE != (cp = StrIter_Next(iter))) {
+ if (cp == '/') { cp = CHY_DIR_SEP[0]; }
+ CB_Cat_Char(buf, cp);
+ }
+
+ retval = CB_Yield_String(buf);
+ DECREF(buf);
+ DECREF(iter);
DECREF(fullpath);
}
else {
[7/8] lucy git commit: Switch over to STR_OOB
Posted by nw...@apache.org.
Switch over to STR_OOB
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/24a5ac42
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/24a5ac42
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/24a5ac42
Branch: refs/heads/master
Commit: 24a5ac423f2508640b16c362be86e780a420089b
Parents: 333119d
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Oct 24 17:04:41 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Oct 24 17:04:41 2015 +0200
----------------------------------------------------------------------
core/Lucy/Highlight/Highlighter.c | 14 +++++++-------
core/Lucy/Index/Segment.c | 2 +-
core/Lucy/Search/QueryParser.c | 4 ++--
core/Lucy/Search/QueryParser/QueryLexer.c | 14 +++++++-------
core/Lucy/Store/FSFolder.c | 2 +-
core/Lucy/Store/Folder.c | 2 +-
core/Lucy/Store/Lock.c | 2 +-
core/Lucy/Store/SharedLock.c | 4 ++--
core/Lucy/Util/IndexFileNames.c | 4 ++--
core/Lucy/Util/Json.c | 2 +-
10 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index 2ce62cd..d1c3b6c 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -226,7 +226,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip,
while (true) {
int32_t code_point = StrIter_Prev(iter);
- if (code_point == STRITER_DONE || code_point == '.') {
+ if (code_point == STR_OOB || code_point == '.') {
// Skip remaining whitespace.
*num_skipped_ptr = StrIter_Skip_Whitespace(top);
DECREF(iter);
@@ -251,7 +251,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip,
for (uint32_t i = 0; i < max_skip; ++i) {
int32_t code_point = StrIter_Next(iter);
- if (code_point == STRITER_DONE || code_point == '.') {
+ if (code_point == STR_OOB || code_point == '.') {
found_edge = true;
StrIter_Assign(top, iter);
num_skipped = i + 1;
@@ -296,7 +296,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip,
do {
code_point = StrIter_Next(iter);
- if (code_point == STRITER_DONE) {
+ if (code_point == STR_OOB) {
// Skip remaining whitespace.
*num_skipped_ptr = StrIter_Skip_Whitespace_Back(tail);
DECREF(iter);
@@ -311,7 +311,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip,
StrIter_Assign(iter, tail);
for (uint32_t i = 0;
- STRITER_DONE != (code_point = StrIter_Prev(iter));
+ STR_OOB != (code_point = StrIter_Prev(iter));
++i)
{
if (code_point == '.') {
@@ -345,7 +345,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip,
StrIter_Assign(tail, word);
// Strip whitespace and punctuation that collides with an ellipsis.
- while (STRITER_DONE != (code_point = StrIter_Prev(tail))) {
+ while (STR_OOB != (code_point = StrIter_Prev(tail))) {
if (!StrHelp_is_whitespace(code_point)
&& code_point != '.'
&& code_point != ','
@@ -588,7 +588,7 @@ S_encode_entities(String *text, CharBuf *buf) {
// Scan first so that we only allocate once.
int32_t code_point;
- while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
+ while (STR_OOB != (code_point = StrIter_Next(iter))) {
if (code_point > 127
|| (!isgraph(code_point) && !isspace(code_point))
|| code_point == '<'
@@ -607,7 +607,7 @@ S_encode_entities(String *text, CharBuf *buf) {
CB_Set_Size(buf, 0);
DECREF(iter);
iter = Str_Top(text);
- while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
+ while (STR_OOB != (code_point = StrIter_Next(iter))) {
if (code_point > 127
|| (!isgraph(code_point) && !isspace(code_point))
) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Index/Segment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c
index b93f721..660c76a 100644
--- a/core/Lucy/Index/Segment.c
+++ b/core/Lucy/Index/Segment.c
@@ -70,7 +70,7 @@ Seg_valid_seg_name(String *name) {
StringIterator *iter = Str_Top(name);
StrIter_Advance(iter, 4);
int32_t code_point;
- while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
+ while (STR_OOB != (code_point = StrIter_Next(iter))) {
if (!isalnum(code_point)) {
DECREF(iter);
return false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Search/QueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c
index 7695c61..7a41539 100644
--- a/core/Lucy/Search/QueryParser.c
+++ b/core/Lucy/Search/QueryParser.c
@@ -833,7 +833,7 @@ S_unescape(QueryParser *self, String *orig, CharBuf *buf) {
CB_Set_Size(buf, 0);
CB_Grow(buf, Str_Get_Size(orig) + 4);
- while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
+ while (STR_OOB != (code_point = StrIter_Next(iter))) {
if (code_point == '\\') {
int32_t next_code_point = StrIter_Next(iter);
if (next_code_point == ':'
@@ -844,7 +844,7 @@ S_unescape(QueryParser *self, String *orig, CharBuf *buf) {
}
else {
CB_Cat_Char(buf, code_point);
- if (next_code_point != STRITER_DONE) {
+ if (next_code_point != STR_OOB) {
CB_Cat_Char(buf, next_code_point);
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Search/QueryParser/QueryLexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.c b/core/Lucy/Search/QueryParser/QueryLexer.c
index 1a9f54f..bee1b08 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.c
+++ b/core/Lucy/Search/QueryParser/QueryLexer.c
@@ -169,7 +169,7 @@ S_consume_keyword(StringIterator *iter, const char *keyword,
StringIterator *temp = StrIter_Clone(iter);
StrIter_Advance(temp, keyword_len);
int32_t lookahead = StrIter_Next(temp);
- if (lookahead == STRITER_DONE) {
+ if (lookahead == STR_OOB) {
DECREF(temp);
return NULL;
}
@@ -195,7 +195,7 @@ S_consume_field(StringIterator *iter) {
// Field names constructs must start with a letter or underscore.
int32_t code_point = StrIter_Next(temp);
- if (code_point == STRITER_DONE) {
+ if (code_point == STR_OOB) {
DECREF(temp);
return NULL;
}
@@ -206,7 +206,7 @@ S_consume_field(StringIterator *iter) {
// Only alphanumerics and underscores are allowed in field names.
while (':' != (code_point = StrIter_Next(temp))) {
- if (code_point == STRITER_DONE) {
+ if (code_point == STR_OOB) {
DECREF(temp);
return NULL;
}
@@ -218,7 +218,7 @@ S_consume_field(StringIterator *iter) {
// Field name constructs must be followed by something sensible.
int32_t lookahead = StrIter_Next(temp);
- if (lookahead == STRITER_DONE) {
+ if (lookahead == STR_OOB) {
DECREF(temp);
return NULL;
}
@@ -250,11 +250,11 @@ S_consume_text(StringIterator *iter) {
int32_t code_point = StrIter_Next(temp);
if (code_point == '\\') {
code_point = StrIter_Next(temp);
- if (code_point == STRITER_DONE) {
+ if (code_point == STR_OOB) {
break;
}
}
- else if (code_point == STRITER_DONE) {
+ else if (code_point == STR_OOB) {
break;
}
else if (StrHelp_is_whitespace(code_point)
@@ -283,7 +283,7 @@ S_consume_quoted_string(StringIterator *iter) {
while (1) {
int32_t code_point = StrIter_Next(temp);
- if (code_point == STRITER_DONE || code_point == '"') {
+ if (code_point == STR_OOB || code_point == '"') {
break;
}
else if (code_point == '\\') {
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index 6b1295a..cedea94 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -282,7 +282,7 @@ S_fullpath(FSFolder *self, String *path) {
CharBuf *buf = CB_new(Str_Get_Size(fullpath));
int32_t cp;
- while (STRITER_DONE != (cp = StrIter_Next(iter))) {
+ while (STR_OOB != (cp = StrIter_Next(iter))) {
if (cp == '/') { cp = CHY_DIR_SEP[0]; }
CB_Cat_Char(buf, cp);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index b75e73e..cf4a204 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -439,7 +439,7 @@ S_enclosing_folder(Folder *self, StringIterator *path) {
// Find first component of the file path.
String *path_component = NULL;
StringIterator *iter = StrIter_Clone(path);
- while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
+ while (STR_OOB != (code_point = StrIter_Next(iter))) {
if (code_point == '/' && StrIter_Has_Next(iter)) {
StrIter_Recede(iter, 1);
path_component = StrIter_substring(path, iter);
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index 82066a5..40b9704 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -41,7 +41,7 @@ Lock_init(Lock *self, Folder *folder, String *name,
}
StringIterator *iter = Str_Top(name);
int32_t code_point;
- while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
+ while (STR_OOB != (code_point = StrIter_Next(iter))) {
if (isalnum(code_point)
|| code_point == '.'
|| code_point == '-'
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Store/SharedLock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.c b/core/Lucy/Store/SharedLock.c
index 8d664f1..2563e5f 100644
--- a/core/Lucy/Store/SharedLock.c
+++ b/core/Lucy/Store/SharedLock.c
@@ -144,8 +144,8 @@ ShLock_Is_Locked_IMP(SharedLock *self) {
int32_t code_point = StrIter_Next(iter);
if (code_point == '-') {
code_point = StrIter_Next(iter);
- if (code_point != STRITER_DONE && isdigit(code_point)) {
- while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
+ if (code_point != STR_OOB && isdigit(code_point)) {
+ while (STR_OOB != (code_point = StrIter_Next(iter))) {
if (!isdigit(code_point)) { break; }
}
if (code_point == '.'
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Util/IndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/IndexFileNames.c b/core/Lucy/Util/IndexFileNames.c
index 377d727..bd203cb 100644
--- a/core/Lucy/Util/IndexFileNames.c
+++ b/core/Lucy/Util/IndexFileNames.c
@@ -57,7 +57,7 @@ IxFileNames_extract_gen(String *name) {
// encounter a NULL.
while (1) {
int32_t code_point = StrIter_Next(iter);
- if (code_point == STRITER_DONE) { return 0; }
+ if (code_point == STR_OOB) { return 0; }
else if (code_point == '_') { break; }
}
@@ -83,7 +83,7 @@ IxFileNames_local_part(String *path) {
StrIter_Advance(tail, 1);
// Substring should start after last slash.
- while (code_point != STRITER_DONE) {
+ while (code_point != STR_OOB) {
if (code_point == '/') {
StrIter_Advance(top, 1);
break;
http://git-wip-us.apache.org/repos/asf/lucy/blob/24a5ac42/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index c346275..6afa9b9 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -186,7 +186,7 @@ S_append_json_string(String *dump, CharBuf *buf) {
// Process string data.
StringIterator *iter = Str_Top(dump);
int32_t code_point;
- while (STRITER_DONE != (code_point = StrIter_Next(iter))) {
+ while (STR_OOB != (code_point = StrIter_Next(iter))) {
if (code_point > 127) {
// There is no need to escape any high characters, including those
// above the BMP, as we assume that the destination channel can
[4/8] lucy git commit: Adjust for Skip_Whitespace changes
Posted by nw...@apache.org.
Adjust for Skip_Whitespace changes
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/6de52a6f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/6de52a6f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/6de52a6f
Branch: refs/heads/master
Commit: 6de52a6f07a224a4df15a867baaa0a43d5edae6d
Parents: fde7f8c
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Oct 24 15:42:27 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Oct 24 15:42:27 2015 +0200
----------------------------------------------------------------------
core/Lucy/Highlight/Highlighter.c | 6 +++---
core/Lucy/Search/QueryParser.c | 4 ++--
core/Lucy/Search/QueryParser/QueryLexer.c | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/6de52a6f/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index 9aeece0..2ce62cd 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -228,7 +228,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip,
if (code_point == STRITER_DONE || code_point == '.') {
// Skip remaining whitespace.
- *num_skipped_ptr = StrIter_Skip_Next_Whitespace(top);
+ *num_skipped_ptr = StrIter_Skip_Whitespace(top);
DECREF(iter);
return true;
}
@@ -271,7 +271,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip,
}
// Skip remaining whitespace.
- num_skipped += StrIter_Skip_Next_Whitespace(top);
+ num_skipped += StrIter_Skip_Whitespace(top);
*num_skipped_ptr = num_skipped;
DECREF(word);
@@ -298,7 +298,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip,
if (code_point == STRITER_DONE) {
// Skip remaining whitespace.
- *num_skipped_ptr = StrIter_Skip_Prev_Whitespace(tail);
+ *num_skipped_ptr = StrIter_Skip_Whitespace_Back(tail);
DECREF(iter);
return true;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/6de52a6f/core/Lucy/Search/QueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c
index dce7fb6..7695c61 100644
--- a/core/Lucy/Search/QueryParser.c
+++ b/core/Lucy/Search/QueryParser.c
@@ -874,8 +874,8 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
// If quoted, always generate PhraseQuery.
StringIterator *top = Str_Top(full_text);
StringIterator *tail = Str_Tail(full_text);
- StrIter_Skip_Next_Whitespace(top);
- StrIter_Skip_Prev_Whitespace(tail);
+ StrIter_Skip_Whitespace(top);
+ StrIter_Skip_Whitespace_Back(tail);
if (StrIter_Starts_With_Utf8(top, "\"", 1)) {
is_phrase = true;
StrIter_Advance(top, 1);
http://git-wip-us.apache.org/repos/asf/lucy/blob/6de52a6f/core/Lucy/Search/QueryParser/QueryLexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.c b/core/Lucy/Search/QueryParser/QueryLexer.c
index 76596c4..1a9f54f 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.c
+++ b/core/Lucy/Search/QueryParser/QueryLexer.c
@@ -82,7 +82,7 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, String *query_string) {
while (StrIter_Has_Next(iter)) {
ParserElem *elem = NULL;
- if (StrIter_Skip_Next_Whitespace(iter)) {
+ if (StrIter_Skip_Whitespace(iter)) {
// Fast-forward past whitespace.
continue;
}
@@ -104,7 +104,7 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, String *query_string) {
break;
case '+':
if (StrIter_Has_Next(iter)
- && !StrIter_Skip_Next_Whitespace(iter)
+ && !StrIter_Skip_Whitespace(iter)
) {
elem = ParserElem_new(TOKEN_PLUS, NULL);
}
@@ -114,7 +114,7 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, String *query_string) {
break;
case '-':
if (StrIter_Has_Next(iter)
- && !StrIter_Skip_Next_Whitespace(iter)
+ && !StrIter_Skip_Whitespace(iter)
) {
elem = ParserElem_new(TOKEN_MINUS, NULL);
}
[8/8] lucy git commit: Switch over to StrIter_crop
Posted by nw...@apache.org.
Switch over to StrIter_crop
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/25759e09
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/25759e09
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/25759e09
Branch: refs/heads/master
Commit: 25759e0970dedc847e87828becb80f825f7f32a5
Parents: 24a5ac4
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Oct 28 18:06:43 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Oct 28 18:06:43 2015 +0100
----------------------------------------------------------------------
core/Lucy/Highlight/Highlighter.c | 10 +++++-----
core/Lucy/Search/QueryParser.c | 2 +-
core/Lucy/Search/QueryParser/QueryLexer.c | 6 +++---
core/Lucy/Store/Folder.c | 4 ++--
core/Lucy/Util/IndexFileNames.c | 4 ++--
5 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/25759e09/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index d1c3b6c..f88b814 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -434,7 +434,7 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, String *field_val,
raw_excerpt = Str_new_from_trusted_utf8("", 0);
}
else {
- String *substring = StrIter_substring(top, tail);
+ String *substring = StrIter_crop(top, tail);
CharBuf *buf = CB_new(Str_Get_Size(substring) + 8);
// If not starting on a sentence boundary, prepend an ellipsis.
@@ -499,7 +499,7 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, Vector *spans,
int32_t highlighted_len = hl_end - hl_start;
StrIter_Assign(temp, iter);
StrIter_Advance(iter, highlighted_len);
- String *to_cat = StrIter_substring(temp, iter);
+ String *to_cat = StrIter_crop(temp, iter);
String *encoded = S_do_encode(self, to_cat, &encode_buf);
String *hl_frag = Highlighter_Highlight(self, encoded);
CB_Cat(buf, hl_frag);
@@ -511,7 +511,7 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, Vector *spans,
int32_t non_highlighted_len = relative_start - hl_end;
StrIter_Assign(temp, iter);
StrIter_Advance(iter, non_highlighted_len);
- String *to_cat = StrIter_substring(temp, iter);
+ String *to_cat = StrIter_crop(temp, iter);
String *encoded = S_do_encode(self, to_cat, &encode_buf);
CB_Cat(buf, (String*)encoded);
DECREF(encoded);
@@ -528,7 +528,7 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, Vector *spans,
int32_t highlighted_len = hl_end - hl_start;
StrIter_Assign(temp, iter);
StrIter_Advance(iter, highlighted_len);
- String *to_cat = StrIter_substring(temp, iter);
+ String *to_cat = StrIter_crop(temp, iter);
String *encoded = S_do_encode(self, to_cat, &encode_buf);
String *hl_frag = Highlighter_Highlight(self, encoded);
CB_Cat(buf, hl_frag);
@@ -539,7 +539,7 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, Vector *spans,
// Last text, beyond last highlight span.
if (StrIter_Has_Next(iter)) {
- String *to_cat = StrIter_substring(iter, NULL);
+ String *to_cat = StrIter_crop(iter, NULL);
String *encoded = S_do_encode(self, to_cat, &encode_buf);
CB_Cat(buf, encoded);
DECREF(encoded);
http://git-wip-us.apache.org/repos/asf/lucy/blob/25759e09/core/Lucy/Search/QueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c
index 7a41539..32736d5 100644
--- a/core/Lucy/Search/QueryParser.c
+++ b/core/Lucy/Search/QueryParser.c
@@ -885,7 +885,7 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
StrIter_Recede(tail, 1);
}
}
- String *source_text = StrIter_substring(top, tail);
+ String *source_text = StrIter_crop(top, tail);
// Either use LeafQuery's field or default to Parser's list.
Vector *fields;
http://git-wip-us.apache.org/repos/asf/lucy/blob/25759e09/core/Lucy/Search/QueryParser/QueryLexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.c b/core/Lucy/Search/QueryParser/QueryLexer.c
index bee1b08..c86c690 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.c
+++ b/core/Lucy/Search/QueryParser/QueryLexer.c
@@ -235,7 +235,7 @@ S_consume_field(StringIterator *iter) {
// Consume string data.
StrIter_Recede(temp, 2); // Back up over lookahead and colon.
- String *field = StrIter_substring(iter, temp);
+ String *field = StrIter_crop(iter, temp);
StrIter_Advance(temp, 1); // Skip colon.
StrIter_Assign(iter, temp);
DECREF(temp);
@@ -267,7 +267,7 @@ S_consume_text(StringIterator *iter) {
}
}
- String *text = StrIter_substring(iter, temp);
+ String *text = StrIter_crop(iter, temp);
StrIter_Assign(iter, temp);
DECREF(temp);
return ParserElem_new(TOKEN_STRING, (Obj*)text);
@@ -291,7 +291,7 @@ S_consume_quoted_string(StringIterator *iter) {
}
}
- String *text = StrIter_substring(iter, temp);
+ String *text = StrIter_crop(iter, temp);
StrIter_Assign(iter, temp);
DECREF(temp);
return ParserElem_new(TOKEN_STRING, (Obj*)text);
http://git-wip-us.apache.org/repos/asf/lucy/blob/25759e09/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index cf4a204..2c456a7 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -442,7 +442,7 @@ S_enclosing_folder(Folder *self, StringIterator *path) {
while (STR_OOB != (code_point = StrIter_Next(iter))) {
if (code_point == '/' && StrIter_Has_Next(iter)) {
StrIter_Recede(iter, 1);
- path_component = StrIter_substring(path, iter);
+ path_component = StrIter_crop(path, iter);
StrIter_Advance(iter, 1);
StrIter_Assign(path, iter);
break;
@@ -485,7 +485,7 @@ Folder_Find_Folder_IMP(Folder *self, String *path) {
StringIterator *iter = Str_Top(path);
Folder *enclosing_folder = S_enclosing_folder(self, iter);
if (enclosing_folder) {
- String *folder_name = StrIter_substring(iter, NULL);
+ String *folder_name = StrIter_crop(iter, NULL);
folder = Folder_Local_Find_Folder(enclosing_folder, folder_name);
DECREF(folder_name);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/25759e09/core/Lucy/Util/IndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/IndexFileNames.c b/core/Lucy/Util/IndexFileNames.c
index bd203cb..550995e 100644
--- a/core/Lucy/Util/IndexFileNames.c
+++ b/core/Lucy/Util/IndexFileNames.c
@@ -61,7 +61,7 @@ IxFileNames_extract_gen(String *name) {
else if (code_point == '_') { break; }
}
- String *num_string = StrIter_substring(iter, NULL);
+ String *num_string = StrIter_crop(iter, NULL);
uint64_t retval = (uint64_t)Str_BaseX_To_I64(num_string, 36);
DECREF(num_string);
@@ -91,7 +91,7 @@ IxFileNames_local_part(String *path) {
code_point = StrIter_Prev(top);
}
- String *retval = StrIter_substring(top, tail);
+ String *retval = StrIter_crop(top, tail);
DECREF(tail);
DECREF(top);
[3/8] lucy git commit: Adjust for Str_Find changes
Posted by nw...@apache.org.
Adjust for Str_Find changes
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/fde7f8ca
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/fde7f8ca
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/fde7f8ca
Branch: refs/heads/master
Commit: fde7f8caee401f68440f0e5ee9c74252b2e202d6
Parents: aa35071
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Oct 24 15:26:29 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Oct 24 15:26:29 2015 +0200
----------------------------------------------------------------------
core/Lucy/Store/FSFolder.c | 2 +-
core/Lucy/Test/Highlight/TestHighlighter.c | 38 ++++++++++++-------------
core/Lucy/Test/Index/TestSortWriter.c | 4 +--
core/Lucy/Test/Search/TestSortSpec.c | 4 +--
perl/xs/Lucy/Analysis/RegexTokenizer.c | 4 +--
5 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/fde7f8ca/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index 1570bca..18a114f 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -349,7 +349,7 @@ S_create_dir(String *path) {
static bool
S_is_local_entry(String *path) {
- return Str_Find_Utf8(path, "/", 1) == -1;
+ return !Str_Contains_Utf8(path, "/", 1);
}
/***************************************************************************/
http://git-wip-us.apache.org/repos/asf/lucy/blob/fde7f8ca/core/Lucy/Test/Highlight/TestHighlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Highlight/TestHighlighter.c b/core/Lucy/Test/Highlight/TestHighlighter.c
index ebd845d..0bdfec1 100644
--- a/core/Lucy/Test/Highlight/TestHighlighter.c
+++ b/core/Lucy/Test/Highlight/TestHighlighter.c
@@ -227,9 +227,9 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
HitDoc *hit = Hits_Next(hits);
String *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Utf8(excerpt,
- "<strong>Φ</strong> a b c d <strong>x y z</strong>",
- 54) >= 0,
+ Str_Contains_Utf8(excerpt,
+ "<strong>Φ</strong> a b c d <strong>x y z</strong>",
+ 54),
"highlighter tagged phrase and single term");
DECREF(excerpt);
@@ -239,9 +239,9 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
Highlighter_Set_Post_Tag(highlighter, post_tag);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Utf8(excerpt,
- "\x1B[1mΦ\x1B[0m a b c d \x1B[1mx y z\x1B[0m",
- 36) >= 0,
+ Str_Contains_Utf8(excerpt,
+ "\x1B[1mΦ\x1B[0m a b c d \x1B[1mx y z\x1B[0m",
+ 36),
"set_pre_tag and set_post_tag");
DECREF(excerpt);
DECREF(hit);
@@ -249,7 +249,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Utf8(excerpt, "x", 1) >= 0,
+ Str_Contains_Utf8(excerpt, "x", 1),
"excerpt field with partial hit doesn't cause highlighter freakout");
DECREF(excerpt);
DECREF(hit);
@@ -261,9 +261,9 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Utf8(excerpt,
- "<strong>b</strong> c d <strong>x y z</strong>",
- 45) >= 0,
+ Str_Contains_Utf8(excerpt,
+ "<strong>b</strong> c d <strong>x y z</strong>",
+ 45),
"query with same word in both phrase and term doesn't cause freakout");
DECREF(excerpt);
DECREF(hit);
@@ -276,7 +276,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Utf8(excerpt, """, 6) >= 0,
+ Str_Contains_Utf8(excerpt, """, 6),
"HTML entity encoded properly");
DECREF(excerpt);
DECREF(hit);
@@ -288,9 +288,9 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
highlighter = Highlighter_new(searcher, query, content, 200);
hit = Hits_Next(hits);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
- TEST_TRUE(runner,
- Str_Find_Utf8(excerpt, "Φ", 6) == -1,
- "no ellipsis for short excerpt");
+ TEST_FALSE(runner,
+ Str_Contains_Utf8(excerpt, "Φ", 6),
+ "no ellipsis for short excerpt");
DECREF(excerpt);
DECREF(hit);
DECREF(highlighter);
@@ -303,16 +303,16 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
highlighter = Highlighter_new(searcher, query, content, 200);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
- Str_Find_Utf8(excerpt, "strong", 5) >= 0,
+ Str_Contains_Utf8(excerpt, "strong", 5),
"specify field highlights correct field...");
DECREF(excerpt);
DECREF(highlighter);
String *alt = (String*)SSTR_WRAP_UTF8("alt", 3);
highlighter = Highlighter_new(searcher, query, alt, 200);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
- TEST_TRUE(runner,
- Str_Find_Utf8(excerpt, "strong", 5) == -1,
- "... but not another field");
+ TEST_FALSE(runner,
+ Str_Contains_Utf8(excerpt, "strong", 5),
+ "... but not another field");
DECREF(excerpt);
DECREF(highlighter);
DECREF(hit);
@@ -424,7 +424,7 @@ test_hl_selection(TestBatchRunner *runner) {
String *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
String *mmm = (String*)SSTR_WRAP_UTF8("MMM", 3);
String *nnn = (String*)SSTR_WRAP_UTF8("NNN", 3);
- TEST_TRUE(runner, Str_Find(excerpt, mmm) >= 0 || Str_Find(excerpt, nnn) >= 0,
+ TEST_TRUE(runner, Str_Contains(excerpt, mmm) || Str_Contains(excerpt, nnn),
"Sentence boundary algo doesn't chop terms");
DECREF(excerpt);
http://git-wip-us.apache.org/repos/asf/lucy/blob/fde7f8ca/core/Lucy/Test/Index/TestSortWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSortWriter.c b/core/Lucy/Test/Index/TestSortWriter.c
index bfac610..1ac1c80 100644
--- a/core/Lucy/Test/Index/TestSortWriter.c
+++ b/core/Lucy/Test/Index/TestSortWriter.c
@@ -245,8 +245,8 @@ test_sort_writer(TestBatchRunner *runner) {
int num_old_seg_files = 0;
for (uint32_t i = 0, size = Vec_Get_Size(filenames); i < size; ++i) {
String *filename = (String*)Vec_Fetch(filenames, i);
- if (Str_Find_Utf8(filename, "seg_1", 5) >= 0
- || Str_Find_Utf8(filename, "seg_2", 5) >= 0
+ if (Str_Contains_Utf8(filename, "seg_1", 5)
+ || Str_Contains_Utf8(filename, "seg_2", 5)
) {
++num_old_seg_files;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/fde7f8ca/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index ce092b8..0540889 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -467,7 +467,7 @@ test_sort_spec(TestBatchRunner *runner) {
error = Err_trap(S_attempt_sorted_search, &sort_ctx);
TEST_TRUE(runner, error != NULL
&& Err_is_a(error, ERR)
- && Str_Find_Utf8(Err_Get_Mess(error), "sortable", 8) != -1,
+ && Str_Contains_Utf8(Err_Get_Mess(error), "sortable", 8),
"sorting on a non-sortable field throws an error");
DECREF(error);
@@ -475,7 +475,7 @@ test_sort_spec(TestBatchRunner *runner) {
error = Err_trap(S_attempt_sorted_search, &sort_ctx);
TEST_TRUE(runner, error != NULL
&& Err_is_a(error, ERR)
- && Str_Find_Utf8(Err_Get_Mess(error), "sortable", 8) != -1,
+ && Str_Contains_Utf8(Err_Get_Mess(error), "sortable", 8),
"sorting on an unknown field throws an error");
DECREF(error);
#endif
http://git-wip-us.apache.org/repos/asf/lucy/blob/fde7f8ca/perl/xs/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c
index f95cf0f..f8e5e36 100644
--- a/perl/xs/Lucy/Analysis/RegexTokenizer.c
+++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c
@@ -39,8 +39,8 @@ lucy_RegexTokenizer_init(lucy_RegexTokenizer *self,
lucy_RegexTokenizerIVARS *const ivars = lucy_RegexTokenizer_IVARS(self);
#define DEFAULT_PATTERN "\\w+(?:['\\x{2019}]\\w+)*"
if (pattern) {
- if (CFISH_Str_Find_Utf8(pattern, "\\p", 2) != -1
- || CFISH_Str_Find_Utf8(pattern, "\\P", 2) != -1
+ if (CFISH_Str_Contains_Utf8(pattern, "\\p", 2)
+ || CFISH_Str_Contains_Utf8(pattern, "\\P", 2)
) {
CFISH_DECREF(self);
THROW(CFISH_ERR, "\\p and \\P constructs forbidden");
[5/8] lucy git commit: Switch over to SSTR_WRAP_C
Posted by nw...@apache.org.
Switch over to SSTR_WRAP_C
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/0cf2343c
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/0cf2343c
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/0cf2343c
Branch: refs/heads/master
Commit: 0cf2343c3b940b774bc77a6ec20f6c1865fc3b4e
Parents: 6de52a6
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Oct 24 16:36:36 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Oct 24 16:36:36 2015 +0200
----------------------------------------------------------------------
core/Lucy/Index/FilePurger.c | 2 +-
core/Lucy/Index/IndexManager.c | 12 ++--
core/Lucy/Index/PolyReader.c | 2 +-
core/Lucy/Plan/Schema.c | 2 +-
core/Lucy/Store/CompoundFileReader.c | 8 +--
core/Lucy/Store/CompoundFileWriter.c | 12 ++--
core/Lucy/Store/FSFolder.c | 2 +-
core/Lucy/Store/Lock.c | 2 +-
core/Lucy/Store/SharedLock.c | 4 +-
core/Lucy/Test/Analysis/TestNormalizer.c | 4 +-
core/Lucy/Test/Analysis/TestPolyAnalyzer.c | 6 +-
core/Lucy/Test/Analysis/TestRegexTokenizer.c | 4 +-
core/Lucy/Test/Analysis/TestSnowballStemmer.c | 4 +-
core/Lucy/Test/Analysis/TestStandardTokenizer.c | 5 +-
core/Lucy/Test/Highlight/TestHighlighter.c | 63 ++++++++++----------
core/Lucy/Test/Index/TestSegment.c | 10 ++--
core/Lucy/Test/Index/TestSnapshot.c | 12 ++--
core/Lucy/Test/Index/TestSortWriter.c | 4 +-
core/Lucy/Test/Plan/TestFieldType.c | 6 +-
core/Lucy/Test/Plan/TestFullTextType.c | 4 +-
core/Lucy/Test/Search/TestQueryParserLogic.c | 4 +-
core/Lucy/Test/Store/TestFSDirHandle.c | 8 +--
core/Lucy/Test/Store/TestFSFileHandle.c | 8 +--
core/Lucy/Test/Store/TestFSFolder.c | 18 +++---
core/Lucy/Test/Store/TestFileHandle.c | 4 +-
core/Lucy/Test/Store/TestInStream.c | 4 +-
core/Lucy/Test/Store/TestRAMDirHandle.c | 6 +-
core/Lucy/Test/TestSchema.c | 4 +-
core/Lucy/Test/TestSimple.c | 22 +++----
core/Lucy/Test/TestUtils.c | 16 ++---
core/Lucy/Test/Util/TestIndexFileNames.c | 4 +-
core/Lucy/Test/Util/TestJson.c | 8 +--
perl/buildlib/Lucy/Build/Binding/Misc.pm | 3 +-
33 files changed, 137 insertions(+), 140 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Index/FilePurger.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/FilePurger.c b/core/Lucy/Index/FilePurger.c
index 225113e..c02dee8 100644
--- a/core/Lucy/Index/FilePurger.c
+++ b/core/Lucy/Index/FilePurger.c
@@ -157,7 +157,7 @@ S_zap_dead_merge(FilePurger *self, Hash *candidates) {
if (cutoff) {
String *cutoff_seg = Seg_num_to_name(Json_obj_to_i64(cutoff));
if (Folder_Exists(ivars->folder, cutoff_seg)) {
- String *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
+ String *merge_json = SSTR_WRAP_C("merge.json");
DirHandle *dh = Folder_Open_Dir(ivars->folder, cutoff_seg);
if (!dh) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Index/IndexManager.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/IndexManager.c b/core/Lucy/Index/IndexManager.c
index 06ff53b..9d59e77 100644
--- a/core/Lucy/Index/IndexManager.c
+++ b/core/Lucy/Index/IndexManager.c
@@ -234,7 +234,7 @@ S_obtain_lock_factory(IndexManager *self) {
Lock*
IxManager_Make_Write_Lock_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- String *write_lock_name = SSTR_WRAP_UTF8("write", 5);
+ String *write_lock_name = SSTR_WRAP_C("write");
LockFactory *lock_factory = S_obtain_lock_factory(self);
return LockFact_Make_Lock(lock_factory, write_lock_name,
ivars->write_lock_timeout,
@@ -244,7 +244,7 @@ IxManager_Make_Write_Lock_IMP(IndexManager *self) {
Lock*
IxManager_Make_Deletion_Lock_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- String *lock_name = SSTR_WRAP_UTF8("deletion", 8);
+ String *lock_name = SSTR_WRAP_C("deletion");
LockFactory *lock_factory = S_obtain_lock_factory(self);
return LockFact_Make_Lock(lock_factory, lock_name,
ivars->deletion_lock_timeout,
@@ -254,7 +254,7 @@ IxManager_Make_Deletion_Lock_IMP(IndexManager *self) {
Lock*
IxManager_Make_Merge_Lock_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- String *merge_lock_name = SSTR_WRAP_UTF8("merge", 5);
+ String *merge_lock_name = SSTR_WRAP_C("merge");
LockFactory *lock_factory = S_obtain_lock_factory(self);
return LockFact_Make_Lock(lock_factory, merge_lock_name,
ivars->merge_lock_timeout,
@@ -264,7 +264,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);
- String *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
+ String *merge_json = SSTR_WRAP_C("merge.json");
Hash *data = Hash_new(1);
bool success;
Hash_Store_Utf8(data, "cutoff", 6, (Obj*)Str_newf("%i64", cutoff));
@@ -278,7 +278,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);
- String *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
+ String *merge_json = SSTR_WRAP_C("merge.json");
if (Folder_Exists(ivars->folder, merge_json)) {
Hash *stuff = (Hash*)Json_slurp_json(ivars->folder, merge_json);
if (stuff) {
@@ -297,7 +297,7 @@ IxManager_Read_Merge_Data_IMP(IndexManager *self) {
bool
IxManager_Remove_Merge_Data_IMP(IndexManager *self) {
IndexManagerIVARS *const ivars = IxManager_IVARS(self);
- String *merge_json = SSTR_WRAP_UTF8("merge.json", 10);
+ String *merge_json = SSTR_WRAP_C("merge.json");
return Folder_Delete(ivars->folder, merge_json) != 0;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Index/PolyReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyReader.c b/core/Lucy/Index/PolyReader.c
index 02d3ff8..b20409a 100644
--- a/core/Lucy/Index/PolyReader.c
+++ b/core/Lucy/Index/PolyReader.c
@@ -384,7 +384,7 @@ PolyReader_do_open(PolyReader *self, Obj *index, Snapshot *snapshot,
// Testing only.
if (PolyReader_race_condition_debug1) {
- String *temp = SSTR_WRAP_UTF8("temp", 4);
+ String *temp = SSTR_WRAP_C("temp");
if (Folder_Exists(folder, temp)) {
bool success = Folder_Rename(folder, temp,
PolyReader_race_condition_debug1);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Plan/Schema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.c b/core/Lucy/Plan/Schema.c
index 1682c50..5f6c538 100644
--- a/core/Lucy/Plan/Schema.c
+++ b/core/Lucy/Plan/Schema.c
@@ -422,7 +422,7 @@ Schema_Eat_IMP(Schema *self, Schema *other) {
void
Schema_Write_IMP(Schema *self, Folder *folder, String *filename) {
Hash *dump = Schema_Dump(self);
- String *schema_temp = SSTR_WRAP_UTF8("schema.temp", 11);
+ String *schema_temp = SSTR_WRAP_C("schema.temp");
bool success;
Folder_Delete(folder, schema_temp); // Just in case.
Json_spew_json((Obj*)dump, folder, schema_temp);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Store/CompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c
index 7a530b9..1c59f4f 100644
--- a/core/Lucy/Store/CompoundFileReader.c
+++ b/core/Lucy/Store/CompoundFileReader.c
@@ -38,7 +38,7 @@ CFReader_open(Folder *folder) {
CompoundFileReader*
CFReader_do_open(CompoundFileReader *self, Folder *folder) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
- String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
+ String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
Hash *metadata = (Hash*)Json_slurp_json((Folder*)folder, cfmeta_file);
Err *error = NULL;
@@ -75,7 +75,7 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
}
// Open an instream which we'll clone over and over.
- String *cf_file = (String*)SSTR_WRAP_UTF8("cf.dat", 6);
+ String *cf_file = (String*)SSTR_WRAP_C("cf.dat");
ivars->instream = Folder_Open_In(folder, cf_file);
if (!ivars->instream) {
ERR_ADD_FRAME(Err_get_error());
@@ -169,11 +169,11 @@ CFReader_Local_Delete_IMP(CompoundFileReader *self, String *name) {
// Once the number of virtual files falls to 0, remove the compound
// files.
if (Hash_Get_Size(ivars->records) == 0) {
- String *cf_file = (String*)SSTR_WRAP_UTF8("cf.dat", 6);
+ String *cf_file = (String*)SSTR_WRAP_C("cf.dat");
if (!Folder_Delete(ivars->real_folder, cf_file)) {
return false;
}
- String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
+ String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
if (!Folder_Delete(ivars->real_folder, cfmeta_file)) {
return false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Store/CompoundFileWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileWriter.c b/core/Lucy/Store/CompoundFileWriter.c
index e4d97e1..9389ba3 100644
--- a/core/Lucy/Store/CompoundFileWriter.c
+++ b/core/Lucy/Store/CompoundFileWriter.c
@@ -59,7 +59,7 @@ CFWriter_Destroy_IMP(CompoundFileWriter *self) {
void
CFWriter_Consolidate_IMP(CompoundFileWriter *self) {
CompoundFileWriterIVARS *const ivars = CFWriter_IVARS(self);
- String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
+ String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
if (Folder_Exists(ivars->folder, cfmeta_file)) {
THROW(ERR, "Merge already performed for %o",
Folder_Get_Path(ivars->folder));
@@ -75,8 +75,8 @@ S_clean_up_old_temp_files(CompoundFileWriter *self,
CompoundFileWriterIVARS *ivars) {
UNUSED_VAR(self);
Folder *folder = ivars->folder;
- String *cfmeta_temp = (String*)SSTR_WRAP_UTF8("cfmeta.json.temp", 16);
- String *cf_file = (String*)SSTR_WRAP_UTF8("cf.dat", 6);
+ String *cfmeta_temp = (String*)SSTR_WRAP_C("cfmeta.json.temp");
+ String *cf_file = (String*)SSTR_WRAP_C("cf.dat");
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);
Vector *files = Folder_List(folder, NULL);
Vector *merged = Vec_new(Vec_Get_Size(files));
- String *cf_file = (String*)SSTR_WRAP_UTF8("cf.dat", 6);
+ String *cf_file = (String*)SSTR_WRAP_C("cf.dat");
OutStream *outstream = Folder_Open_Out(folder, (String*)cf_file);
bool rename_success;
@@ -143,8 +143,8 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
}
// Write metadata to cfmeta file.
- String *cfmeta_temp = (String*)SSTR_WRAP_UTF8("cfmeta.json.temp", 16);
- String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
+ String *cfmeta_temp = (String*)SSTR_WRAP_C("cfmeta.json.temp");
+ String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
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/0cf2343c/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index 18a114f..2ab1f35 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -256,7 +256,7 @@ FSFolder_Local_Find_Folder_IMP(FSFolder *self, String *name) {
}
// Try to open a CompoundFileReader. On failure, just use the
// existing folder.
- String *cfmeta_file = (String*)SSTR_WRAP_UTF8("cfmeta.json", 11);
+ String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
if (Folder_Local_Exists(subfolder, cfmeta_file)) {
CompoundFileReader *cf_reader = CFReader_open(subfolder);
if (cf_reader) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index 8ea0aee..9fe100e 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -158,7 +158,7 @@ LFLock_Request_IMP(LockFileLock *self) {
}
// Create the "locks" subdirectory if necessary.
- String *lock_dir_name = (String*)SSTR_WRAP_UTF8("locks", 5);
+ String *lock_dir_name = (String*)SSTR_WRAP_C("locks");
if (!Folder_Exists(ivars->folder, lock_dir_name)) {
if (!Folder_MkDir(ivars->folder, lock_dir_name)) {
Err *mkdir_err = (Err*)CERTIFY(Err_get_error(), ERR);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Store/SharedLock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.c b/core/Lucy/Store/SharedLock.c
index 18bcef5..12c49c7 100644
--- a/core/Lucy/Store/SharedLock.c
+++ b/core/Lucy/Store/SharedLock.c
@@ -99,7 +99,7 @@ void
ShLock_Clear_Stale_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- String *lock_dir_name = (String*)SSTR_WRAP_UTF8("locks", 5);
+ String *lock_dir_name = (String*)SSTR_WRAP_C("locks");
if (!Folder_Find_Folder(ivars->folder, lock_dir_name)) {
return;
}
@@ -127,7 +127,7 @@ bool
ShLock_Is_Locked_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- String *lock_dir_name = (String*)SSTR_WRAP_UTF8("locks", 5);
+ String *lock_dir_name = (String*)SSTR_WRAP_C("locks");
if (!Folder_Find_Folder(ivars->folder, lock_dir_name)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Analysis/TestNormalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestNormalizer.c b/core/Lucy/Test/Analysis/TestNormalizer.c
index ab68930..92adbf4 100644
--- a/core/Lucy/Test/Analysis/TestNormalizer.c
+++ b/core/Lucy/Test/Analysis/TestNormalizer.c
@@ -39,8 +39,8 @@ static void
test_Dump_Load_and_Equals(TestBatchRunner *runner) {
Normalizer *normalizer[4];
- String *NFC = (String*)SSTR_WRAP_UTF8("NFC", 3);
- String *NFKC = (String*)SSTR_WRAP_UTF8("NFKC", 4);
+ String *NFC = (String*)SSTR_WRAP_C("NFC");
+ String *NFKC = (String*)SSTR_WRAP_C("NFKC");
normalizer[0] = Normalizer_new(NFKC, true, false);
normalizer[1] = Normalizer_new(NFC, true, false);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestPolyAnalyzer.c b/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
index 638c72e..31bd76f 100644
--- a/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
+++ b/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
@@ -41,8 +41,8 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
return;
}
- String *EN = (String*)SSTR_WRAP_UTF8("en", 2);
- String *ES = (String*)SSTR_WRAP_UTF8("es", 2);
+ String *EN = (String*)SSTR_WRAP_C("en");
+ String *ES = (String*)SSTR_WRAP_C("es");
PolyAnalyzer *analyzer = PolyAnalyzer_new(EN, NULL);
PolyAnalyzer *other = PolyAnalyzer_new(ES, NULL);
Obj *dump = (Obj*)PolyAnalyzer_Dump(analyzer);
@@ -68,7 +68,7 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_analysis(TestBatchRunner *runner) {
- String *EN = (String*)SSTR_WRAP_UTF8("en", 2);
+ String *EN = (String*)SSTR_WRAP_C("en");
String *source_text = Str_newf("Eats, shoots and leaves.");
Normalizer *normalizer = Normalizer_new(NULL, true, false);
StandardTokenizer *tokenizer = StandardTokenizer_new();
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Analysis/TestRegexTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestRegexTokenizer.c b/core/Lucy/Test/Analysis/TestRegexTokenizer.c
index d1873b1..d24ea1d 100644
--- a/core/Lucy/Test/Analysis/TestRegexTokenizer.c
+++ b/core/Lucy/Test/Analysis/TestRegexTokenizer.c
@@ -37,9 +37,9 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
}
RegexTokenizer *word_char_tokenizer
- = RegexTokenizer_new(SSTR_WRAP_UTF8("\\w+", 3));
+ = RegexTokenizer_new(SSTR_WRAP_C("\\w+"));
RegexTokenizer *whitespace_tokenizer
- = RegexTokenizer_new(SSTR_WRAP_UTF8("\\S+", 3));
+ = RegexTokenizer_new(SSTR_WRAP_C("\\S+"));
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/0cf2343c/core/Lucy/Test/Analysis/TestSnowballStemmer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestSnowballStemmer.c b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
index 1a066ab..64bec15 100644
--- a/core/Lucy/Test/Analysis/TestSnowballStemmer.c
+++ b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
@@ -34,8 +34,8 @@ TestSnowStemmer_new() {
static void
test_Dump_Load_and_Equals(TestBatchRunner *runner) {
- String *EN = (String*)SSTR_WRAP_UTF8("en", 2);
- String *ES = (String*)SSTR_WRAP_UTF8("es", 2);
+ String *EN = (String*)SSTR_WRAP_C("en");
+ String *ES = (String*)SSTR_WRAP_C("es");
SnowballStemmer *stemmer = SnowStemmer_new(EN);
SnowballStemmer *other = SnowStemmer_new(ES);
Obj *dump = (Obj*)SnowStemmer_Dump(stemmer);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Analysis/TestStandardTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestStandardTokenizer.c b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
index 5ada7ec..2e6904d 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();
- String *word = SSTR_WRAP_UTF8(
+ String *word = SSTR_WRAP_C(
" ."
"tha\xCC\x82t's"
":"
@@ -59,8 +59,7 @@ test_tokenizer(TestBatchRunner *runner) {
"\xE0\xB8\x81\xC2\xAD\xC2\xAD"
"\xF0\xA0\x80\x80"
"a"
- "/",
- 35);
+ "/");
Vector *got = StandardTokenizer_Split(tokenizer, word);
String *token = (String*)Vec_Fetch(got, 0);
TEST_TRUE(runner,
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Highlight/TestHighlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Highlight/TestHighlighter.c b/core/Lucy/Test/Highlight/TestHighlighter.c
index 0bdfec1..3ae0687 100644
--- a/core/Lucy/Test/Highlight/TestHighlighter.c
+++ b/core/Lucy/Test/Highlight/TestHighlighter.c
@@ -59,12 +59,12 @@ TestHighlighter_new() {
static void
test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- String *content = (String*)SSTR_WRAP_UTF8("content", 7);
+ String *content = (String*)SSTR_WRAP_C("content");
Highlighter *highlighter = Highlighter_new(searcher, query, content, 6);
int32_t top;
String *raw_excerpt;
- String *field_val = (String *)SSTR_WRAP_UTF8("Ook. Urk. Ick. ", 18);
+ String *field_val = (String *)SSTR_WRAP_C("Ook. Urk. Ick. ");
Vector *spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(0, 18, 1.0f));
HeatMap *heat_map = HeatMap_new(spans, 133);
@@ -95,7 +95,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(raw_excerpt);
DECREF(heat_map);
- field_val = (String *)SSTR_WRAP_UTF8("Ook urk ick i.", 14);
+ field_val = (String *)SSTR_WRAP_C("Ook urk ick i.");
spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(12, 1, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -111,7 +111,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(heat_map);
DECREF(raw_excerpt);
- field_val = (String *)SSTR_WRAP_UTF8("Urk. Iz no good.", 17);
+ field_val = (String *)SSTR_WRAP_C("Urk. Iz no good.");
spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(6, 2, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -129,7 +129,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
// Words longer than excerpt len
- field_val = (String *)SSTR_WRAP_UTF8("abc/def/ghi/jkl/mno", 19);
+ field_val = (String *)SSTR_WRAP_C("abc/def/ghi/jkl/mno");
spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(0, 3, 1.0f));
@@ -160,13 +160,13 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
static void
test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- String *content = (String*)SSTR_WRAP_UTF8("content", 7);
+ String *content = (String*)SSTR_WRAP_C("content");
Highlighter *highlighter = Highlighter_new(searcher, query, content, 3);
String *highlighted;
Vector *spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(2, 1, 0.0f));
- String *raw_excerpt = (String *)SSTR_WRAP_UTF8("a b c", 5);
+ String *raw_excerpt = (String *)SSTR_WRAP_C("a b c");
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
@@ -178,7 +178,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
spans = Vec_new(2);
Vec_Push(spans, (Obj*)Span_new(0, 1, 1.0f));
Vec_Push(spans, (Obj*)Span_new(10, 10, 1.0f));
- raw_excerpt = (String *)SSTR_WRAP_UTF8(PHI, 2);
+ raw_excerpt = (String *)SSTR_WRAP_C(PHI);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
@@ -189,7 +189,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(3, 1, 1.0f));
- raw_excerpt = (String *)SSTR_WRAP_UTF8(PHI " " PHI " " PHI, 8);
+ raw_excerpt = (String *)SSTR_WRAP_C(PHI " " PHI " " PHI);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 1);
TEST_TRUE(runner,
@@ -204,7 +204,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
Vec_Push(spans, (Obj*)Span_new(2, 4, 1.0f));
Vec_Push(spans, (Obj*)Span_new(8, 9, 1.0f));
Vec_Push(spans, (Obj*)Span_new(8, 4, 1.0f));
- raw_excerpt = (String *)SSTR_WRAP_UTF8(PHI " Oook. Urk. Ick. " PHI, 21);
+ raw_excerpt = (String *)SSTR_WRAP_C(PHI " Oook. Urk. Ick. " PHI);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
@@ -221,7 +221,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
static void
test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
Hits *hits) {
- String *content = (String*)SSTR_WRAP_UTF8("content", 7);
+ String *content = (String*)SSTR_WRAP_C("content");
Highlighter *highlighter = Highlighter_new(searcher, query, content, 200);
HitDoc *hit = Hits_Next(hits);
@@ -233,9 +233,9 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
"highlighter tagged phrase and single term");
DECREF(excerpt);
- String *pre_tag = (String*)SSTR_WRAP_UTF8("\x1B[1m", 4);
+ String *pre_tag = (String*)SSTR_WRAP_C("\x1B[1m");
Highlighter_Set_Pre_Tag(highlighter, pre_tag);
- String *post_tag = (String*)SSTR_WRAP_UTF8("\x1B[0m", 4);
+ String *post_tag = (String*)SSTR_WRAP_C("\x1B[0m");
Highlighter_Set_Post_Tag(highlighter, post_tag);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
@@ -255,7 +255,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
DECREF(hit);
DECREF(highlighter);
- query = (Obj*)SSTR_WRAP_UTF8("x \"x y z\" AND b", 15);
+ query = (Obj*)SSTR_WRAP_C("x \"x y z\" AND b");
hits = Searcher_Hits(searcher, query, 0, 10, NULL);
highlighter = Highlighter_new(searcher, query, content, 200);
hit = Hits_Next(hits);
@@ -270,7 +270,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
DECREF(highlighter);
DECREF(hits);
- query = (Obj*)SSTR_WRAP_UTF8("blind", 5);
+ query = (Obj*)SSTR_WRAP_C("blind");
hits = Searcher_Hits(searcher, query, 0, 10, NULL);
highlighter = Highlighter_new(searcher, query, content, 200);
hit = Hits_Next(hits);
@@ -283,7 +283,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
DECREF(highlighter);
DECREF(hits);
- query = (Obj*)SSTR_WRAP_UTF8("why", 3);
+ query = (Obj*)SSTR_WRAP_C("why");
hits = Searcher_Hits(searcher, query, 0, 10, NULL);
highlighter = Highlighter_new(searcher, query, content, 200);
hit = Hits_Next(hits);
@@ -296,7 +296,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
DECREF(highlighter);
DECREF(hits);
- Obj *term = (Obj*)SSTR_WRAP_UTF8("x", 1);
+ Obj *term = (Obj*)SSTR_WRAP_C("x");
query = (Obj*)TermQuery_new(content, term);
hits = Searcher_Hits(searcher, query, 0, 10, NULL);
hit = Hits_Next(hits);
@@ -307,7 +307,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
"specify field highlights correct field...");
DECREF(excerpt);
DECREF(highlighter);
- String *alt = (String*)SSTR_WRAP_UTF8("alt", 3);
+ String *alt = (String*)SSTR_WRAP_C("alt");
highlighter = Highlighter_new(searcher, query, alt, 200);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_FALSE(runner,
@@ -329,9 +329,9 @@ test_highlighting(TestBatchRunner *runner) {
FullTextType *dunked_type = FullTextType_new((Analyzer*)tokenizer);
FullTextType_Set_Highlightable(dunked_type, true);
FullTextType_Set_Boost(dunked_type, 0.1f);
- String *content = (String*)SSTR_WRAP_UTF8("content", 7);
+ String *content = (String*)SSTR_WRAP_C("content");
Schema_Spec_Field(schema, content, (FieldType*)plain_type);
- String *alt = (String*)SSTR_WRAP_UTF8("alt", 3);
+ String *alt = (String*)SSTR_WRAP_C("alt");
Schema_Spec_Field(schema, alt, (FieldType*)dunked_type);
DECREF(plain_type);
DECREF(dunked_type);
@@ -341,23 +341,22 @@ test_highlighting(TestBatchRunner *runner) {
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
Doc *doc = Doc_new(NULL, 0);
- String *string = (String *)SSTR_WRAP_UTF8(TEST_STRING, TEST_STRING_LEN);
+ String *string = (String *)SSTR_WRAP_C(TEST_STRING);
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
doc = Doc_new(NULL, 0);
- string = (String *)SSTR_WRAP_UTF8("\"I see,\" said the blind man.", 28);
+ string = (String *)SSTR_WRAP_C("\"I see,\" said the blind man.");
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
doc = Doc_new(NULL, 0);
- string = (String *)SSTR_WRAP_UTF8("x but not why or 2ee", 20);
+ string = (String *)SSTR_WRAP_C("x but not why or 2ee");
Doc_Store(doc, content, (Obj*)string);
- string = (String *)SSTR_WRAP_UTF8(TEST_STRING
- " and extra stuff so it scores lower",
- TEST_STRING_LEN + 35);
+ string = (String *)SSTR_WRAP_C(TEST_STRING
+ " and extra stuff so it scores lower");
Doc_Store(doc, alt, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
@@ -366,7 +365,7 @@ test_highlighting(TestBatchRunner *runner) {
DECREF(indexer);
Searcher *searcher = (Searcher*)IxSearcher_new((Obj*)folder);
- Obj *query = (Obj*)SSTR_WRAP_UTF8("\"x y z\" AND " PHI, 14);
+ Obj *query = (Obj*)SSTR_WRAP_C("\"x y z\" AND " PHI);
Hits *hits = Searcher_Hits(searcher, query, 0, 10, NULL);
test_Raw_Excerpt(runner, searcher, query);
@@ -385,7 +384,7 @@ test_hl_selection(TestBatchRunner *runner) {
StandardTokenizer *tokenizer = StandardTokenizer_new();
FullTextType *plain_type = FullTextType_new((Analyzer*)tokenizer);
FullTextType_Set_Highlightable(plain_type, true);
- String *content = (String*)SSTR_WRAP_UTF8("content", 7);
+ String *content = (String*)SSTR_WRAP_C("content");
Schema_Spec_Field(schema, content, (FieldType*)plain_type);
DECREF(plain_type);
DECREF(tokenizer);
@@ -408,7 +407,7 @@ test_hl_selection(TestBatchRunner *runner) {
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. "
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. ";
Doc *doc = Doc_new(NULL, 0);
- String *string = (String *)SSTR_WRAP_UTF8(test_string, strlen(test_string));
+ String *string = (String *)SSTR_WRAP_C(test_string);
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
@@ -417,13 +416,13 @@ test_hl_selection(TestBatchRunner *runner) {
DECREF(indexer);
Searcher *searcher = (Searcher*)IxSearcher_new((Obj*)folder);
- Obj *query = (Obj*)SSTR_WRAP_UTF8("NNN MMM", 7);
+ Obj *query = (Obj*)SSTR_WRAP_C("NNN MMM");
Highlighter *highlighter = Highlighter_new(searcher, query, content, 200);
Hits *hits = Searcher_Hits(searcher, query, 0, 10, NULL);
HitDoc *hit = Hits_Next(hits);
String *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
- String *mmm = (String*)SSTR_WRAP_UTF8("MMM", 3);
- String *nnn = (String*)SSTR_WRAP_UTF8("NNN", 3);
+ String *mmm = (String*)SSTR_WRAP_C("MMM");
+ String *nnn = (String*)SSTR_WRAP_C("NNN");
TEST_TRUE(runner, Str_Contains(excerpt, mmm) || Str_Contains(excerpt, nnn),
"Sentence boundary algo doesn't chop terms");
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Index/TestSegment.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSegment.c b/core/Lucy/Test/Index/TestSegment.c
index 1d8bbb2..87a07af 100644
--- a/core/Lucy/Test/Index/TestSegment.c
+++ b/core/Lucy/Test/Index/TestSegment.c
@@ -32,9 +32,9 @@ TestSeg_new() {
static void
test_fields(TestBatchRunner *runner) {
Segment *segment = Seg_new(1);
- String *foo = SSTR_WRAP_UTF8("foo", 3);
- String *bar = SSTR_WRAP_UTF8("bar", 3);
- String *baz = SSTR_WRAP_UTF8("baz", 3);
+ String *foo = SSTR_WRAP_C("foo");
+ String *bar = SSTR_WRAP_C("bar");
+ String *baz = SSTR_WRAP_C("baz");
int32_t field_num;
field_num = Seg_Add_Field(segment, foo);
@@ -126,8 +126,8 @@ test_Write_File_and_Read_File(TestBatchRunner *runner) {
Segment *segment = Seg_new(100);
Segment *got = Seg_new(100);
String *meta;
- String *flotsam = SSTR_WRAP_UTF8("flotsam", 7);
- String *jetsam = SSTR_WRAP_UTF8("jetsam", 6);
+ String *flotsam = SSTR_WRAP_C("flotsam");
+ String *jetsam = SSTR_WRAP_C("jetsam");
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/0cf2343c/core/Lucy/Test/Index/TestSnapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSnapshot.c b/core/Lucy/Test/Index/TestSnapshot.c
index da47630..e790206 100644
--- a/core/Lucy/Test/Index/TestSnapshot.c
+++ b/core/Lucy/Test/Index/TestSnapshot.c
@@ -31,8 +31,8 @@ TestSnapshot_new() {
static void
test_Add_and_Delete(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
- String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
- String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
+ String *foo = (String*)SSTR_WRAP_C("foo");
+ String *bar = (String*)SSTR_WRAP_C("bar");
Snapshot_Add_Entry(snapshot, foo);
Snapshot_Add_Entry(snapshot, foo); // redundant
@@ -55,8 +55,8 @@ static void
test_path_handling(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- String *snap = (String*)SSTR_WRAP_UTF8("snap", 4);
- String *crackle = (String*)SSTR_WRAP_UTF8("crackle", 7);
+ String *snap = (String*)SSTR_WRAP_C("snap");
+ String *crackle = (String*)SSTR_WRAP_C("crackle");
Snapshot_Write_File(snapshot, folder, snap);
TEST_TRUE(runner, Str_Equals(snap, (Obj*)Snapshot_Get_Path(snapshot)),
@@ -79,8 +79,8 @@ static void
test_Read_File_and_Write_File(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- String *snap = (String*)SSTR_WRAP_UTF8("snap", 4);
- String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
+ String *snap = (String*)SSTR_WRAP_C("snap");
+ String *foo = (String*)SSTR_WRAP_C("foo");
Snapshot_Add_Entry(snapshot, foo);
Snapshot_Write_File(snapshot, folder, snap);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Index/TestSortWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSortWriter.c b/core/Lucy/Test/Index/TestSortWriter.c
index 1ac1c80..3c5f62b 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) {
- String *string = SSTR_WRAP_UTF8(value, strlen(value));
+ String *string = SSTR_WRAP_C(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);
- String *bike_str = SSTR_WRAP_UTF8("bike", 4);
+ String *bike_str = SSTR_WRAP_C("bike");
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/0cf2343c/core/Lucy/Test/Plan/TestFieldType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFieldType.c b/core/Lucy/Test/Plan/TestFieldType.c
index f4c658d..b81fce5 100644
--- a/core/Lucy/Test/Plan/TestFieldType.c
+++ b/core/Lucy/Test/Plan/TestFieldType.c
@@ -37,7 +37,7 @@ DummyFieldType_new() {
static FieldType*
S_alt_field_type() {
- String *name = SSTR_WRAP_UTF8("DummyFieldType2", 15);
+ String *name = SSTR_WRAP_C("DummyFieldType2");
Class *klass = Class_singleton(name, DUMMYFIELDTYPE);
FieldType *self = (FieldType*)Class_Make_Obj(klass);
return FType_init(self);
@@ -84,8 +84,8 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_Compare_Values(TestBatchRunner *runner) {
FieldType *type = (FieldType*)DummyFieldType_new();
- Obj *a = (Obj*)SSTR_WRAP_UTF8("a", 1);
- Obj *b = (Obj*)SSTR_WRAP_UTF8("b", 1);
+ Obj *a = (Obj*)SSTR_WRAP_C("a");
+ Obj *b = (Obj*)SSTR_WRAP_C("b");
TEST_TRUE(runner, FType_Compare_Values(type, a, b) < 0,
"a less than b");
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Plan/TestFullTextType.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFullTextType.c b/core/Lucy/Test/Plan/TestFullTextType.c
index f27c718..709b1c2 100644
--- a/core/Lucy/Test/Plan/TestFullTextType.c
+++ b/core/Lucy/Test/Plan/TestFullTextType.c
@@ -88,8 +88,8 @@ static void
test_Compare_Values(TestBatchRunner *runner) {
StandardTokenizer *tokenizer = StandardTokenizer_new();
FullTextType *type = FullTextType_new((Analyzer*)tokenizer);
- Obj *a = (Obj*)SSTR_WRAP_UTF8("a", 1);
- Obj *b = (Obj*)SSTR_WRAP_UTF8("b", 1);
+ Obj *a = (Obj*)SSTR_WRAP_C("a");
+ Obj *b = (Obj*)SSTR_WRAP_C("b");
TEST_TRUE(runner, FullTextType_Compare_Values(type, a, b) < 0,
"a less than b");
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Search/TestQueryParserLogic.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserLogic.c b/core/Lucy/Test/Search/TestQueryParserLogic.c
index ace8aa8..d8a647b 100644
--- a/core/Lucy/Test/Search/TestQueryParserLogic.c
+++ b/core/Lucy/Test/Search/TestQueryParserLogic.c
@@ -864,7 +864,7 @@ S_create_index() {
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
uint32_t i, max;
- String *field = (String*)SSTR_WRAP_UTF8("content", 7);
+ String *field = (String*)SSTR_WRAP_C("content");
for (i = 0, max = Vec_Get_Size(doc_set); i < max; i++) {
Doc *doc = Doc_new(NULL, 0);
Doc_Store(doc, field, Vec_Fetch(doc_set, i));
@@ -890,7 +890,7 @@ TestQPLogic_Run_IMP(TestQueryParserLogic *self, TestBatchRunner *runner) {
IndexSearcher *searcher = IxSearcher_new((Obj*)folder);
QueryParser *or_parser = QParser_new(IxSearcher_Get_Schema(searcher),
NULL, NULL, NULL);
- String *AND = SSTR_WRAP_UTF8("AND", 3);
+ String *AND = SSTR_WRAP_C("AND");
QueryParser *and_parser = QParser_new(IxSearcher_Get_Schema(searcher),
NULL, AND, NULL);
QParser_Set_Heed_Colons(or_parser, true);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Store/TestFSDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSDirHandle.c b/core/Lucy/Test/Store/TestFSDirHandle.c
index 5568255..ae478e6 100644
--- a/core/Lucy/Test/Store/TestFSDirHandle.c
+++ b/core/Lucy/Test/Store/TestFSDirHandle.c
@@ -43,10 +43,10 @@ TestFSDH_new() {
static void
test_all(TestBatchRunner *runner) {
- String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
- String *boffo = (String*)SSTR_WRAP_UTF8("boffo", 5);
- String *foo_boffo = (String*)SSTR_WRAP_UTF8("foo/boffo", 9);
- String *test_dir = (String*)SSTR_WRAP_UTF8("_fsdir_test", 11);
+ String *foo = (String*)SSTR_WRAP_C("foo");
+ String *boffo = (String*)SSTR_WRAP_C("boffo");
+ String *foo_boffo = (String*)SSTR_WRAP_C("foo/boffo");
+ String *test_dir = (String*)SSTR_WRAP_C("_fsdir_test");
FSFolder *folder = FSFolder_new(test_dir);
bool saw_foo = false;
bool saw_boffo = false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Store/TestFSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFileHandle.c b/core/Lucy/Test/Store/TestFSFileHandle.c
index f1b4d30..d156dc4 100644
--- a/core/Lucy/Test/Store/TestFSFileHandle.c
+++ b/core/Lucy/Test/Store/TestFSFileHandle.c
@@ -42,7 +42,7 @@ static void
test_open(TestBatchRunner *runner) {
FSFileHandle *fh;
- String *test_filename = (String*)SSTR_WRAP_UTF8("_fstest", 7);
+ String *test_filename = (String*)SSTR_WRAP_C("_fstest");
remove(Str_Get_Ptr8(test_filename));
@@ -108,7 +108,7 @@ test_Read_Write(TestBatchRunner *runner) {
const char *bar = "bar";
char buffer[12];
char *buf = buffer;
- String *test_filename = (String*)SSTR_WRAP_UTF8("_fstest", 7);
+ String *test_filename = (String*)SSTR_WRAP_C("_fstest");
remove(Str_Get_Ptr8(test_filename));
fh = FSFH_open(test_filename,
@@ -162,7 +162,7 @@ test_Read_Write(TestBatchRunner *runner) {
static void
test_Close(TestBatchRunner *runner) {
- String *test_filename = (String*)SSTR_WRAP_UTF8("_fstest", 7);
+ String *test_filename = (String*)SSTR_WRAP_C("_fstest");
FSFileHandle *fh;
remove(Str_Get_Ptr8(test_filename));
@@ -199,7 +199,7 @@ test_Close(TestBatchRunner *runner) {
static void
test_Window(TestBatchRunner *runner) {
- String *test_filename = (String*)SSTR_WRAP_UTF8("_fstest", 7);
+ String *test_filename = (String*)SSTR_WRAP_C("_fstest");
FSFileHandle *fh;
FileWindow *window = FileWindow_new();
FileWindowIVARS *const window_ivars = FileWindow_IVARS(window);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Store/TestFSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFolder.c b/core/Lucy/Test/Store/TestFSFolder.c
index d2fbbef..f4b1c5f 100644
--- a/core/Lucy/Test/Store/TestFSFolder.c
+++ b/core/Lucy/Test/Store/TestFSFolder.c
@@ -63,7 +63,7 @@ TestFSFolder_new() {
static Folder*
S_set_up() {
rmdir("_fstest");
- String *test_dir = (String*)SSTR_WRAP_UTF8("_fstest", 7);
+ String *test_dir = (String*)SSTR_WRAP_C("_fstest");
FSFolder *folder = FSFolder_new(test_dir);
FSFolder_Initialize(folder);
if (!FSFolder_Check(folder)) {
@@ -89,7 +89,7 @@ S_tear_down() {
static void
test_Initialize_and_Check(TestBatchRunner *runner) {
rmdir("_fstest");
- String *test_dir = (String*)SSTR_WRAP_UTF8("_fstest", 7);
+ String *test_dir = (String*)SSTR_WRAP_C("_fstest");
FSFolder *folder = FSFolder_new(test_dir);
TEST_FALSE(runner, FSFolder_Check(folder),
"Check() returns false when folder dir doesn't exist");
@@ -105,9 +105,9 @@ static void
test_protect_symlinks(TestBatchRunner *runner) {
#ifdef ENABLE_SYMLINK_TESTS
FSFolder *folder = (FSFolder*)S_set_up();
- String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
- String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
- String *foo_boffo = (String*)SSTR_WRAP_UTF8("foo/boffo", 9);
+ String *foo = (String*)SSTR_WRAP_C("foo");
+ String *bar = (String*)SSTR_WRAP_C("bar");
+ String *foo_boffo = (String*)SSTR_WRAP_C("foo/boffo");
FSFolder_MkDir(folder, foo);
FSFolder_MkDir(folder, bar);
@@ -158,14 +158,14 @@ void
test_disallow_updir(TestBatchRunner *runner) {
FSFolder *outer_folder = (FSFolder*)S_set_up();
- String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
- String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
+ String *foo = (String*)SSTR_WRAP_C("foo");
+ String *bar = (String*)SSTR_WRAP_C("bar");
FSFolder_MkDir(outer_folder, foo);
FSFolder_MkDir(outer_folder, bar);
- String *inner_path = (String*)SSTR_WRAP_UTF8("_fstest/foo", 11);
+ String *inner_path = (String*)SSTR_WRAP_C("_fstest/foo");
FSFolder *foo_folder = FSFolder_new(inner_path);
- String *up_bar = (String*)SSTR_WRAP_UTF8("../bar", 6);
+ String *up_bar = (String*)SSTR_WRAP_C("../bar");
TEST_FALSE(runner, FSFolder_Exists(foo_folder, up_bar),
"up-dirs are inaccessible.");
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Store/TestFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFileHandle.c b/core/Lucy/Test/Store/TestFileHandle.c
index c09e4fa..2e9850f 100644
--- a/core/Lucy/Test/Store/TestFileHandle.c
+++ b/core/Lucy/Test/Store/TestFileHandle.c
@@ -38,7 +38,7 @@ S_no_op_method(const void *vself) {
static FileHandle*
S_new_filehandle() {
- String *class_name = SSTR_WRAP_UTF8("TestFileHandle", 14);
+ String *class_name = SSTR_WRAP_C("TestFileHandle");
FileHandle *fh;
Class *klass = Class_fetch_class(class_name);
if (!klass) {
@@ -54,7 +54,7 @@ TestFH_Run_IMP(TestFileHandle *self, TestBatchRunner *runner) {
TestBatchRunner_Plan(runner, (TestBatch*)self, 2);
FileHandle *fh = S_new_filehandle();
- String *foo = SSTR_WRAP_UTF8("foo", 3);
+ String *foo = SSTR_WRAP_C("foo");
TEST_TRUE(runner, Str_Equals_Utf8(FH_Get_Path(fh), "", 0), "Get_Path");
FH_Set_Path(fh, foo);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Store/TestInStream.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestInStream.c b/core/Lucy/Test/Store/TestInStream.c
index 764fa83..3aaf42d 100644
--- a/core/Lucy/Test/Store/TestInStream.c
+++ b/core/Lucy/Test/Store/TestInStream.c
@@ -95,8 +95,8 @@ test_refill(TestBatchRunner *runner) {
static void
test_Clone_and_Reopen(TestBatchRunner *runner) {
- String *foo = SSTR_WRAP_UTF8("foo", 3);
- String *bar = SSTR_WRAP_UTF8("bar", 3);
+ String *foo = SSTR_WRAP_C("foo");
+ String *bar = SSTR_WRAP_C("bar");
RAMFile *file = RAMFile_new(NULL, false);
OutStream *outstream = OutStream_open((Obj*)file);
RAMFileHandle *fh;
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Store/TestRAMDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestRAMDirHandle.c b/core/Lucy/Test/Store/TestRAMDirHandle.c
index 22b1dff..15ebae7 100644
--- a/core/Lucy/Test/Store/TestRAMDirHandle.c
+++ b/core/Lucy/Test/Store/TestRAMDirHandle.c
@@ -33,9 +33,9 @@ TestRAMDH_new() {
static void
test_all(TestBatchRunner *runner) {
RAMFolder *folder = RAMFolder_new(NULL);
- String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
- String *boffo = (String*)SSTR_WRAP_UTF8("boffo", 5);
- String *foo_boffo = (String*)SSTR_WRAP_UTF8("foo/boffo", 9);
+ String *foo = (String*)SSTR_WRAP_C("foo");
+ String *boffo = (String*)SSTR_WRAP_C("boffo");
+ String *foo_boffo = (String*)SSTR_WRAP_C("foo/boffo");
bool saw_foo = false;
bool saw_boffo = false;
bool foo_was_dir = false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/TestSchema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestSchema.c b/core/Lucy/Test/TestSchema.c
index b7b65b6..ae24751 100644
--- a/core/Lucy/Test/TestSchema.c
+++ b/core/Lucy/Test/TestSchema.c
@@ -42,7 +42,7 @@ TestSchema_init(TestSchema *self, bool use_alt_arch) {
Schema_init((Schema*)self);
FullTextType_Set_Highlightable(type, true);
- String *content = (String*)SSTR_WRAP_UTF8("content", 7);
+ String *content = (String*)SSTR_WRAP_C("content");
TestSchema_Spec_Field(self, content, (FieldType*)type);
DECREF(type);
DECREF(tokenizer);
@@ -70,7 +70,7 @@ test_Equals(TestBatchRunner *runner) {
TestSchema *schema = TestSchema_new(false);
TestSchema *arch_differs = TestSchema_new(true);
TestSchema *spec_differs = TestSchema_new(false);
- String *content = (String*)SSTR_WRAP_UTF8("content", 7);
+ String *content = (String*)SSTR_WRAP_C("content");
FullTextType *type = (FullTextType*)TestSchema_Fetch_Type(spec_differs,
content);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/TestSimple.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestSimple.c b/core/Lucy/Test/TestSimple.c
index 6e8adfd..93fd747 100644
--- a/core/Lucy/Test/TestSimple.c
+++ b/core/Lucy/Test/TestSimple.c
@@ -34,38 +34,38 @@ TestSimple_new() {
static void
test_simple(TestBatchRunner *runner) {
RAMFolder *folder = RAMFolder_new(NULL);
- String *language = SSTR_WRAP_UTF8("en", 2);
+ String *language = SSTR_WRAP_C("en");
Simple *lucy = Simple_new((Obj*)folder, language);
- String *food_field = SSTR_WRAP_UTF8("food", 4);
+ String *food_field = SSTR_WRAP_C("food");
{
Doc *doc = Doc_new(NULL, 0);
- String *value = SSTR_WRAP_UTF8("creamed corn", 12);
+ String *value = SSTR_WRAP_C("creamed corn");
Doc_Store(doc, food_field, (Obj*)value);
Simple_Add_Doc(lucy, doc);
DECREF(doc);
- String *query = SSTR_WRAP_UTF8("creamed", 7);
+ String *query = SSTR_WRAP_C("creamed");
uint32_t num_results = Simple_Search(lucy, query, 0, 10);
TEST_INT_EQ(runner, num_results, 1, "Search works right after add");
}
{
Doc *doc = Doc_new(NULL, 0);
- String *value = SSTR_WRAP_UTF8("creamed spinach", 15);
+ String *value = SSTR_WRAP_C("creamed spinach");
Doc_Store(doc, food_field, (Obj*)value);
Simple_Add_Doc(lucy, doc);
DECREF(doc);
- String *query = SSTR_WRAP_UTF8("creamed", 7);
+ String *query = SSTR_WRAP_C("creamed");
uint32_t num_results = Simple_Search(lucy, query, 0, 10);
TEST_INT_EQ(runner, num_results, 2, "Search returns total hits");
}
{
Doc *doc = Doc_new(NULL, 0);
- String *value = SSTR_WRAP_UTF8("creamed broccoli", 16);
+ String *value = SSTR_WRAP_C("creamed broccoli");
Doc_Store(doc, food_field, (Obj*)value);
Simple_Add_Doc(lucy, doc);
DECREF(doc);
@@ -73,7 +73,7 @@ test_simple(TestBatchRunner *runner) {
DECREF(lucy);
lucy = Simple_new((Obj*)folder, language);
- String *query = SSTR_WRAP_UTF8("cream", 5);
+ String *query = SSTR_WRAP_C("cream");
uint32_t num_results = Simple_Search(lucy, query, 0, 10);
TEST_INT_EQ(runner, num_results, 3, "commit upon destroy");
@@ -88,13 +88,13 @@ test_simple(TestBatchRunner *runner) {
{
Doc *doc = Doc_new(NULL, 0);
- String *band_field = SSTR_WRAP_UTF8("band", 4);
- String *value = SSTR_WRAP_UTF8("Cream", 5);
+ String *band_field = SSTR_WRAP_C("band");
+ String *value = SSTR_WRAP_C("Cream");
Doc_Store(doc, band_field, (Obj*)value);
Simple_Add_Doc(lucy, doc);
DECREF(doc);
- String *query = SSTR_WRAP_UTF8("cream", 5);
+ String *query = SSTR_WRAP_C("cream");
uint32_t num_results = Simple_Search(lucy, query, 0, 10);
TEST_INT_EQ(runner, num_results, 4,
"Search uses correct EasyAnalyzer");
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c
index 68171dc..6659d19 100644
--- a/core/Lucy/Test/TestUtils.c
+++ b/core/Lucy/Test/TestUtils.c
@@ -76,14 +76,14 @@ TestUtils_make_poly_query(uint32_t boolop, ...) {
TermQuery*
TestUtils_make_term_query(const char *field, const char *term) {
- String *field_str = (String*)SSTR_WRAP_UTF8(field, strlen(field));
- String *term_str = (String*)SSTR_WRAP_UTF8(term, strlen(term));
+ String *field_str = (String*)SSTR_WRAP_C(field);
+ String *term_str = (String*)SSTR_WRAP_C(term);
return TermQuery_new((String*)field_str, (Obj*)term_str);
}
PhraseQuery*
TestUtils_make_phrase_query(const char *field, ...) {
- String *field_str = (String*)SSTR_WRAP_UTF8(field, strlen(field));
+ String *field_str = (String*)SSTR_WRAP_C(field);
va_list args;
Vector *terms = Vec_new(0);
PhraseQuery *query;
@@ -102,9 +102,9 @@ TestUtils_make_phrase_query(const char *field, ...) {
LeafQuery*
TestUtils_make_leaf_query(const char *field, const char *term) {
- String *term_str = (String*)SSTR_WRAP_UTF8(term, strlen(term));
+ String *term_str = (String*)SSTR_WRAP_C(term);
String *field_str = field
- ? (String*)SSTR_WRAP_UTF8(field, strlen(field))
+ ? (String*)SSTR_WRAP_C(field)
: NULL;
return LeafQuery_new(field_str, term_str);
}
@@ -120,9 +120,9 @@ RangeQuery*
TestUtils_make_range_query(const char *field, const char *lower_term,
const char *upper_term, bool include_lower,
bool include_upper) {
- String *f = (String*)SSTR_WRAP_UTF8(field, strlen(field));
- String *lterm = (String*)SSTR_WRAP_UTF8(lower_term, strlen(lower_term));
- String *uterm = (String*)SSTR_WRAP_UTF8(upper_term, strlen(upper_term));
+ String *f = (String*)SSTR_WRAP_C(field);
+ String *lterm = (String*)SSTR_WRAP_C(lower_term);
+ String *uterm = (String*)SSTR_WRAP_C(upper_term);
return RangeQuery_new(f, (Obj*)lterm, (Obj*)uterm, include_lower,
include_upper);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Util/TestIndexFileNames.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestIndexFileNames.c b/core/Lucy/Test/Util/TestIndexFileNames.c
index 98f6cfb..a9d5708 100644
--- a/core/Lucy/Test/Util/TestIndexFileNames.c
+++ b/core/Lucy/Test/Util/TestIndexFileNames.c
@@ -30,7 +30,7 @@ TestIxFileNames_new() {
static void
S_test_local_part(TestBatchRunner *runner, const char *source,
const char *wanted, const char *test_name) {
- String *source_str = SSTR_WRAP_UTF8(source, strlen(source));
+ String *source_str = SSTR_WRAP_C(source);
String *got = IxFileNames_local_part(source_str);
TEST_TRUE(runner, Str_Equals_Utf8(got, wanted, strlen(wanted)), test_name);
DECREF(got);
@@ -51,7 +51,7 @@ test_local_part(TestBatchRunner *runner) {
static void
S_test_extract_gen(TestBatchRunner *runner, const char *name, uint64_t gen,
const char *test_name) {
- String *source = SSTR_WRAP_UTF8(name, strlen(name));
+ String *source = SSTR_WRAP_C(name);
TEST_TRUE(runner, IxFileNames_extract_gen(source) == gen, test_name);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/core/Lucy/Test/Util/TestJson.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestJson.c b/core/Lucy/Test/Util/TestJson.c
index 1286d6b..5310cee 100644
--- a/core/Lucy/Test/Util/TestJson.c
+++ b/core/Lucy/Test/Util/TestJson.c
@@ -202,7 +202,7 @@ test_spew_and_slurp(TestBatchRunner *runner) {
Obj *dump = S_make_dump();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- String *foo = (String*)SSTR_WRAP_UTF8("foo", 3);
+ String *foo = (String*)SSTR_WRAP_C("foo");
bool result = Json_spew_json(dump, folder, foo);
TEST_TRUE(runner, result, "spew_json returns true on success");
TEST_TRUE(runner, Folder_Exists(folder, foo),
@@ -220,14 +220,14 @@ test_spew_and_slurp(TestBatchRunner *runner) {
"Failed spew_json sets global error");
Err_set_error(NULL);
- String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
+ String *bar = (String*)SSTR_WRAP_C("bar");
got = Json_slurp_json(folder, bar);
TEST_TRUE(runner, got == NULL,
"slurp_json returns NULL when file doesn't exist");
TEST_TRUE(runner, Err_get_error() != NULL,
"Failed slurp_json sets global error");
- String *boffo = (String*)SSTR_WRAP_UTF8("boffo", 5);
+ String *boffo = (String*)SSTR_WRAP_C("boffo");
FileHandle *fh
= Folder_Open_FileHandle(folder, boffo, FH_CREATE | FH_WRITE_ONLY);
@@ -248,7 +248,7 @@ test_spew_and_slurp(TestBatchRunner *runner) {
static void
S_verify_bad_syntax(TestBatchRunner *runner, const char *bad, const char *mess) {
- String *has_errors = SSTR_WRAP_UTF8(bad, strlen(bad));
+ String *has_errors = SSTR_WRAP_C(bad);
Err_set_error(NULL);
Obj *not_json = Json_from_json(has_errors);
TEST_TRUE(runner, not_json == NULL, "from_json returns NULL: %s", mess);
http://git-wip-us.apache.org/repos/asf/lucy/blob/0cf2343c/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 77fd9af..0846021 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -88,8 +88,7 @@ STORABLE_thaw(blank_obj, cloning, serialized_sv)
PPCODE:
{
char *class_name = HvNAME(SvSTASH(SvRV(blank_obj)));
- cfish_String *class_name_str
- = CFISH_SSTR_WRAP_UTF8(class_name, strlen(class_name));
+ cfish_String *class_name_str = CFISH_SSTR_WRAP_C(class_name);
cfish_Class *klass = cfish_Class_singleton(class_name_str, NULL);
STRLEN len;
char *ptr = SvPV(serialized_sv, len);
[6/8] lucy git commit: Don't cast stack strings to String
Posted by nw...@apache.org.
Don't cast stack strings to String
The old StackString class is gone.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/333119dd
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/333119dd
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/333119dd
Branch: refs/heads/master
Commit: 333119dd1308083a34d66a6ace74ae2aa628baa5
Parents: 0cf2343
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Oct 24 16:49:21 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Oct 24 16:49:21 2015 +0200
----------------------------------------------------------------------
core/Lucy/Store/CompoundFileReader.c | 8 ++--
core/Lucy/Store/CompoundFileWriter.c | 12 +++---
core/Lucy/Store/FSFolder.c | 2 +-
core/Lucy/Store/Lock.c | 2 +-
core/Lucy/Store/SharedLock.c | 4 +-
core/Lucy/Test/Analysis/TestNormalizer.c | 4 +-
core/Lucy/Test/Analysis/TestPolyAnalyzer.c | 6 +--
core/Lucy/Test/Analysis/TestSnowballStemmer.c | 4 +-
core/Lucy/Test/Highlight/TestHighlighter.c | 49 +++++++++++-----------
core/Lucy/Test/Index/TestSnapshot.c | 12 +++---
core/Lucy/Test/Search/TestQueryParserLogic.c | 2 +-
core/Lucy/Test/Store/TestFSDirHandle.c | 8 ++--
core/Lucy/Test/Store/TestFSFileHandle.c | 8 ++--
core/Lucy/Test/Store/TestFSFolder.c | 20 ++++-----
core/Lucy/Test/Store/TestRAMDirHandle.c | 6 +--
core/Lucy/Test/TestSchema.c | 4 +-
core/Lucy/Test/TestUtils.c | 18 ++++----
core/Lucy/Test/Util/TestJson.c | 6 +--
18 files changed, 86 insertions(+), 89 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Store/CompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c
index 1c59f4f..db24fa1 100644
--- a/core/Lucy/Store/CompoundFileReader.c
+++ b/core/Lucy/Store/CompoundFileReader.c
@@ -38,7 +38,7 @@ CFReader_open(Folder *folder) {
CompoundFileReader*
CFReader_do_open(CompoundFileReader *self, Folder *folder) {
CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
- String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
+ String *cfmeta_file = SSTR_WRAP_C("cfmeta.json");
Hash *metadata = (Hash*)Json_slurp_json((Folder*)folder, cfmeta_file);
Err *error = NULL;
@@ -75,7 +75,7 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
}
// Open an instream which we'll clone over and over.
- String *cf_file = (String*)SSTR_WRAP_C("cf.dat");
+ String *cf_file = SSTR_WRAP_C("cf.dat");
ivars->instream = Folder_Open_In(folder, cf_file);
if (!ivars->instream) {
ERR_ADD_FRAME(Err_get_error());
@@ -169,11 +169,11 @@ CFReader_Local_Delete_IMP(CompoundFileReader *self, String *name) {
// Once the number of virtual files falls to 0, remove the compound
// files.
if (Hash_Get_Size(ivars->records) == 0) {
- String *cf_file = (String*)SSTR_WRAP_C("cf.dat");
+ String *cf_file = SSTR_WRAP_C("cf.dat");
if (!Folder_Delete(ivars->real_folder, cf_file)) {
return false;
}
- String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
+ String *cfmeta_file = SSTR_WRAP_C("cfmeta.json");
if (!Folder_Delete(ivars->real_folder, cfmeta_file)) {
return false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Store/CompoundFileWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileWriter.c b/core/Lucy/Store/CompoundFileWriter.c
index 9389ba3..9cb496a 100644
--- a/core/Lucy/Store/CompoundFileWriter.c
+++ b/core/Lucy/Store/CompoundFileWriter.c
@@ -59,7 +59,7 @@ CFWriter_Destroy_IMP(CompoundFileWriter *self) {
void
CFWriter_Consolidate_IMP(CompoundFileWriter *self) {
CompoundFileWriterIVARS *const ivars = CFWriter_IVARS(self);
- String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
+ String *cfmeta_file = SSTR_WRAP_C("cfmeta.json");
if (Folder_Exists(ivars->folder, cfmeta_file)) {
THROW(ERR, "Merge already performed for %o",
Folder_Get_Path(ivars->folder));
@@ -75,8 +75,8 @@ S_clean_up_old_temp_files(CompoundFileWriter *self,
CompoundFileWriterIVARS *ivars) {
UNUSED_VAR(self);
Folder *folder = ivars->folder;
- String *cfmeta_temp = (String*)SSTR_WRAP_C("cfmeta.json.temp");
- String *cf_file = (String*)SSTR_WRAP_C("cf.dat");
+ String *cfmeta_temp = SSTR_WRAP_C("cfmeta.json.temp");
+ String *cf_file = SSTR_WRAP_C("cf.dat");
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);
Vector *files = Folder_List(folder, NULL);
Vector *merged = Vec_new(Vec_Get_Size(files));
- String *cf_file = (String*)SSTR_WRAP_C("cf.dat");
+ String *cf_file = SSTR_WRAP_C("cf.dat");
OutStream *outstream = Folder_Open_Out(folder, (String*)cf_file);
bool rename_success;
@@ -143,8 +143,8 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
}
// Write metadata to cfmeta file.
- String *cfmeta_temp = (String*)SSTR_WRAP_C("cfmeta.json.temp");
- String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
+ String *cfmeta_temp = SSTR_WRAP_C("cfmeta.json.temp");
+ String *cfmeta_file = SSTR_WRAP_C("cfmeta.json");
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/333119dd/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index 2ab1f35..6b1295a 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -256,7 +256,7 @@ FSFolder_Local_Find_Folder_IMP(FSFolder *self, String *name) {
}
// Try to open a CompoundFileReader. On failure, just use the
// existing folder.
- String *cfmeta_file = (String*)SSTR_WRAP_C("cfmeta.json");
+ String *cfmeta_file = SSTR_WRAP_C("cfmeta.json");
if (Folder_Local_Exists(subfolder, cfmeta_file)) {
CompoundFileReader *cf_reader = CFReader_open(subfolder);
if (cf_reader) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index 9fe100e..82066a5 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -158,7 +158,7 @@ LFLock_Request_IMP(LockFileLock *self) {
}
// Create the "locks" subdirectory if necessary.
- String *lock_dir_name = (String*)SSTR_WRAP_C("locks");
+ String *lock_dir_name = SSTR_WRAP_C("locks");
if (!Folder_Exists(ivars->folder, lock_dir_name)) {
if (!Folder_MkDir(ivars->folder, lock_dir_name)) {
Err *mkdir_err = (Err*)CERTIFY(Err_get_error(), ERR);
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Store/SharedLock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/SharedLock.c b/core/Lucy/Store/SharedLock.c
index 12c49c7..8d664f1 100644
--- a/core/Lucy/Store/SharedLock.c
+++ b/core/Lucy/Store/SharedLock.c
@@ -99,7 +99,7 @@ void
ShLock_Clear_Stale_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- String *lock_dir_name = (String*)SSTR_WRAP_C("locks");
+ String *lock_dir_name = SSTR_WRAP_C("locks");
if (!Folder_Find_Folder(ivars->folder, lock_dir_name)) {
return;
}
@@ -127,7 +127,7 @@ bool
ShLock_Is_Locked_IMP(SharedLock *self) {
SharedLockIVARS *const ivars = ShLock_IVARS(self);
- String *lock_dir_name = (String*)SSTR_WRAP_C("locks");
+ String *lock_dir_name = SSTR_WRAP_C("locks");
if (!Folder_Find_Folder(ivars->folder, lock_dir_name)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Analysis/TestNormalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestNormalizer.c b/core/Lucy/Test/Analysis/TestNormalizer.c
index 92adbf4..c882546 100644
--- a/core/Lucy/Test/Analysis/TestNormalizer.c
+++ b/core/Lucy/Test/Analysis/TestNormalizer.c
@@ -39,8 +39,8 @@ static void
test_Dump_Load_and_Equals(TestBatchRunner *runner) {
Normalizer *normalizer[4];
- String *NFC = (String*)SSTR_WRAP_C("NFC");
- String *NFKC = (String*)SSTR_WRAP_C("NFKC");
+ String *NFC = SSTR_WRAP_C("NFC");
+ String *NFKC = SSTR_WRAP_C("NFKC");
normalizer[0] = Normalizer_new(NFKC, true, false);
normalizer[1] = Normalizer_new(NFC, true, false);
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestPolyAnalyzer.c b/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
index 31bd76f..efb539c 100644
--- a/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
+++ b/core/Lucy/Test/Analysis/TestPolyAnalyzer.c
@@ -41,8 +41,8 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
return;
}
- String *EN = (String*)SSTR_WRAP_C("en");
- String *ES = (String*)SSTR_WRAP_C("es");
+ String *EN = SSTR_WRAP_C("en");
+ String *ES = SSTR_WRAP_C("es");
PolyAnalyzer *analyzer = PolyAnalyzer_new(EN, NULL);
PolyAnalyzer *other = PolyAnalyzer_new(ES, NULL);
Obj *dump = (Obj*)PolyAnalyzer_Dump(analyzer);
@@ -68,7 +68,7 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_analysis(TestBatchRunner *runner) {
- String *EN = (String*)SSTR_WRAP_C("en");
+ String *EN = SSTR_WRAP_C("en");
String *source_text = Str_newf("Eats, shoots and leaves.");
Normalizer *normalizer = Normalizer_new(NULL, true, false);
StandardTokenizer *tokenizer = StandardTokenizer_new();
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Analysis/TestSnowballStemmer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestSnowballStemmer.c b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
index 64bec15..329864d 100644
--- a/core/Lucy/Test/Analysis/TestSnowballStemmer.c
+++ b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
@@ -34,8 +34,8 @@ TestSnowStemmer_new() {
static void
test_Dump_Load_and_Equals(TestBatchRunner *runner) {
- String *EN = (String*)SSTR_WRAP_C("en");
- String *ES = (String*)SSTR_WRAP_C("es");
+ String *EN = SSTR_WRAP_C("en");
+ String *ES = SSTR_WRAP_C("es");
SnowballStemmer *stemmer = SnowStemmer_new(EN);
SnowballStemmer *other = SnowStemmer_new(ES);
Obj *dump = (Obj*)SnowStemmer_Dump(stemmer);
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Highlight/TestHighlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Highlight/TestHighlighter.c b/core/Lucy/Test/Highlight/TestHighlighter.c
index 3ae0687..21e040e 100644
--- a/core/Lucy/Test/Highlight/TestHighlighter.c
+++ b/core/Lucy/Test/Highlight/TestHighlighter.c
@@ -59,12 +59,12 @@ TestHighlighter_new() {
static void
test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- String *content = (String*)SSTR_WRAP_C("content");
+ String *content = SSTR_WRAP_C("content");
Highlighter *highlighter = Highlighter_new(searcher, query, content, 6);
int32_t top;
String *raw_excerpt;
- String *field_val = (String *)SSTR_WRAP_C("Ook. Urk. Ick. ");
+ String *field_val = SSTR_WRAP_C("Ook. Urk. Ick. ");
Vector *spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(0, 18, 1.0f));
HeatMap *heat_map = HeatMap_new(spans, 133);
@@ -95,7 +95,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(raw_excerpt);
DECREF(heat_map);
- field_val = (String *)SSTR_WRAP_C("Ook urk ick i.");
+ field_val = SSTR_WRAP_C("Ook urk ick i.");
spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(12, 1, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -111,7 +111,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
DECREF(heat_map);
DECREF(raw_excerpt);
- field_val = (String *)SSTR_WRAP_C("Urk. Iz no good.");
+ field_val = SSTR_WRAP_C("Urk. Iz no good.");
spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(6, 2, 1.0f));
heat_map = HeatMap_new(spans, 133);
@@ -129,7 +129,7 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
// Words longer than excerpt len
- field_val = (String *)SSTR_WRAP_C("abc/def/ghi/jkl/mno");
+ field_val = SSTR_WRAP_C("abc/def/ghi/jkl/mno");
spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(0, 3, 1.0f));
@@ -160,13 +160,13 @@ test_Raw_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
static void
test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query) {
- String *content = (String*)SSTR_WRAP_C("content");
+ String *content = SSTR_WRAP_C("content");
Highlighter *highlighter = Highlighter_new(searcher, query, content, 3);
String *highlighted;
Vector *spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(2, 1, 0.0f));
- String *raw_excerpt = (String *)SSTR_WRAP_C("a b c");
+ String *raw_excerpt = SSTR_WRAP_C("a b c");
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
@@ -178,7 +178,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
spans = Vec_new(2);
Vec_Push(spans, (Obj*)Span_new(0, 1, 1.0f));
Vec_Push(spans, (Obj*)Span_new(10, 10, 1.0f));
- raw_excerpt = (String *)SSTR_WRAP_C(PHI);
+ raw_excerpt = SSTR_WRAP_C(PHI);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
@@ -189,7 +189,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
spans = Vec_new(1);
Vec_Push(spans, (Obj*)Span_new(3, 1, 1.0f));
- raw_excerpt = (String *)SSTR_WRAP_C(PHI " " PHI " " PHI);
+ raw_excerpt = SSTR_WRAP_C(PHI " " PHI " " PHI);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 1);
TEST_TRUE(runner,
@@ -204,7 +204,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
Vec_Push(spans, (Obj*)Span_new(2, 4, 1.0f));
Vec_Push(spans, (Obj*)Span_new(8, 9, 1.0f));
Vec_Push(spans, (Obj*)Span_new(8, 4, 1.0f));
- raw_excerpt = (String *)SSTR_WRAP_C(PHI " Oook. Urk. Ick. " PHI);
+ raw_excerpt = SSTR_WRAP_C(PHI " Oook. Urk. Ick. " PHI);
highlighted = Highlighter_Highlight_Excerpt(highlighter, spans,
raw_excerpt, 0);
TEST_TRUE(runner,
@@ -221,7 +221,7 @@ test_Highlight_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query)
static void
test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
Hits *hits) {
- String *content = (String*)SSTR_WRAP_C("content");
+ String *content = SSTR_WRAP_C("content");
Highlighter *highlighter = Highlighter_new(searcher, query, content, 200);
HitDoc *hit = Hits_Next(hits);
@@ -233,9 +233,9 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
"highlighter tagged phrase and single term");
DECREF(excerpt);
- String *pre_tag = (String*)SSTR_WRAP_C("\x1B[1m");
+ String *pre_tag = SSTR_WRAP_C("\x1B[1m");
Highlighter_Set_Pre_Tag(highlighter, pre_tag);
- String *post_tag = (String*)SSTR_WRAP_C("\x1B[0m");
+ String *post_tag = SSTR_WRAP_C("\x1B[0m");
Highlighter_Set_Post_Tag(highlighter, post_tag);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_TRUE(runner,
@@ -307,7 +307,7 @@ test_Create_Excerpt(TestBatchRunner *runner, Searcher *searcher, Obj *query,
"specify field highlights correct field...");
DECREF(excerpt);
DECREF(highlighter);
- String *alt = (String*)SSTR_WRAP_C("alt");
+ String *alt = SSTR_WRAP_C("alt");
highlighter = Highlighter_new(searcher, query, alt, 200);
excerpt = Highlighter_Create_Excerpt(highlighter, hit);
TEST_FALSE(runner,
@@ -329,9 +329,9 @@ test_highlighting(TestBatchRunner *runner) {
FullTextType *dunked_type = FullTextType_new((Analyzer*)tokenizer);
FullTextType_Set_Highlightable(dunked_type, true);
FullTextType_Set_Boost(dunked_type, 0.1f);
- String *content = (String*)SSTR_WRAP_C("content");
+ String *content = SSTR_WRAP_C("content");
Schema_Spec_Field(schema, content, (FieldType*)plain_type);
- String *alt = (String*)SSTR_WRAP_C("alt");
+ String *alt = SSTR_WRAP_C("alt");
Schema_Spec_Field(schema, alt, (FieldType*)dunked_type);
DECREF(plain_type);
DECREF(dunked_type);
@@ -341,22 +341,21 @@ test_highlighting(TestBatchRunner *runner) {
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
Doc *doc = Doc_new(NULL, 0);
- String *string = (String *)SSTR_WRAP_C(TEST_STRING);
+ String *string = SSTR_WRAP_C(TEST_STRING);
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
doc = Doc_new(NULL, 0);
- string = (String *)SSTR_WRAP_C("\"I see,\" said the blind man.");
+ string = SSTR_WRAP_C("\"I see,\" said the blind man.");
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
doc = Doc_new(NULL, 0);
- string = (String *)SSTR_WRAP_C("x but not why or 2ee");
+ string = SSTR_WRAP_C("x but not why or 2ee");
Doc_Store(doc, content, (Obj*)string);
- string = (String *)SSTR_WRAP_C(TEST_STRING
- " and extra stuff so it scores lower");
+ string = SSTR_WRAP_C(TEST_STRING " and extra stuff so it scores lower");
Doc_Store(doc, alt, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
@@ -384,7 +383,7 @@ test_hl_selection(TestBatchRunner *runner) {
StandardTokenizer *tokenizer = StandardTokenizer_new();
FullTextType *plain_type = FullTextType_new((Analyzer*)tokenizer);
FullTextType_Set_Highlightable(plain_type, true);
- String *content = (String*)SSTR_WRAP_C("content");
+ String *content = SSTR_WRAP_C("content");
Schema_Spec_Field(schema, content, (FieldType*)plain_type);
DECREF(plain_type);
DECREF(tokenizer);
@@ -407,7 +406,7 @@ test_hl_selection(TestBatchRunner *runner) {
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. "
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. ";
Doc *doc = Doc_new(NULL, 0);
- String *string = (String *)SSTR_WRAP_C(test_string);
+ String *string = SSTR_WRAP_C(test_string);
Doc_Store(doc, content, (Obj*)string);
Indexer_Add_Doc(indexer, doc, 1.0f);
DECREF(doc);
@@ -421,8 +420,8 @@ test_hl_selection(TestBatchRunner *runner) {
Hits *hits = Searcher_Hits(searcher, query, 0, 10, NULL);
HitDoc *hit = Hits_Next(hits);
String *excerpt = Highlighter_Create_Excerpt(highlighter, hit);
- String *mmm = (String*)SSTR_WRAP_C("MMM");
- String *nnn = (String*)SSTR_WRAP_C("NNN");
+ String *mmm = SSTR_WRAP_C("MMM");
+ String *nnn = SSTR_WRAP_C("NNN");
TEST_TRUE(runner, Str_Contains(excerpt, mmm) || Str_Contains(excerpt, nnn),
"Sentence boundary algo doesn't chop terms");
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Index/TestSnapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestSnapshot.c b/core/Lucy/Test/Index/TestSnapshot.c
index e790206..bb86992 100644
--- a/core/Lucy/Test/Index/TestSnapshot.c
+++ b/core/Lucy/Test/Index/TestSnapshot.c
@@ -31,8 +31,8 @@ TestSnapshot_new() {
static void
test_Add_and_Delete(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
- String *foo = (String*)SSTR_WRAP_C("foo");
- String *bar = (String*)SSTR_WRAP_C("bar");
+ String *foo = SSTR_WRAP_C("foo");
+ String *bar = SSTR_WRAP_C("bar");
Snapshot_Add_Entry(snapshot, foo);
Snapshot_Add_Entry(snapshot, foo); // redundant
@@ -55,8 +55,8 @@ static void
test_path_handling(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- String *snap = (String*)SSTR_WRAP_C("snap");
- String *crackle = (String*)SSTR_WRAP_C("crackle");
+ String *snap = SSTR_WRAP_C("snap");
+ String *crackle = SSTR_WRAP_C("crackle");
Snapshot_Write_File(snapshot, folder, snap);
TEST_TRUE(runner, Str_Equals(snap, (Obj*)Snapshot_Get_Path(snapshot)),
@@ -79,8 +79,8 @@ static void
test_Read_File_and_Write_File(TestBatchRunner *runner) {
Snapshot *snapshot = Snapshot_new();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- String *snap = (String*)SSTR_WRAP_C("snap");
- String *foo = (String*)SSTR_WRAP_C("foo");
+ String *snap = SSTR_WRAP_C("snap");
+ String *foo = SSTR_WRAP_C("foo");
Snapshot_Add_Entry(snapshot, foo);
Snapshot_Write_File(snapshot, folder, snap);
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Search/TestQueryParserLogic.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestQueryParserLogic.c b/core/Lucy/Test/Search/TestQueryParserLogic.c
index d8a647b..874569c 100644
--- a/core/Lucy/Test/Search/TestQueryParserLogic.c
+++ b/core/Lucy/Test/Search/TestQueryParserLogic.c
@@ -864,7 +864,7 @@ S_create_index() {
Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0);
uint32_t i, max;
- String *field = (String*)SSTR_WRAP_C("content");
+ String *field = SSTR_WRAP_C("content");
for (i = 0, max = Vec_Get_Size(doc_set); i < max; i++) {
Doc *doc = Doc_new(NULL, 0);
Doc_Store(doc, field, Vec_Fetch(doc_set, i));
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Store/TestFSDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSDirHandle.c b/core/Lucy/Test/Store/TestFSDirHandle.c
index ae478e6..4be2b84 100644
--- a/core/Lucy/Test/Store/TestFSDirHandle.c
+++ b/core/Lucy/Test/Store/TestFSDirHandle.c
@@ -43,10 +43,10 @@ TestFSDH_new() {
static void
test_all(TestBatchRunner *runner) {
- String *foo = (String*)SSTR_WRAP_C("foo");
- String *boffo = (String*)SSTR_WRAP_C("boffo");
- String *foo_boffo = (String*)SSTR_WRAP_C("foo/boffo");
- String *test_dir = (String*)SSTR_WRAP_C("_fsdir_test");
+ String *foo = SSTR_WRAP_C("foo");
+ String *boffo = SSTR_WRAP_C("boffo");
+ String *foo_boffo = SSTR_WRAP_C("foo/boffo");
+ String *test_dir = SSTR_WRAP_C("_fsdir_test");
FSFolder *folder = FSFolder_new(test_dir);
bool saw_foo = false;
bool saw_boffo = false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Store/TestFSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFileHandle.c b/core/Lucy/Test/Store/TestFSFileHandle.c
index d156dc4..2e75f37 100644
--- a/core/Lucy/Test/Store/TestFSFileHandle.c
+++ b/core/Lucy/Test/Store/TestFSFileHandle.c
@@ -42,7 +42,7 @@ static void
test_open(TestBatchRunner *runner) {
FSFileHandle *fh;
- String *test_filename = (String*)SSTR_WRAP_C("_fstest");
+ String *test_filename = SSTR_WRAP_C("_fstest");
remove(Str_Get_Ptr8(test_filename));
@@ -108,7 +108,7 @@ test_Read_Write(TestBatchRunner *runner) {
const char *bar = "bar";
char buffer[12];
char *buf = buffer;
- String *test_filename = (String*)SSTR_WRAP_C("_fstest");
+ String *test_filename = SSTR_WRAP_C("_fstest");
remove(Str_Get_Ptr8(test_filename));
fh = FSFH_open(test_filename,
@@ -162,7 +162,7 @@ test_Read_Write(TestBatchRunner *runner) {
static void
test_Close(TestBatchRunner *runner) {
- String *test_filename = (String*)SSTR_WRAP_C("_fstest");
+ String *test_filename = SSTR_WRAP_C("_fstest");
FSFileHandle *fh;
remove(Str_Get_Ptr8(test_filename));
@@ -199,7 +199,7 @@ test_Close(TestBatchRunner *runner) {
static void
test_Window(TestBatchRunner *runner) {
- String *test_filename = (String*)SSTR_WRAP_C("_fstest");
+ String *test_filename = SSTR_WRAP_C("_fstest");
FSFileHandle *fh;
FileWindow *window = FileWindow_new();
FileWindowIVARS *const window_ivars = FileWindow_IVARS(window);
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Store/TestFSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFolder.c b/core/Lucy/Test/Store/TestFSFolder.c
index f4b1c5f..22e3a2e 100644
--- a/core/Lucy/Test/Store/TestFSFolder.c
+++ b/core/Lucy/Test/Store/TestFSFolder.c
@@ -63,8 +63,8 @@ TestFSFolder_new() {
static Folder*
S_set_up() {
rmdir("_fstest");
- String *test_dir = (String*)SSTR_WRAP_C("_fstest");
- FSFolder *folder = FSFolder_new(test_dir);
+ String *test_dir = SSTR_WRAP_C("_fstest");
+ FSFolder *folder = FSFolder_new(test_dir);
FSFolder_Initialize(folder);
if (!FSFolder_Check(folder)) {
RETHROW(INCREF(Err_get_error()));
@@ -89,7 +89,7 @@ S_tear_down() {
static void
test_Initialize_and_Check(TestBatchRunner *runner) {
rmdir("_fstest");
- String *test_dir = (String*)SSTR_WRAP_C("_fstest");
+ String *test_dir = SSTR_WRAP_C("_fstest");
FSFolder *folder = FSFolder_new(test_dir);
TEST_FALSE(runner, FSFolder_Check(folder),
"Check() returns false when folder dir doesn't exist");
@@ -105,9 +105,9 @@ static void
test_protect_symlinks(TestBatchRunner *runner) {
#ifdef ENABLE_SYMLINK_TESTS
FSFolder *folder = (FSFolder*)S_set_up();
- String *foo = (String*)SSTR_WRAP_C("foo");
- String *bar = (String*)SSTR_WRAP_C("bar");
- String *foo_boffo = (String*)SSTR_WRAP_C("foo/boffo");
+ String *foo = SSTR_WRAP_C("foo");
+ String *bar = SSTR_WRAP_C("bar");
+ String *foo_boffo = SSTR_WRAP_C("foo/boffo");
FSFolder_MkDir(folder, foo);
FSFolder_MkDir(folder, bar);
@@ -158,14 +158,14 @@ void
test_disallow_updir(TestBatchRunner *runner) {
FSFolder *outer_folder = (FSFolder*)S_set_up();
- String *foo = (String*)SSTR_WRAP_C("foo");
- String *bar = (String*)SSTR_WRAP_C("bar");
+ String *foo = SSTR_WRAP_C("foo");
+ String *bar = SSTR_WRAP_C("bar");
FSFolder_MkDir(outer_folder, foo);
FSFolder_MkDir(outer_folder, bar);
- String *inner_path = (String*)SSTR_WRAP_C("_fstest/foo");
+ String *inner_path = SSTR_WRAP_C("_fstest/foo");
FSFolder *foo_folder = FSFolder_new(inner_path);
- String *up_bar = (String*)SSTR_WRAP_C("../bar");
+ String *up_bar = SSTR_WRAP_C("../bar");
TEST_FALSE(runner, FSFolder_Exists(foo_folder, up_bar),
"up-dirs are inaccessible.");
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Store/TestRAMDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestRAMDirHandle.c b/core/Lucy/Test/Store/TestRAMDirHandle.c
index 15ebae7..fc6292a 100644
--- a/core/Lucy/Test/Store/TestRAMDirHandle.c
+++ b/core/Lucy/Test/Store/TestRAMDirHandle.c
@@ -33,9 +33,9 @@ TestRAMDH_new() {
static void
test_all(TestBatchRunner *runner) {
RAMFolder *folder = RAMFolder_new(NULL);
- String *foo = (String*)SSTR_WRAP_C("foo");
- String *boffo = (String*)SSTR_WRAP_C("boffo");
- String *foo_boffo = (String*)SSTR_WRAP_C("foo/boffo");
+ String *foo = SSTR_WRAP_C("foo");
+ String *boffo = SSTR_WRAP_C("boffo");
+ String *foo_boffo = SSTR_WRAP_C("foo/boffo");
bool saw_foo = false;
bool saw_boffo = false;
bool foo_was_dir = false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/TestSchema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestSchema.c b/core/Lucy/Test/TestSchema.c
index ae24751..1e1c3c1 100644
--- a/core/Lucy/Test/TestSchema.c
+++ b/core/Lucy/Test/TestSchema.c
@@ -42,7 +42,7 @@ TestSchema_init(TestSchema *self, bool use_alt_arch) {
Schema_init((Schema*)self);
FullTextType_Set_Highlightable(type, true);
- String *content = (String*)SSTR_WRAP_C("content");
+ String *content = SSTR_WRAP_C("content");
TestSchema_Spec_Field(self, content, (FieldType*)type);
DECREF(type);
DECREF(tokenizer);
@@ -70,7 +70,7 @@ test_Equals(TestBatchRunner *runner) {
TestSchema *schema = TestSchema_new(false);
TestSchema *arch_differs = TestSchema_new(true);
TestSchema *spec_differs = TestSchema_new(false);
- String *content = (String*)SSTR_WRAP_C("content");
+ String *content = SSTR_WRAP_C("content");
FullTextType *type = (FullTextType*)TestSchema_Fetch_Type(spec_differs,
content);
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c
index 6659d19..bddfa7b 100644
--- a/core/Lucy/Test/TestUtils.c
+++ b/core/Lucy/Test/TestUtils.c
@@ -76,14 +76,14 @@ TestUtils_make_poly_query(uint32_t boolop, ...) {
TermQuery*
TestUtils_make_term_query(const char *field, const char *term) {
- String *field_str = (String*)SSTR_WRAP_C(field);
- String *term_str = (String*)SSTR_WRAP_C(term);
+ String *field_str = SSTR_WRAP_C(field);
+ String *term_str = SSTR_WRAP_C(term);
return TermQuery_new((String*)field_str, (Obj*)term_str);
}
PhraseQuery*
TestUtils_make_phrase_query(const char *field, ...) {
- String *field_str = (String*)SSTR_WRAP_C(field);
+ String *field_str = SSTR_WRAP_C(field);
va_list args;
Vector *terms = Vec_new(0);
PhraseQuery *query;
@@ -102,10 +102,8 @@ TestUtils_make_phrase_query(const char *field, ...) {
LeafQuery*
TestUtils_make_leaf_query(const char *field, const char *term) {
- String *term_str = (String*)SSTR_WRAP_C(term);
- String *field_str = field
- ? (String*)SSTR_WRAP_C(field)
- : NULL;
+ String *term_str = SSTR_WRAP_C(term);
+ String *field_str = field ? SSTR_WRAP_C(field) : NULL;
return LeafQuery_new(field_str, term_str);
}
@@ -120,9 +118,9 @@ RangeQuery*
TestUtils_make_range_query(const char *field, const char *lower_term,
const char *upper_term, bool include_lower,
bool include_upper) {
- String *f = (String*)SSTR_WRAP_C(field);
- String *lterm = (String*)SSTR_WRAP_C(lower_term);
- String *uterm = (String*)SSTR_WRAP_C(upper_term);
+ String *f = SSTR_WRAP_C(field);
+ String *lterm = SSTR_WRAP_C(lower_term);
+ String *uterm = SSTR_WRAP_C(upper_term);
return RangeQuery_new(f, (Obj*)lterm, (Obj*)uterm, include_lower,
include_upper);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/333119dd/core/Lucy/Test/Util/TestJson.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestJson.c b/core/Lucy/Test/Util/TestJson.c
index 5310cee..c67e292 100644
--- a/core/Lucy/Test/Util/TestJson.c
+++ b/core/Lucy/Test/Util/TestJson.c
@@ -202,7 +202,7 @@ test_spew_and_slurp(TestBatchRunner *runner) {
Obj *dump = S_make_dump();
Folder *folder = (Folder*)RAMFolder_new(NULL);
- String *foo = (String*)SSTR_WRAP_C("foo");
+ String *foo = SSTR_WRAP_C("foo");
bool result = Json_spew_json(dump, folder, foo);
TEST_TRUE(runner, result, "spew_json returns true on success");
TEST_TRUE(runner, Folder_Exists(folder, foo),
@@ -220,14 +220,14 @@ test_spew_and_slurp(TestBatchRunner *runner) {
"Failed spew_json sets global error");
Err_set_error(NULL);
- String *bar = (String*)SSTR_WRAP_C("bar");
+ String *bar = SSTR_WRAP_C("bar");
got = Json_slurp_json(folder, bar);
TEST_TRUE(runner, got == NULL,
"slurp_json returns NULL when file doesn't exist");
TEST_TRUE(runner, Err_get_error() != NULL,
"Failed slurp_json sets global error");
- String *boffo = (String*)SSTR_WRAP_C("boffo");
+ String *boffo = SSTR_WRAP_C("boffo");
FileHandle *fh
= Folder_Open_FileHandle(folder, boffo, FH_CREATE | FH_WRITE_ONLY);
[2/8] lucy git commit: Adjust for Str_less_than removal
Posted by nw...@apache.org.
Adjust for Str_less_than removal
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/8be7674e
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/8be7674e
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/8be7674e
Branch: refs/heads/master
Commit: 8be7674e63250865c70e72c7db0141d710eead34
Parents: 61d4529
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Oct 22 16:39:44 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Oct 22 16:47:06 2015 +0200
----------------------------------------------------------------------
core/Lucy/Index/PolyLexicon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/8be7674e/core/Lucy/Index/PolyLexicon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PolyLexicon.c b/core/Lucy/Index/PolyLexicon.c
index 42ebb0c..f0fb288 100644
--- a/core/Lucy/Index/PolyLexicon.c
+++ b/core/Lucy/Index/PolyLexicon.c
@@ -208,7 +208,7 @@ SegLexQ_Less_Than_IMP(SegLexQueue *self, Obj *a, Obj *b) {
Obj *const term_a = SegLex_Get_Term(lex_a);
Obj *const term_b = SegLex_Get_Term(lex_b);
UNUSED_VAR(self);
- return Str_less_than(&term_a, &term_b);
+ return Obj_Compare_To(term_a, term_b) < 0;
}