Rename StrIter_substring to StrIter_crop

Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/79577880
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/79577880
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/79577880

Branch: refs/heads/master
Commit: 795778809346ae2cb0743fd543c5f1338d1b308e
Parents: 43312f9
Author: Nick Wellnhofer <[email protected]>
Authored: Wed Oct 28 15:38:33 2015 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Wed Oct 28 16:10:35 2015 +0100

----------------------------------------------------------------------
 runtime/core/Clownfish/String.c          | 14 +++++++-------
 runtime/core/Clownfish/String.cfh        |  6 +++---
 runtime/core/Clownfish/Test/TestString.c | 16 ++++++++--------
 3 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/79577880/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/String.c b/runtime/core/Clownfish/String.c
index 1e28f08..4daaa83 100644
--- a/runtime/core/Clownfish/String.c
+++ b/runtime/core/Clownfish/String.c
@@ -441,21 +441,21 @@ Str_Trim_IMP(String *self) {
         StrIter_Skip_Whitespace_Back(tail);
     }
 
-    return StrIter_substring((StringIterator*)top, (StringIterator*)tail);
+    return StrIter_crop((StringIterator*)top, (StringIterator*)tail);
 }
 
 String*
 Str_Trim_Top_IMP(String *self) {
     StringIterator *top = STACK_ITER(self, 0);
     StrIter_Skip_Whitespace(top);
-    return StrIter_substring((StringIterator*)top, NULL);
+    return StrIter_crop((StringIterator*)top, NULL);
 }
 
 String*
 Str_Trim_Tail_IMP(String *self) {
     StringIterator *tail = STACK_ITER(self, self->size);
     StrIter_Skip_Whitespace_Back(tail);
-    return StrIter_substring(NULL, (StringIterator*)tail);
+    return StrIter_crop(NULL, (StringIterator*)tail);
 }
 
 size_t
@@ -534,14 +534,14 @@ S_new_stack_iter(void *allocation, String *string, size_t 
byte_offset) {
 }
 
 String*
-StrIter_substring(StringIterator *top, StringIterator *tail) {
+StrIter_crop(StringIterator *top, StringIterator *tail) {
     String *string;
     size_t  top_offset;
     size_t  tail_offset;
 
     if (tail == NULL) {
         if (top == NULL) {
-            THROW(ERR, "StrIter_substring: Both top and tail are NULL");
+            THROW(ERR, "StrIter_crop: Both top and tail are NULL");
             UNREACHABLE_RETURN(String*);
         }
         string      = top->string;
@@ -550,7 +550,7 @@ StrIter_substring(StringIterator *top, StringIterator 
*tail) {
     else {
         string = tail->string;
         if (top != NULL && string != top->string) {
-            THROW(ERR, "StrIter_substring: strings don't match");
+            THROW(ERR, "StrIter_crop: strings don't match");
             UNREACHABLE_RETURN(String*);
         }
 
@@ -563,7 +563,7 @@ StrIter_substring(StringIterator *top, StringIterator 
*tail) {
     else {
         top_offset = top->byte_offset;
         if (top_offset > tail_offset) {
-            THROW(ERR, "StrIter_substring: top is behind tail");
+            THROW(ERR, "StrIter_crop: top is behind tail");
             UNREACHABLE_RETURN(String*);
         }
     }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/79577880/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/String.cfh 
b/runtime/core/Clownfish/String.cfh
index 014b6a1..284e6ec 100644
--- a/runtime/core/Clownfish/String.cfh
+++ b/runtime/core/Clownfish/String.cfh
@@ -290,11 +290,11 @@ public final class Clownfish::StringIterator nickname 
StrIter
     new(String *string, size_t byte_offset);
 
     /** Return the substring between the top and tail iterators.
-     * @param top Top iterator. Use start of string if NULL.
-     * @param tail Tail iterator. Use end of string if NULL.
+     * @param top Top iterator. Use start of string if [](@null).
+     * @param tail Tail iterator. Use end of string if [](@null).
      */
     public inert incremented String*
-    substring(StringIterator *top, StringIterator *tail);
+    crop(StringIterator *top, StringIterator *tail);
 
     public incremented StringIterator*
     Clone(StringIterator *self);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/79577880/runtime/core/Clownfish/Test/TestString.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestString.c 
b/runtime/core/Clownfish/Test/TestString.c
index 6fd5212..c32dbd1 100644
--- a/runtime/core/Clownfish/Test/TestString.c
+++ b/runtime/core/Clownfish/Test/TestString.c
@@ -627,9 +627,9 @@ test_iterator_substring(TestBatchRunner *runner) {
     StringIterator *end = Str_Tail(string);
 
     {
-        String *substring = StrIter_substring(start, end);
+        String *substring = StrIter_crop(start, end);
         TEST_TRUE(runner, Str_Equals(substring, (Obj*)string),
-                  "StrIter_substring whole string");
+                  "StrIter_crop whole string");
         DECREF(substring);
     }
 
@@ -637,10 +637,10 @@ test_iterator_substring(TestBatchRunner *runner) {
     StrIter_Recede(end, 2);
 
     {
-        String *substring = StrIter_substring(start, end);
+        String *substring = StrIter_crop(start, end);
         String *wanted = Str_newf("b%sc", smiley);
         TEST_TRUE(runner, Str_Equals(substring, (Obj*)wanted),
-                  "StrIter_substring");
+                  "StrIter_crop");
 
         TEST_TRUE(runner, StrIter_Starts_With(start, wanted),
                   "Starts_With returns true");
@@ -669,19 +669,19 @@ test_iterator_substring(TestBatchRunner *runner) {
     }
 
     {
-        String *substring = StrIter_substring(end, NULL);
+        String *substring = StrIter_crop(end, NULL);
         String *wanted = Str_newf("%sd", smiley);
         TEST_TRUE(runner, Str_Equals(substring, (Obj*)wanted),
-                  "StrIter_substring with NULL tail");
+                  "StrIter_crop with NULL tail");
         DECREF(wanted);
         DECREF(substring);
     }
 
     {
-        String *substring = StrIter_substring(NULL, start);
+        String *substring = StrIter_crop(NULL, start);
         String *wanted = Str_newf("a%s", smiley);
         TEST_TRUE(runner, Str_Equals(substring, (Obj*)wanted),
-                  "StrIter_substring with NULL top");
+                  "StrIter_crop with NULL top");
         DECREF(wanted);
         DECREF(substring);
     }

Reply via email to