You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2009/12/01 03:16:18 UTC

svn commit: r885653 - /lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl/Constructor.pm

Author: marvin
Date: Tue Dec  1 02:16:13 2009
New Revision: 885653

URL: http://svn.apache.org/viewvc?rev=885653&view=rev
Log:
Have Perl bindings for constructors that return NULL return undef rather than
segfault.

Modified:
    lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl/Constructor.pm

Modified: lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl/Constructor.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl/Constructor.pm?rev=885653&r1=885652&r2=885653&view=diff
==============================================================================
--- lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl/Constructor.pm (original)
+++ lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl/Constructor.pm Tue Dec  1 02:16:13 2009
@@ -122,8 +122,13 @@
         $var_assignments
         $refcount_mods
         retval = $func_sym($name_list);
-        ST(0) = Lucy_Obj_To_Host(retval);
-        LUCY_DECREF(retval);
+        if (retval) {
+            ST(0) = (SV*)Lucy_Obj_To_Host(retval);
+            Lucy_Obj_Dec_RefCount(retval);
+        }
+        else {
+            ST(0) = newSV(0);
+        }
         sv_2mortal( ST(0) );
         XSRETURN(1);
     }