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/05/18 21:29:30 UTC

[04/10] lucy-clownfish git commit: Enable overload for all objects

Enable overload for all objects

With newer Perls, overloading is enabled by default. For older versions,
it's also really cheap, so there's no reason to do it selectively.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/63accb52
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/63accb52
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/63accb52

Branch: refs/heads/master
Commit: 63accb521c50b69c48bee04ced45a466a2541530
Parents: 7104364
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue May 12 17:45:36 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon May 18 21:25:33 2015 +0200

----------------------------------------------------------------------
 runtime/perl/xs/XSBind.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/63accb52/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/runtime/perl/xs/XSBind.c b/runtime/perl/xs/XSBind.c
index 8261ae8..4e45e13 100644
--- a/runtime/perl/xs/XSBind.c
+++ b/runtime/perl/xs/XSBind.c
@@ -769,7 +769,12 @@ CFISH_Obj_To_Host_IMP(cfish_Obj *self) {
     if (self->ref.count & XSBIND_REFCOUNT_FLAG) {
         S_lazy_init_host_obj(aTHX_ self);
     }
-    return newRV_inc((SV*)self->ref.host_obj);
+    SV *perl_obj = newRV_inc((SV*)self->ref.host_obj);
+#if PERL_VERSION <= 16
+    // Enable overloading.
+    SvAMAGIC_on(perl_obj);
+#endif
+    return perl_obj;
 }
 
 /*************************** Clownfish::Class ******************************/