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 2012/11/17 02:07:40 UTC
[lucy-commits] [5/9] git commit: refs/heads/master - Remove unnecessary callback
arguments.
Remove unnecessary callback arguments.
Now that we're writing XS code directly instead of going through the
Host_callback() interface, we can use the bare minimum number of
positional arguments rather than having to use Host_callback's more
complex conventions.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/2da34a63
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/2da34a63
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/2da34a63
Branch: refs/heads/master
Commit: 2da34a6373d82a6291a91106a3be41cec0c8dc7f
Parents: 21b0af8
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Wed Nov 14 18:55:17 2012 -0800
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Fri Nov 16 16:54:10 2012 -0800
----------------------------------------------------------------------
clownfish/runtime/perl/lib/Clownfish.pm | 14 +++++++-------
clownfish/runtime/perl/xs/XSBind.c | 15 +++++----------
perl/lib/Lucy.pm | 14 +++++++-------
perl/t/021-vtable.t | 2 +-
perl/xs/XSBind.c | 15 +++++----------
5 files changed, 25 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/2da34a63/clownfish/runtime/perl/lib/Clownfish.pm
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/lib/Clownfish.pm b/clownfish/runtime/perl/lib/Clownfish.pm
index 11ecc7f..92d8028 100644
--- a/clownfish/runtime/perl/lib/Clownfish.pm
+++ b/clownfish/runtime/perl/lib/Clownfish.pm
@@ -79,8 +79,8 @@ sub error {$Clownfish::Err::error}
our $VERSION = '0.003000';
$VERSION = eval $VERSION;
- sub find_parent_class {
- my ( undef, $package ) = @_;
+ sub _find_parent_class {
+ my $package = shift;
no strict 'refs';
for my $parent ( @{"$package\::ISA"} ) {
return $parent if $parent->isa('Clownfish::Obj');
@@ -88,8 +88,8 @@ sub error {$Clownfish::Err::error}
return;
}
- sub fresh_host_methods {
- my ( undef, $package ) = @_;
+ sub _fresh_host_methods {
+ my $package = shift;
no strict 'refs';
my $stash = \%{"$package\::"};
my $methods
@@ -103,9 +103,9 @@ sub error {$Clownfish::Err::error}
}
sub _register {
- my ( undef, %args ) = @_;
- my $singleton_class = $args{singleton}->get_name;
- my $parent_class = $args{parent}->get_name;
+ my ( $singleton, $parent ) = @_;
+ my $singleton_class = $singleton->get_name;
+ my $parent_class = $parent->get_name;
if ( !$singleton_class->isa($parent_class) ) {
no strict 'refs';
push @{"$singleton_class\::ISA"}, $parent_class;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2da34a63/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 7785d3f..bfa24a5 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -691,12 +691,9 @@ lucy_VTable_register_with_host(lucy_VTable *singleton, lucy_VTable *parent) {
dSP;
ENTER;
SAVETMPS;
- EXTEND(SP, 5);
+ EXTEND(SP, 2);
PUSHMARK(SP);
- PUSHmortal;
- mPUSHp("singleton", 9);
mPUSHs((SV*)Lucy_VTable_To_Host(singleton));
- mPUSHp("parent", 6);
mPUSHs((SV*)Lucy_VTable_To_Host(parent));
PUTBACK;
call_pv("Clownfish::VTable::_register", G_VOID | G_DISCARD);
@@ -709,12 +706,11 @@ lucy_VTable_fresh_host_methods(const lucy_CharBuf *class_name) {
dSP;
ENTER;
SAVETMPS;
- EXTEND(SP, 2);
+ EXTEND(SP, 1);
PUSHMARK(SP);
- PUSHmortal;
mPUSHs(XSBind_cb_to_sv(class_name));
PUTBACK;
- call_pv("Clownfish::VTable::fresh_host_methods", G_SCALAR);
+ call_pv("Clownfish::VTable::_fresh_host_methods", G_SCALAR);
SPAGAIN;
cfish_VArray *methods = (cfish_VArray*)XSBind_perl_to_cfish(POPs);
PUTBACK;
@@ -728,12 +724,11 @@ lucy_VTable_find_parent_class(const lucy_CharBuf *class_name) {
dSP;
ENTER;
SAVETMPS;
- EXTEND(SP, 2);
+ EXTEND(SP, 1);
PUSHMARK(SP);
- PUSHmortal;
mPUSHs(XSBind_cb_to_sv(class_name));
PUTBACK;
- call_pv("Clownfish::VTable::find_parent_class", G_SCALAR);
+ call_pv("Clownfish::VTable::_find_parent_class", G_SCALAR);
SPAGAIN;
SV *parent_class_sv = POPs;
PUTBACK;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2da34a63/perl/lib/Lucy.pm
----------------------------------------------------------------------
diff --git a/perl/lib/Lucy.pm b/perl/lib/Lucy.pm
index d536ee1..9481d47 100644
--- a/perl/lib/Lucy.pm
+++ b/perl/lib/Lucy.pm
@@ -152,8 +152,8 @@ sub error {$Clownfish::Err::error}
our $VERSION = '0.003000';
$VERSION = eval $VERSION;
- sub find_parent_class {
- my ( undef, $package ) = @_;
+ sub _find_parent_class {
+ my $package = shift;
no strict 'refs';
for my $parent ( @{"$package\::ISA"} ) {
return $parent if $parent->isa('Clownfish::Obj');
@@ -161,8 +161,8 @@ sub error {$Clownfish::Err::error}
return;
}
- sub fresh_host_methods {
- my ( undef, $package ) = @_;
+ sub _fresh_host_methods {
+ my $package = shift;
no strict 'refs';
my $stash = \%{"$package\::"};
my $methods
@@ -176,9 +176,9 @@ sub error {$Clownfish::Err::error}
}
sub _register {
- my ( undef, %args ) = @_;
- my $singleton_class = $args{singleton}->get_name;
- my $parent_class = $args{parent}->get_name;
+ my ( $singleton, $parent ) = @_;
+ my $singleton_class = $singleton->get_name;
+ my $parent_class = $parent->get_name;
if ( !$singleton_class->isa($parent_class) ) {
no strict 'refs';
push @{"$singleton_class\::ISA"}, $parent_class;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2da34a63/perl/t/021-vtable.t
----------------------------------------------------------------------
diff --git a/perl/t/021-vtable.t b/perl/t/021-vtable.t
index f94172c..76c7814 100644
--- a/perl/t/021-vtable.t
+++ b/perl/t/021-vtable.t
@@ -87,7 +87,7 @@ $resurrected->store( "ooga", $booga );
is( $resurrected->fetch("ooga"),
"booga", "subclassed object still performs correctly at the C level" );
-my $methods = Clownfish::VTable->fresh_host_methods('MyHash');
+my $methods = Clownfish::VTable::_fresh_host_methods('MyHash');
is_deeply( $methods->to_perl, ['oodle'], "fresh_host_methods" );
my $folder = RAMFolderOfDeath->new;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2da34a63/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/perl/xs/XSBind.c b/perl/xs/XSBind.c
index 7785d3f..bfa24a5 100644
--- a/perl/xs/XSBind.c
+++ b/perl/xs/XSBind.c
@@ -691,12 +691,9 @@ lucy_VTable_register_with_host(lucy_VTable *singleton, lucy_VTable *parent) {
dSP;
ENTER;
SAVETMPS;
- EXTEND(SP, 5);
+ EXTEND(SP, 2);
PUSHMARK(SP);
- PUSHmortal;
- mPUSHp("singleton", 9);
mPUSHs((SV*)Lucy_VTable_To_Host(singleton));
- mPUSHp("parent", 6);
mPUSHs((SV*)Lucy_VTable_To_Host(parent));
PUTBACK;
call_pv("Clownfish::VTable::_register", G_VOID | G_DISCARD);
@@ -709,12 +706,11 @@ lucy_VTable_fresh_host_methods(const lucy_CharBuf *class_name) {
dSP;
ENTER;
SAVETMPS;
- EXTEND(SP, 2);
+ EXTEND(SP, 1);
PUSHMARK(SP);
- PUSHmortal;
mPUSHs(XSBind_cb_to_sv(class_name));
PUTBACK;
- call_pv("Clownfish::VTable::fresh_host_methods", G_SCALAR);
+ call_pv("Clownfish::VTable::_fresh_host_methods", G_SCALAR);
SPAGAIN;
cfish_VArray *methods = (cfish_VArray*)XSBind_perl_to_cfish(POPs);
PUTBACK;
@@ -728,12 +724,11 @@ lucy_VTable_find_parent_class(const lucy_CharBuf *class_name) {
dSP;
ENTER;
SAVETMPS;
- EXTEND(SP, 2);
+ EXTEND(SP, 1);
PUSHMARK(SP);
- PUSHmortal;
mPUSHs(XSBind_cb_to_sv(class_name));
PUTBACK;
- call_pv("Clownfish::VTable::find_parent_class", G_SCALAR);
+ call_pv("Clownfish::VTable::_find_parent_class", G_SCALAR);
SPAGAIN;
SV *parent_class_sv = POPs;
PUTBACK;