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 2011/12/09 22:39:53 UTC
[lucy-commits] svn commit: r1212651 - in /incubator/lucy/trunk:
clownfish/src/CFCPerlMethod.c perl/lib/Lucy.pm perl/lib/Lucy/Object/Obj.pm
Author: marvin
Date: Fri Dec 9 21:39:53 2011
New Revision: 1212651
URL: http://svn.apache.org/viewvc?rev=1212651&view=rev
Log:
LUCY-187 Bind to correct destructors.
Lucy's destuctors were being bound to Perl, but as "destroy" rather than
"DESTROY" -- so they were being ignored for the most part. The sole exception
was Obj, for which a handrolled binding was working properly, and unlike the
others, called Lucy_Obj_Destroy(self) (a method call) rather than e.g.
lucy_Searcher_destroy(self) (a function call). Since everybody else inherited
DESTROY from Obj, the behavior was correct -- but by accident, since the
intent was to go through those other destructors.
This patch eliminates the Obj hack, and binds all Lucy destructors as DESTROY.
Modified:
incubator/lucy/trunk/clownfish/src/CFCPerlMethod.c
incubator/lucy/trunk/perl/lib/Lucy.pm
incubator/lucy/trunk/perl/lib/Lucy/Object/Obj.pm
Modified: incubator/lucy/trunk/clownfish/src/CFCPerlMethod.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCPerlMethod.c?rev=1212651&r1=1212650&r2=1212651&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCPerlMethod.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCPerlMethod.c Fri Dec 9 21:39:53 2011
@@ -64,9 +64,16 @@ CFCPerlMethod_init(CFCPerlMethod *self,
const char *class_name = CFCMethod_get_class_name(method);
int use_labeled_params = CFCParamList_num_vars(param_list) > 2
? 1 : 0;
+
+ // The Clownfish destructor needs to be spelled DESTROY for Perl.
if (!alias) {
alias = CFCMethod_micro_sym(method);
}
+ static const char destroy_uppercase[] = "DESTROY";
+ if (strcmp(alias, "destroy") == 0) {
+ alias = destroy_uppercase;
+ }
+
CFCPerlSub_init((CFCPerlSub*)self, param_list, class_name, alias,
use_labeled_params);
self->method = (CFCMethod*)CFCBase_incref((CFCBase*)method);
Modified: incubator/lucy/trunk/perl/lib/Lucy.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/lib/Lucy.pm?rev=1212651&r1=1212650&r2=1212651&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/lib/Lucy.pm (original)
+++ incubator/lucy/trunk/perl/lib/Lucy.pm Fri Dec 9 21:39:53 2011
@@ -154,6 +154,7 @@ sub error {$Lucy::Object::Err::error}
{
package Lucy::Object::LockFreeRegistry;
+ no warnings 'redefine';
sub DESTROY { } # leak all
}
@@ -393,6 +394,7 @@ sub error {$Lucy::Object::Err::error}
package Lucy::Object::ZombieCharBuf;
use Carp;
sub new { confess "ZombieCharBuf objects can only be created from C." }
+ no warnings 'redefine';
sub DESTROY { }
}
Modified: incubator/lucy/trunk/perl/lib/Lucy/Object/Obj.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/lib/Lucy/Object/Obj.pm?rev=1212651&r1=1212650&r2=1212651&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/lib/Lucy/Object/Obj.pm (original)
+++ incubator/lucy/trunk/perl/lib/Lucy/Object/Obj.pm Fri Dec 9 21:39:53 2011
@@ -107,18 +107,6 @@ PPCODE:
THROW(LUCY_ERR, "Error when deserializing obj of class %o", klass);
}
}
-
-void
-DESTROY(self)
- lucy_Obj *self;
-PPCODE:
- /*
- {
- char *perl_class = HvNAME(SvSTASH(SvRV(ST(0))));
- warn("Destroying: 0x%x %s", (unsigned)self, perl_class);
- }
- */
- Lucy_Obj_Destroy(self);
END_XS_CODE
my $synopsis = <<'END_SYNOPSIS';