Implement Blob_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/40d863c7 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/40d863c7 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/40d863c7 Branch: refs/heads/master Commit: 40d863c7e1bcaf1db0b08d8c88ab7ba50c4dde7b Parents: eadeae0 Author: Nick Wellnhofer <[email protected]> Authored: Fri May 29 14:26:13 2015 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Fri May 29 17:51:24 2015 +0200 ---------------------------------------------------------------------- runtime/core/Clownfish/Blob.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/40d863c7/runtime/core/Clownfish/Blob.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Blob.cfh b/runtime/core/Clownfish/Blob.cfh index 4f236e0..2ad7a4a 100644 --- a/runtime/core/Clownfish/Blob.cfh +++ b/runtime/core/Clownfish/Blob.cfh @@ -50,6 +50,9 @@ final class Clownfish::Blob inherits Clownfish::Obj { inert int compare(const void *va, const void *vb); + void* + To_Host(Blob *self); + /** Accessor for "size" member. */ public size_t http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/40d863c7/runtime/perl/xs/XSBind.c ---------------------------------------------------------------------- diff --git a/runtime/perl/xs/XSBind.c b/runtime/perl/xs/XSBind.c index 31d600d..f1a9c21 100644 --- a/runtime/perl/xs/XSBind.c +++ b/runtime/perl/xs/XSBind.c @@ -144,9 +144,6 @@ XSBind_cfish_to_perl(pTHX_ cfish_Obj *obj) { else if (cfish_Obj_is_a(obj, CFISH_STRING)) { return XSBind_str_to_sv(aTHX_ (cfish_String*)obj); } - else if (cfish_Obj_is_a(obj, CFISH_BLOB)) { - return XSBind_blob_to_sv(aTHX_ (cfish_Blob*)obj); - } else { return (SV*)CFISH_Obj_To_Host(obj); } @@ -207,13 +204,6 @@ XSBind_perl_to_cfish(pTHX_ SV *sv) { } SV* -XSBind_blob_to_sv(pTHX_ cfish_Blob *blob) { - return blob - ? newSVpvn(CFISH_Blob_Get_Buf(blob), CFISH_Blob_Get_Size(blob)) - : newSV(0); -} - -SV* XSBind_str_to_sv(pTHX_ cfish_String *str) { if (!str) { return newSV(0); @@ -959,6 +949,14 @@ cfish_Err_trap(CFISH_Err_Attempt_t routine, void *context) { return error; } +/***************************** Clownfish::Blob ******************************/ + +void* +CFISH_Blob_To_Host_IMP(cfish_Blob *self) { + dTHX; + return newSVpvn(CFISH_Blob_Get_Buf(self), CFISH_Blob_Get_Size(self)); +} + /**************************** Clownfish::ByteBuf ****************************/ void* http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/40d863c7/runtime/perl/xs/XSBind.h ---------------------------------------------------------------------- diff --git a/runtime/perl/xs/XSBind.h b/runtime/perl/xs/XSBind.h index 0a300f3..711adab 100644 --- a/runtime/perl/xs/XSBind.h +++ b/runtime/perl/xs/XSBind.h @@ -131,11 +131,6 @@ cfish_XSBind_cfish_to_perl(pTHX_ cfish_Obj *obj); CFISH_VISIBLE cfish_Obj* cfish_XSBind_perl_to_cfish(pTHX_ SV *sv); -/** Convert a Blob into a new string SV. - */ -CFISH_VISIBLE SV* -cfish_XSBind_blob_to_sv(pTHX_ cfish_Blob *blob); - /** Convert a String into a new UTF-8 string SV. */ CFISH_VISIBLE SV* @@ -313,7 +308,6 @@ cfish_XSBind_allot_params(pTHX_ SV** stack, int32_t start, #define XSBind_cfish_obj_to_sv_noinc cfish_XSBind_cfish_obj_to_sv_noinc #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_str_to_sv cfish_XSBind_str_to_sv #define XSBind_trap cfish_XSBind_trap #define XSBind_allot_params cfish_XSBind_allot_params
