Implement BB_To_Host
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/eadeae08 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/eadeae08 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/eadeae08 Branch: refs/heads/master Commit: eadeae084ace20abe0d5ef7d6b01d44e04567dcd Parents: c717652 Author: Nick Wellnhofer <[email protected]> Authored: Fri May 29 14:10:18 2015 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Fri May 29 17:51:23 2015 +0200 ---------------------------------------------------------------------- runtime/core/Clownfish/ByteBuf.cfh | 3 +++ runtime/perl/xs/XSBind.c | 18 ++++++++---------- runtime/perl/xs/XSBind.h | 6 ------ 3 files changed, 11 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/eadeae08/runtime/core/Clownfish/ByteBuf.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/ByteBuf.cfh b/runtime/core/Clownfish/ByteBuf.cfh index 93e5a7c..43d6710 100644 --- a/runtime/core/Clownfish/ByteBuf.cfh +++ b/runtime/core/Clownfish/ByteBuf.cfh @@ -59,6 +59,9 @@ final class Clownfish::ByteBuf nickname BB inherits Clownfish::Obj { inert int compare(const void *va, const void *vb); + void* + To_Host(ByteBuf *self); + /** Set the object's size member. If greater than the object's capacity, * throws an error. */ http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/eadeae08/runtime/perl/xs/XSBind.c ---------------------------------------------------------------------- diff --git a/runtime/perl/xs/XSBind.c b/runtime/perl/xs/XSBind.c index 0e8a579..31d600d 100644 --- a/runtime/perl/xs/XSBind.c +++ b/runtime/perl/xs/XSBind.c @@ -147,9 +147,6 @@ XSBind_cfish_to_perl(pTHX_ cfish_Obj *obj) { else if (cfish_Obj_is_a(obj, CFISH_BLOB)) { return XSBind_blob_to_sv(aTHX_ (cfish_Blob*)obj); } - else if (cfish_Obj_is_a(obj, CFISH_BYTEBUF)) { - return XSBind_bb_to_sv(aTHX_ (cfish_ByteBuf*)obj); - } else { return (SV*)CFISH_Obj_To_Host(obj); } @@ -217,13 +214,6 @@ XSBind_blob_to_sv(pTHX_ cfish_Blob *blob) { } SV* -XSBind_bb_to_sv(pTHX_ cfish_ByteBuf *bb) { - return bb - ? newSVpvn(CFISH_BB_Get_Buf(bb), CFISH_BB_Get_Size(bb)) - : newSV(0); -} - -SV* XSBind_str_to_sv(pTHX_ cfish_String *str) { if (!str) { return newSV(0); @@ -969,6 +959,14 @@ cfish_Err_trap(CFISH_Err_Attempt_t routine, void *context) { return error; } +/**************************** Clownfish::ByteBuf ****************************/ + +void* +CFISH_BB_To_Host_IMP(cfish_ByteBuf *self) { + dTHX; + return newSVpvn(CFISH_BB_Get_Buf(self), CFISH_BB_Get_Size(self)); +} + /**************************** Clownfish::Vector *****************************/ void* http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/eadeae08/runtime/perl/xs/XSBind.h ---------------------------------------------------------------------- diff --git a/runtime/perl/xs/XSBind.h b/runtime/perl/xs/XSBind.h index e75b948..0a300f3 100644 --- a/runtime/perl/xs/XSBind.h +++ b/runtime/perl/xs/XSBind.h @@ -136,11 +136,6 @@ cfish_XSBind_perl_to_cfish(pTHX_ SV *sv); CFISH_VISIBLE SV* cfish_XSBind_blob_to_sv(pTHX_ cfish_Blob *blob); -/** Convert a ByteBuf into a new string SV. - */ -CFISH_VISIBLE SV* -cfish_XSBind_bb_to_sv(pTHX_ cfish_ByteBuf *bb); - /** Convert a String into a new UTF-8 string SV. */ CFISH_VISIBLE SV* @@ -319,7 +314,6 @@ cfish_XSBind_allot_params(pTHX_ SV** stack, int32_t start, #define XSBind_cfish_to_perl cfish_XSBind_cfish_to_perl #define XSBind_perl_to_cfish cfish_XSBind_perl_to_cfish #define XSBind_blob_to_sv cfish_XSBind_blob_to_sv -#define XSBind_bb_to_sv cfish_XSBind_bb_to_sv #define XSBind_str_to_sv cfish_XSBind_str_to_sv #define XSBind_trap cfish_XSBind_trap #define XSBind_allot_params cfish_XSBind_allot_params
