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/1c9e956a Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/1c9e956a Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/1c9e956a Branch: refs/heads/kill_clownfish_host Commit: 1c9e956ac6ec6248a90e58fb20c015ba43a1ea33 Parents: 4395f10 Author: Marvin Humphrey <[email protected]> Authored: Wed Nov 14 18:55:17 2012 -0800 Committer: Marvin Humphrey <[email protected]> Committed: Wed Nov 14 18:55:17 2012 -0800 ---------------------------------------------------------------------- perl/lib/Lucy.pm | 14 +++++++------- perl/t/021-vtable.t | 2 +- perl/xs/XSBind.c | 15 +++++---------- 3 files changed, 13 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/1c9e956a/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/1c9e956a/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/1c9e956a/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;
