Move some functions from StrHelp to Str
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f257a45e Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f257a45e Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f257a45e Branch: refs/heads/master Commit: f257a45e0c73cc5875b8f6e3a66ba4eff2e84ae5 Parents: 3cc0397 Author: Nick Wellnhofer <[email protected]> Authored: Tue Aug 2 18:54:24 2016 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Tue Aug 2 18:54:24 2016 +0200 ---------------------------------------------------------------------- core/Lucy/Highlight/Highlighter.c | 10 +++++----- core/Lucy/Plan/TextType.c | 4 ++-- core/Lucy/Search/QueryParser/QueryLexer.c | 4 ++-- core/Lucy/Util/Freezer.c | 2 +- core/Lucy/Util/Json.c | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/f257a45e/core/Lucy/Highlight/Highlighter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c index 6db17dd..62e2828 100644 --- a/core/Lucy/Highlight/Highlighter.c +++ b/core/Lucy/Highlight/Highlighter.c @@ -235,7 +235,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip, return true; } - if (StrHelp_is_whitespace(code_point)) { + if (Str_is_whitespace(code_point)) { if (word == NULL) { word = StrIter_Clone(top); } } else { @@ -260,7 +260,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip, break; } - if (word == NULL && StrHelp_is_whitespace(code_point)) { + if (word == NULL && Str_is_whitespace(code_point)) { word = StrIter_Clone(iter); word_offset = i + 1; } @@ -304,7 +304,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip, DECREF(iter); return true; } - } while (StrHelp_is_whitespace(code_point)); + } while (Str_is_whitespace(code_point)); // Keep track of the first word boundary. StringIterator *word = NULL; @@ -325,7 +325,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip, return true; } - if (StrHelp_is_whitespace(code_point)) { + if (Str_is_whitespace(code_point)) { if (word == NULL) { word = StrIter_Clone(iter); word_offset = i + 1; @@ -348,7 +348,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip, // Strip whitespace and punctuation that collides with an ellipsis. while (STR_OOB != (code_point = StrIter_Prev(tail))) { - if (!StrHelp_is_whitespace(code_point) + if (!Str_is_whitespace(code_point) && code_point != '.' && code_point != ',' && code_point != ';' http://git-wip-us.apache.org/repos/asf/lucy/blob/f257a45e/core/Lucy/Plan/TextType.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Plan/TextType.c b/core/Lucy/Plan/TextType.c index 5a3e323..a0e2759 100644 --- a/core/Lucy/Plan/TextType.c +++ b/core/Lucy/Plan/TextType.c @@ -160,7 +160,7 @@ TextTermStepper_Read_Key_Frame_IMP(TextTermStepper *self, // Set the value text. InStream_Read_Bytes(instream, ptr, text_len); BB_Set_Size(ivars->bytebuf, text_len); - if (!StrHelp_utf8_valid(ptr, text_len)) { + if (!Str_utf8_valid(ptr, text_len)) { THROW(ERR, "Invalid UTF-8 sequence in '%o' at byte %i64", InStream_Get_Filename(instream), InStream_Tell(instream) - text_len); @@ -193,7 +193,7 @@ TextTermStepper_Read_Delta_IMP(TextTermStepper *self, InStream *instream) { // Set the value text. InStream_Read_Bytes(instream, ptr + text_overlap, finish_chars_len); BB_Set_Size(ivars->bytebuf, total_text_len); - if (!StrHelp_utf8_valid(ptr, total_text_len)) { + if (!Str_utf8_valid(ptr, total_text_len)) { THROW(ERR, "Invalid UTF-8 sequence in '%o' at byte %i64", InStream_Get_Filename(instream), InStream_Tell(instream) - finish_chars_len); http://git-wip-us.apache.org/repos/asf/lucy/blob/f257a45e/core/Lucy/Search/QueryParser/QueryLexer.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/QueryParser/QueryLexer.c b/core/Lucy/Search/QueryParser/QueryLexer.c index 87200b8..48a57d9 100644 --- a/core/Lucy/Search/QueryParser/QueryLexer.c +++ b/core/Lucy/Search/QueryParser/QueryLexer.c @@ -173,7 +173,7 @@ S_consume_keyword(StringIterator *iter, const char *keyword, DECREF(temp); return NULL; } - if (StrHelp_is_whitespace(lookahead) + if (Str_is_whitespace(lookahead) || lookahead == '"' || lookahead == '(' || lookahead == ')' @@ -257,7 +257,7 @@ S_consume_text(StringIterator *iter) { else if (code_point == STR_OOB) { break; } - else if (StrHelp_is_whitespace(code_point) + else if (Str_is_whitespace(code_point) || code_point == '"' || code_point == '(' || code_point == ')' http://git-wip-us.apache.org/repos/asf/lucy/blob/f257a45e/core/Lucy/Util/Freezer.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c index 26039d2..f8034f2 100644 --- a/core/Lucy/Util/Freezer.c +++ b/core/Lucy/Util/Freezer.c @@ -196,7 +196,7 @@ Freezer_deserialize_string(String *string, InStream *instream) { char *buf = (char*)MALLOCATE(size + 1); InStream_Read_Bytes(instream, buf, size); buf[size] = '\0'; - if (!StrHelp_utf8_valid(buf, size)) { + if (!Str_utf8_valid(buf, size)) { THROW(ERR, "Attempt to deserialize invalid UTF-8"); } return Str_init_steal_trusted_utf8(string, buf, size); http://git-wip-us.apache.org/repos/asf/lucy/blob/f257a45e/core/Lucy/Util/Json.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c index f3e7a219..a601f98 100644 --- a/core/Lucy/Util/Json.c +++ b/core/Lucy/Util/Json.c @@ -567,7 +567,7 @@ S_parse_string(const char **json_ptr, const char *limit) { else { // Optimize common case where there are no escapes. size_t len = (size_t)(end - top); - if (!StrHelp_utf8_valid(top, len)) { + if (!Str_utf8_valid(top, len)) { String *mess = MAKE_MESS("Bad UTF-8 in JSON"); Err_set_error(Err_new(mess)); return NULL; @@ -588,7 +588,7 @@ S_unescape_text(const char *top, const char *end) { text++; } else { - if (!StrHelp_utf8_valid(chunk, (size_t)(text - chunk))) { + if (!Str_utf8_valid(chunk, (size_t)(text - chunk))) { DECREF(cb); String *mess = MAKE_MESS("Bad UTF-8 in JSON"); Err_set_error(Err_new(mess)); @@ -661,7 +661,7 @@ S_unescape_text(const char *top, const char *end) { } } - if (!StrHelp_utf8_valid(chunk, (size_t)(text - chunk))) { + if (!Str_utf8_valid(chunk, (size_t)(text - chunk))) { DECREF(cb); String *mess = MAKE_MESS("Bad UTF-8 in JSON"); Err_set_error(Err_new(mess));
