From: Nicholas Clark Date: Fri, 23 Dec 2005 00:37:04 +0000 (+0000) Subject: Use inlineable proxy constant subs for Socket X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2ebbb0c37e2208c771091cac60cafb6a2767248b;p=p5sagit%2Fp5-mst-13.2.git Use inlineable proxy constant subs for Socket p4raw-id: //depot/perl@26463 --- diff --git a/ext/Socket/Makefile.PL b/ext/Socket/Makefile.PL index e543689..485b456 100644 --- a/ext/Socket/Makefile.PL +++ b/ext/Socket/Makefile.PL @@ -63,6 +63,7 @@ push @names, foreach qw(INADDR_ANY INADDR_LOOPBACK INADDR_NONE INADDR_BROADCAST); WriteConstants( + PROXYSUBS => 1, NAME => 'Socket', NAMES => \@names, ); diff --git a/lib/ExtUtils/Constant/ProxySubs.pm b/lib/ExtUtils/Constant/ProxySubs.pm index 95b5e59..116e2dc 100644 --- a/lib/ExtUtils/Constant/ProxySubs.pm +++ b/lib/ExtUtils/Constant/ProxySubs.pm @@ -39,6 +39,7 @@ $VERSION = '0.01'; YES => sub { '&PL_sv_yes' }, NO => sub { '&PL_sv_no' }, '' => sub { '&PL_sv_yes' }, + SV => sub {"SvREFCNT_inc($_[0])"}, ); %type_to_C_value = @@ -55,6 +56,7 @@ sub type_to_C_value { %type_is_a_problem = ( + # The documentation says *mortal SV*, but we now need a non-mortal copy. SV => 1, ); @@ -278,10 +280,14 @@ EOBOOT die "Can't find generator code for type $type" unless defined $generator; + print $xs_fh " {\n"; + print $xs_fh " $item->{pre}\n" if $item->{pre}; printf $xs_fh <<"EOBOOT", $name, &$generator(&$type_to_value($value)); - ${c_subname}_add_symbol($athx symbol_table, "%s", - $namelen, %s); + ${c_subname}_add_symbol($athx symbol_table, "%s", + $namelen, %s); EOBOOT + print $xs_fh " $item->{post}\n" if $item->{post}; + print $xs_fh " }\n"; print $xs_fh $self->macro_to_endif($macro); }