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:06 UTC
[7/8] lucy git commit: Switch over to STR_OOB
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