Remove StrIter assertions With immutable strings, the StrIter byte offset should always be within bounds.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/43312f9d Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/43312f9d Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/43312f9d Branch: refs/heads/master Commit: 43312f9de56eef53d5d67a26203e5d06f8e9e824 Parents: 16a4270 Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Sat Oct 24 18:16:47 2015 +0200 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Wed Oct 28 16:10:35 2015 +0100 ---------------------------------------------------------------------- runtime/core/Clownfish/String.c | 14 -------------- 1 file changed, 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/43312f9d/runtime/core/Clownfish/String.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/String.c b/runtime/core/Clownfish/String.c index db27001..1e28f08 100644 --- a/runtime/core/Clownfish/String.c +++ b/runtime/core/Clownfish/String.c @@ -555,10 +555,6 @@ StrIter_substring(StringIterator *top, StringIterator *tail) { } tail_offset = tail->byte_offset; - if (tail_offset > string->size) { - THROW(ERR, "Invalid StringIterator offset"); - UNREACHABLE_RETURN(String*); - } } if (top == NULL) { @@ -811,11 +807,6 @@ StrIter_Starts_With_Utf8_IMP(StringIterator *self, const char *prefix, String *string = self->string; size_t byte_offset = self->byte_offset; - if (byte_offset > string->size) { - THROW(ERR, "Invalid StringIterator offset"); - UNREACHABLE_RETURN(bool); - } - if (string->size - byte_offset < size) { return false; } return memcmp(string->ptr + byte_offset, prefix, size) == 0; @@ -832,11 +823,6 @@ StrIter_Ends_With_Utf8_IMP(StringIterator *self, const char *suffix, String *string = self->string; size_t byte_offset = self->byte_offset; - if (byte_offset > string->size) { - THROW(ERR, "Invalid StringIterator offset"); - UNREACHABLE_RETURN(bool); - } - if (byte_offset < size) { return false; } return memcmp(string->ptr + byte_offset - size, suffix, size) == 0;