Rename Ends_With argument from postfix to suffix
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/86a6c985 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/86a6c985 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/86a6c985 Branch: refs/heads/master Commit: 86a6c98560e45e37201ef14aac74c114c628378f Parents: 8b5f8db Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Thu Oct 22 15:57:56 2015 +0200 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Wed Oct 28 15:35:18 2015 +0100 ---------------------------------------------------------------------- runtime/core/Clownfish/String.c | 20 ++++++++++---------- runtime/core/Clownfish/String.cfh | 16 ++++++++-------- runtime/core/Clownfish/Test/TestString.c | 18 +++++++++--------- 3 files changed, 27 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/86a6c985/runtime/core/Clownfish/String.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/String.c b/runtime/core/Clownfish/String.c index 3afbdc1..f4732bd 100644 --- a/runtime/core/Clownfish/String.c +++ b/runtime/core/Clownfish/String.c @@ -372,15 +372,15 @@ Str_Equals_Utf8_IMP(String *self, const char *ptr, size_t size) { } bool -Str_Ends_With_IMP(String *self, String *postfix) { - return Str_Ends_With_Utf8_IMP(self, postfix->ptr, postfix->size); +Str_Ends_With_IMP(String *self, String *suffix) { + return Str_Ends_With_Utf8_IMP(self, suffix->ptr, suffix->size); } bool -Str_Ends_With_Utf8_IMP(String *self, const char *postfix, size_t postfix_len) { - if (postfix_len <= self->size) { - const char *start = self->ptr + self->size - postfix_len; - if (memcmp(start, postfix, postfix_len) == 0) { +Str_Ends_With_Utf8_IMP(String *self, const char *suffix, size_t suffix_len) { + if (suffix_len <= self->size) { + const char *start = self->ptr + self->size - suffix_len; + if (memcmp(start, suffix, suffix_len) == 0) { return true; } } @@ -803,12 +803,12 @@ StrIter_Starts_With_Utf8_IMP(StringIterator *self, const char *prefix, } bool -StrIter_Ends_With_IMP(StringIterator *self, String *postfix) { - return StrIter_Ends_With_Utf8_IMP(self, postfix->ptr, postfix->size); +StrIter_Ends_With_IMP(StringIterator *self, String *suffix) { + return StrIter_Ends_With_Utf8_IMP(self, suffix->ptr, suffix->size); } bool -StrIter_Ends_With_Utf8_IMP(StringIterator *self, const char *postfix, +StrIter_Ends_With_Utf8_IMP(StringIterator *self, const char *suffix, size_t size) { String *string = self->string; size_t byte_offset = self->byte_offset; @@ -820,7 +820,7 @@ StrIter_Ends_With_Utf8_IMP(StringIterator *self, const char *postfix, if (byte_offset < size) { return false; } - return memcmp(string->ptr + byte_offset - size, postfix, size) == 0; + return memcmp(string->ptr + byte_offset - size, suffix, size) == 0; } void http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/86a6c985/runtime/core/Clownfish/String.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/String.cfh b/runtime/core/Clownfish/String.cfh index cc29b2e..7a20375 100644 --- a/runtime/core/Clownfish/String.cfh +++ b/runtime/core/Clownfish/String.cfh @@ -148,15 +148,15 @@ public final class Clownfish::String nickname Str bool Starts_With_Utf8(String *self, const char *prefix, size_t size); - /** Test whether the String ends with `postfix`. + /** Test whether the String ends with `suffix`. */ bool - Ends_With(String *self, String *postfix); + Ends_With(String *self, String *suffix); - /** Test whether the String ends with `postfix`. + /** Test whether the String ends with `suffix`. */ bool - Ends_With_Utf8(String *self, const char *postfix, size_t size); + Ends_With_Utf8(String *self, const char *suffix, size_t size); /** Return the location of the substring within the String (measured in * code points), or -1 if the substring does not match. @@ -351,15 +351,15 @@ public final class Clownfish::StringIterator nickname StrIter Starts_With_Utf8(StringIterator *self, const char *prefix, size_t size); /** Test whether the content before the iterator ends with - * `postfix`. + * `suffix`. */ bool - Ends_With(StringIterator *self, String *postfix); + Ends_With(StringIterator *self, String *suffix); - /** Test whether the content before the iterator ends with `postfix`. + /** Test whether the content before the iterator ends with `suffix`. */ bool - Ends_With_Utf8(StringIterator *self, const char *postfix, size_t size); + Ends_With_Utf8(StringIterator *self, const char *suffix, size_t size); public void Destroy(StringIterator *self); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/86a6c985/runtime/core/Clownfish/Test/TestString.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Test/TestString.c b/runtime/core/Clownfish/Test/TestString.c index 275166b..629763d 100644 --- a/runtime/core/Clownfish/Test/TestString.c +++ b/runtime/core/Clownfish/Test/TestString.c @@ -387,20 +387,20 @@ test_Compare_To(TestBatchRunner *runner) { static void test_Starts_Ends_With(TestBatchRunner *runner) { - String *prefix = S_get_str("pre" SMILEY "fix_"); - String *postfix = S_get_str("_post" SMILEY "fix"); - String *empty = S_get_str(""); + String *prefix = S_get_str("pre" SMILEY "fix_"); + String *suffix = S_get_str("_post" SMILEY "fix"); + String *empty = S_get_str(""); - TEST_TRUE(runner, Str_Starts_With(postfix, postfix), + TEST_TRUE(runner, Str_Starts_With(suffix, suffix), "Starts_With self returns true"); TEST_TRUE(runner, Str_Starts_With(prefix, prefix), "Ends_With self returns true"); - TEST_TRUE(runner, Str_Starts_With(postfix, empty), + TEST_TRUE(runner, Str_Starts_With(suffix, empty), "Starts_With empty string returns true"); TEST_TRUE(runner, Str_Ends_With(prefix, empty), "Ends_With empty string returns true"); - TEST_FALSE(runner, Str_Starts_With(empty, postfix), + TEST_FALSE(runner, Str_Starts_With(empty, suffix), "Empty string Starts_With returns false"); TEST_FALSE(runner, Str_Ends_With(empty, prefix), "Empty string Ends_With returns false"); @@ -410,7 +410,7 @@ test_Starts_Ends_With(TestBatchRunner *runner) { = S_get_str("pre" SMILEY "fix_string_post" SMILEY "fix"); TEST_TRUE(runner, Str_Starts_With(string, prefix), "Starts_With returns true"); - TEST_TRUE(runner, Str_Ends_With(string, postfix), + TEST_TRUE(runner, Str_Ends_With(string, suffix), "Ends_With returns true"); DECREF(string); } @@ -420,13 +420,13 @@ test_Starts_Ends_With(TestBatchRunner *runner) { = S_get_str("pre" SMILEY "fix:string:post" SMILEY "fix"); TEST_FALSE(runner, Str_Starts_With(string, prefix), "Starts_With returns false"); - TEST_FALSE(runner, Str_Ends_With(string, postfix), + TEST_FALSE(runner, Str_Ends_With(string, suffix), "Ends_With returns false"); DECREF(string); } DECREF(prefix); - DECREF(postfix); + DECREF(suffix); DECREF(empty); }