Force some bool values to true/false.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/8211411f Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/8211411f Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/8211411f Branch: refs/heads/master Commit: 8211411feea35dbb5c0cba0c19799f9da00c025e Parents: 133fb92 Author: Marvin Humphrey <[email protected]> Authored: Sun Jul 20 01:49:14 2014 +0100 Committer: Marvin Humphrey <[email protected]> Committed: Sun Jul 20 19:54:48 2014 +0100 ---------------------------------------------------------------------- compiler/src/CFCPerlMethod.c | 7 ++++++- runtime/perl/xs/XSBind.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8211411f/compiler/src/CFCPerlMethod.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCPerlMethod.c b/compiler/src/CFCPerlMethod.c index dd2a5ca..8027cb0 100644 --- a/compiler/src/CFCPerlMethod.c +++ b/compiler/src/CFCPerlMethod.c @@ -657,7 +657,12 @@ S_primitive_callback_def(CFCMethod *method, const char *callback_start, char callback_func[50]; if (CFCType_is_integer(return_type)) { - strcpy(callback_func, "S_finish_callback_i64"); + if (strcmp(ret_type_str, "bool") == 0) { + strcpy(callback_func, "!!S_finish_callback_i64"); + } + else { + strcpy(callback_func, "S_finish_callback_i64"); + } } else if (CFCType_is_floating(return_type)) { strcpy(callback_func, "S_finish_callback_f64"); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8211411f/runtime/perl/xs/XSBind.h ---------------------------------------------------------------------- diff --git a/runtime/perl/xs/XSBind.h b/runtime/perl/xs/XSBind.h index 73b5ebb..22189f9 100644 --- a/runtime/perl/xs/XSBind.h +++ b/runtime/perl/xs/XSBind.h @@ -55,7 +55,7 @@ static CFISH_INLINE bool cfish_XSBind_sv_defined(SV *sv) { if (!sv || !SvANY(sv)) { return false; } if (SvGMAGICAL(sv)) { mg_get(sv); } - return SvOK(sv); + return !!SvOK(sv); } /** If the SV contains a Clownfish object which passes an "isa" test against the
