Change BB_Cat to take Blob arg. This is analogous to having CharBuf's Cat take a String.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/3e4631bf Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/3e4631bf Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/3e4631bf Branch: refs/heads/master Commit: 3e4631bf7ac64a11b36bfedd4f1dd6e94e76a3e6 Parents: 7ef5eaf Author: Marvin Humphrey <[email protected]> Authored: Sat Aug 8 19:18:38 2015 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Mon Aug 10 15:11:57 2015 -0700 ---------------------------------------------------------------------- runtime/core/Clownfish/ByteBuf.c | 4 ++-- runtime/core/Clownfish/ByteBuf.cfh | 2 +- runtime/core/Clownfish/Test/TestByteBuf.c | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/3e4631bf/runtime/core/Clownfish/ByteBuf.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/ByteBuf.c b/runtime/core/Clownfish/ByteBuf.c index f32fa2c..210ed18 100644 --- a/runtime/core/Clownfish/ByteBuf.c +++ b/runtime/core/Clownfish/ByteBuf.c @@ -159,8 +159,8 @@ BB_Cat_Bytes_IMP(ByteBuf *self, const void *bytes, size_t size) { } void -BB_Cat_IMP(ByteBuf *self, ByteBuf *other) { - SI_cat_bytes(self, other->buf, other->size); +BB_Cat_IMP(ByteBuf *self, Blob *blob) { + SI_cat_bytes(self, Blob_Get_Buf(blob), Blob_Get_Size(blob)); } static void http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/3e4631bf/runtime/core/Clownfish/ByteBuf.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/ByteBuf.cfh b/runtime/core/Clownfish/ByteBuf.cfh index 43d6710..0235741 100644 --- a/runtime/core/Clownfish/ByteBuf.cfh +++ b/runtime/core/Clownfish/ByteBuf.cfh @@ -99,7 +99,7 @@ final class Clownfish::ByteBuf nickname BB inherits Clownfish::Obj { * original ByteBuf. Allocate more memory as needed. */ void - Cat(ByteBuf *self, ByteBuf *other); + Cat(ByteBuf *self, Blob *blob); /** Assign more memory to the ByteBuf, if it doesn't already have enough * room to hold `size` bytes. Cannot shrink the allocation. http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/3e4631bf/runtime/core/Clownfish/Test/TestByteBuf.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Test/TestByteBuf.c b/runtime/core/Clownfish/Test/TestByteBuf.c index c393450..1fe41b8 100644 --- a/runtime/core/Clownfish/Test/TestByteBuf.c +++ b/runtime/core/Clownfish/Test/TestByteBuf.c @@ -25,6 +25,7 @@ #include "Clownfish/Test.h" #include "Clownfish/TestHarness/TestBatchRunner.h" #include "Clownfish/TestHarness/TestUtils.h" +#include "Clownfish/Blob.h" #include "Clownfish/Class.h" TestByteBuf* @@ -125,16 +126,16 @@ static void test_Cat(TestBatchRunner *runner) { ByteBuf *wanted = BB_new_bytes("foobar", 6); ByteBuf *got = BB_new_bytes("foo", 3); - ByteBuf *scratch = BB_new_bytes("bar", 3); + Blob *blob = Blob_new("bar", 3); - BB_Cat(got, scratch); + BB_Cat(got, blob); TEST_TRUE(runner, BB_Equals(wanted, (Obj*)got), "Cat"); BB_Mimic_Bytes(wanted, "foobarbaz", 9); BB_Cat_Bytes(got, "baz", 3); TEST_TRUE(runner, BB_Equals(wanted, (Obj*)got), "Cat_Bytes"); - DECREF(scratch); + DECREF(blob); DECREF(got); DECREF(wanted); }
