lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [09/22] lucy-clownfish git commit: Remove VA_Gather
Date Wed, 29 Apr 2015 19:55:10 GMT
Remove VA_Gather


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

Branch: refs/heads/master
Commit: a13b874d8038ba4093fa264d00c498a7e9427a5d
Parents: 790694a
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sun Apr 26 14:14:18 2015 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Sun Apr 26 19:44:55 2015 +0200

----------------------------------------------------------------------
 runtime/core/Clownfish/Test/TestVArray.c | 41 +--------------------------
 runtime/core/Clownfish/VArray.c          | 12 --------
 runtime/core/Clownfish/VArray.cfh        | 14 ---------
 3 files changed, 1 insertion(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a13b874d/runtime/core/Clownfish/Test/TestVArray.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestVArray.c b/runtime/core/Clownfish/Test/TestVArray.c
index acda0d2..ae28879 100644
--- a/runtime/core/Clownfish/Test/TestVArray.c
+++ b/runtime/core/Clownfish/Test/TestVArray.c
@@ -447,44 +447,6 @@ test_Sort(TestBatchRunner *runner) {
     DECREF(wanted);
 }
 
-static bool
-S_elem_not_three(VArray *array, uint32_t tick, void *data) {
-    UNUSED_VAR(data);
-    Obj *elem = VA_Fetch(array, tick);
-    if (elem == NULL) { return true; }
-    StackString *three_str = SSTR_WRAP_UTF8("three", 5);
-    return !Obj_Equals(elem, (Obj*)three_str);
-}
-
-static void
-test_Gather(TestBatchRunner *runner) {
-    VArray *array  = VA_new(8);
-    VArray *wanted = VA_new(8);
-    VArray *got    = NULL;
-
-    VA_Push(array, NULL);
-    VA_Push(array, (Obj*)Str_newf("one"));
-    VA_Push(array, (Obj*)Str_newf("two"));
-    VA_Push(array, NULL);
-    VA_Push(array, NULL);
-    VA_Push(array, (Obj*)Str_newf("three"));
-    VA_Push(array, (Obj*)Str_newf("four"));
-
-    VA_Push(wanted, NULL);
-    VA_Push(wanted, (Obj*)Str_newf("one"));
-    VA_Push(wanted, (Obj*)Str_newf("two"));
-    VA_Push(wanted, NULL);
-    VA_Push(wanted, NULL);
-    VA_Push(wanted, (Obj*)Str_newf("four"));
-
-    got = VA_Gather(array, S_elem_not_three, NULL);
-    TEST_TRUE(runner, VA_Equals(got, (Obj*)wanted), "Gather");
-
-    DECREF(array);
-    DECREF(wanted);
-    DECREF(got);
-}
-
 static void
 test_Grow(TestBatchRunner *runner) {
     VArray   *array = VA_new(500);
@@ -511,7 +473,7 @@ test_Grow(TestBatchRunner *runner) {
 
 void
 TestVArray_Run_IMP(TestVArray *self, TestBatchRunner *runner) {
-    TestBatchRunner_Plan(runner, (TestBatch*)self, 60);
+    TestBatchRunner_Plan(runner, (TestBatch*)self, 59);
     test_Equals(runner);
     test_Store_Fetch(runner);
     test_Push_Pop_Insert(runner);
@@ -523,7 +485,6 @@ TestVArray_Run_IMP(TestVArray *self, TestBatchRunner *runner) {
     test_Clone(runner);
     test_exceptions(runner);
     test_Sort(runner);
-    test_Gather(runner);
     test_Grow(runner);
 }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a13b874d/runtime/core/Clownfish/VArray.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/VArray.c b/runtime/core/Clownfish/VArray.c
index bcb367f..62e620d 100644
--- a/runtime/core/Clownfish/VArray.c
+++ b/runtime/core/Clownfish/VArray.c
@@ -260,18 +260,6 @@ VA_Equals_IMP(VArray *self, Obj *other) {
 }
 
 VArray*
-VA_Gather_IMP(VArray *self, VA_Gather_Test_t test, void *data) {
-    VArray *gathered = VA_new(self->size);
-    for (size_t i = 0, max = self->size; i < max; i++) {
-        if (test(self, i, data)) {
-            Obj *elem = self->elems[i];
-            VA_Push(gathered, elem ? INCREF(elem) : NULL);
-        }
-    }
-    return gathered;
-}
-
-VArray*
 VA_Slice_IMP(VArray *self, size_t offset, size_t length) {
     // Adjust ranges if necessary.
     if (offset >= self->size) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a13b874d/runtime/core/Clownfish/VArray.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/VArray.cfh b/runtime/core/Clownfish/VArray.cfh
index 274f746..746b05a 100644
--- a/runtime/core/Clownfish/VArray.cfh
+++ b/runtime/core/Clownfish/VArray.cfh
@@ -16,15 +16,6 @@
 
 parcel Clownfish;
 
-__C__
-typedef bool
-(*CFISH_VA_Gather_Test_t)(cfish_VArray *self, size_t tick, void *data);
-
-#ifdef CFISH_USE_SHORT_NAMES
-  #define VA_Gather_Test_t CFISH_VA_Gather_Test_t
-#endif
-__END_C__
-
 /** Variable-sized array.
  */
 class Clownfish::VArray nickname VA inherits Clownfish::Obj {
@@ -132,11 +123,6 @@ class Clownfish::VArray nickname VA inherits Clownfish::Obj {
     size_t
     Get_Capacity(VArray *self);
 
-    /** Return all elements for which `test` returns true.
-     */
-    public incremented VArray*
-    Gather(VArray *self, CFISH_VA_Gather_Test_t test, void *data);
-
     /** Return a new array consisting of elements from a contiguous slice.  If
      * the specified range is out of bounds, return an array with fewer
      * elements -- potentially none.


Mime
View raw message