lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [2/2] git commit: refs/heads/LUCY-263-mempool-semantics - Remove unused method MemPool_Eat().
Date Sun, 27 Apr 2014 23:29:48 GMT
Remove unused method MemPool_Eat().


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

Branch: refs/heads/LUCY-263-mempool-semantics
Commit: 763ec7f2313d36dc984e25c1c1ea9899e81e599e
Parents: 0dcc56e
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Sun Apr 27 10:45:46 2014 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Sun Apr 27 10:45:46 2014 -0700

----------------------------------------------------------------------
 core/Lucy/Test/Util/TestMemoryPool.c | 12 +-----------
 core/Lucy/Util/MemoryPool.c          | 21 ---------------------
 core/Lucy/Util/MemoryPool.cfh        |  8 --------
 3 files changed, 1 insertion(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/763ec7f2/core/Lucy/Test/Util/TestMemoryPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestMemoryPool.c b/core/Lucy/Test/Util/TestMemoryPool.c
index 1c9d3e1..30199df 100644
--- a/core/Lucy/Test/Util/TestMemoryPool.c
+++ b/core/Lucy/Test/Util/TestMemoryPool.c
@@ -31,12 +31,10 @@ TestMemPool_new() {
 
 void
 TestMemPool_Run_IMP(TestMemoryPool *self, TestBatchRunner *runner) {
-    TestBatchRunner_Plan(runner, (TestBatch*)self, 7);
+    TestBatchRunner_Plan(runner, (TestBatch*)self, 5);
 
     MemoryPool *mem_pool = MemPool_new(0);
-    MemoryPool *other    = MemPool_new(0);
     MemoryPoolIVARS *const ivars = MemPool_IVARS(mem_pool);
-    MemoryPoolIVARS *const ovars = MemPool_IVARS(other);
     char *ptr_a, *ptr_b;
 
     ptr_a = (char*)MemPool_Grab(mem_pool, 10);
@@ -57,15 +55,7 @@ TestMemPool_Run_IMP(TestMemoryPool *self, TestBatchRunner *runner) {
     TEST_INT_EQ(runner, MemPool_Get_Consumed(mem_pool), 0,
                 "Release_All() resets `consumed`");
 
-    ptr_a = (char*)MemPool_Grab(mem_pool, 20);
-    ptr_b = (char*)MemPool_Grab(other, 20);
-    MemPool_Release_All(other);
-    MemPool_Eat(other, mem_pool);
-    TEST_TRUE(runner, ovars->buf == ivars->buf, "Eat");
-    TEST_TRUE(runner, ovars->buf != NULL, "Eat");
-
     DECREF(mem_pool);
-    DECREF(other);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/763ec7f2/core/Lucy/Util/MemoryPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/MemoryPool.c b/core/Lucy/Util/MemoryPool.c
index a2680a5..862fefb 100644
--- a/core/Lucy/Util/MemoryPool.c
+++ b/core/Lucy/Util/MemoryPool.c
@@ -157,24 +157,3 @@ MemPool_Release_All_IMP(MemoryPool *self) {
     ivars->consumed = 0;
 }
 
-void
-MemPool_Eat_IMP(MemoryPool *self, MemoryPool *other) {
-    MemoryPoolIVARS *const ivars = MemPool_IVARS(self);
-    MemoryPoolIVARS *const ovars = MemPool_IVARS(other);
-    if (ivars->buf != NULL) {
-        THROW(ERR, "Memory pool is not empty");
-    }
-
-    // Move active arenas from other to self.
-    for (int32_t i = 0; i <= ovars->tick; i++) {
-        ByteBuf *arena = (ByteBuf*)VA_Shift(ovars->arenas);
-        // Maybe displace existing arena.
-        VA_Store(ivars->arenas, i, (Obj*)arena);
-    }
-    ivars->tick     = ovars->tick;
-    ivars->last_buf = ovars->last_buf;
-    ivars->buf      = ovars->buf;
-    ivars->limit    = ovars->limit;
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/763ec7f2/core/Lucy/Util/MemoryPool.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/MemoryPool.cfh b/core/Lucy/Util/MemoryPool.cfh
index 1c97a87..684895e 100644
--- a/core/Lucy/Util/MemoryPool.cfh
+++ b/core/Lucy/Util/MemoryPool.cfh
@@ -62,14 +62,6 @@ class Lucy::Util::MemoryPool nickname MemPool
     void
     Release_All(MemoryPool *self);
 
-    /** Take ownership of all the arenas in another MemoryPool.  Can only be
-     * called when the original memory pool has no outstanding allocations,
-     * typically just after a call to Release_All.  The purpose is to support
-     * bulk reallocation.
-     */
-    void
-    Eat(MemoryPool *self, MemoryPool *other);
-
     size_t
     Get_Consumed(MemoryPool *self);
 


Mime
View raw message