You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2015/11/12 14:14:50 UTC
[3/6] lucy-clownfish git commit: Add initializer BB_init_bytes
Add initializer BB_init_bytes
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/10f04e6c
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/10f04e6c
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/10f04e6c
Branch: refs/heads/master
Commit: 10f04e6c9d815575eab58ed6b10b1dd079c8ee86
Parents: cada6ca
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Nov 12 13:49:27 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Nov 12 14:08:17 2015 +0100
----------------------------------------------------------------------
runtime/core/Clownfish/ByteBuf.c | 5 +++++
runtime/core/Clownfish/ByteBuf.cfh | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/10f04e6c/runtime/core/Clownfish/ByteBuf.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/ByteBuf.c b/runtime/core/Clownfish/ByteBuf.c
index 210ed18..625da29 100644
--- a/runtime/core/Clownfish/ByteBuf.c
+++ b/runtime/core/Clownfish/ByteBuf.c
@@ -50,6 +50,11 @@ BB_init(ByteBuf *self, size_t capacity) {
ByteBuf*
BB_new_bytes(const void *bytes, size_t size) {
ByteBuf *self = (ByteBuf*)Class_Make_Obj(BYTEBUF);
+ return BB_init_bytes(self, bytes, size);
+}
+
+ByteBuf*
+BB_init_bytes(ByteBuf *self, const void *bytes, size_t size) {
BB_init(self, size);
memcpy(self->buf, bytes, size);
self->size = size;
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/10f04e6c/runtime/core/Clownfish/ByteBuf.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/ByteBuf.cfh b/runtime/core/Clownfish/ByteBuf.cfh
index 0235741..95e503f 100644
--- a/runtime/core/Clownfish/ByteBuf.cfh
+++ b/runtime/core/Clownfish/ByteBuf.cfh
@@ -36,11 +36,14 @@ final class Clownfish::ByteBuf nickname BB inherits Clownfish::Obj {
init(ByteBuf *self, size_t capacity);
/** Return a pointer to a new ByteBuf which holds a copy of the passed-in
- * string.
+ * bytes.
*/
inert incremented ByteBuf*
new_bytes(const void *bytes, size_t size);
+ inert ByteBuf*
+ init_bytes(ByteBuf *self, const void *bytes, size_t size);
+
/** Return a pointer to a new ByteBuf which assumes ownership of the
* passed-in string.
*/