summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteffen Mueller <smueller@cpan.org>2011-02-13 23:34:58 +0100
committerSteffen Mueller <smueller@cpan.org>2011-07-12 20:53:57 +0200
commit59732b25ea05750025a261938742b7830822f2a9 (patch)
tree176d70470e190cdd10aa3609239f9cd7fdc8c807
parentc667e0968c1ffca8464d135e9b762736c81e012b (diff)
downloadperl-smueller/strictpxs_fixups.tar.gz
Cleanup of make_targetablesmueller/strictpxs_fixups
-rw-r--r--dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm39
1 files changed, 29 insertions, 10 deletions
diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm
index 6b1bf4052c..b6e36c5484 100644
--- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm
+++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm
@@ -495,11 +495,26 @@ Hash.
sub make_targetable {
my $output_expr_ref = shift;
- my ($cast, $size);
- our $bal;
- $bal = qr[(?:(?>[^()]+)|\((??{ $bal })\))*]; # ()-balanced
- $cast = qr[(?:\(\s*SV\s*\*\s*\)\s*)?]; # Optional (SV*) cast
- $size = qr[,\s* (??{ $bal }) ]x; # Third arg (to setpvn)
+
+ our $bal; # ()-balanced
+ $bal = qr[
+ (?:
+ (?>[^()]+)
+ |
+ \( (??{ $bal }) \)
+ )*
+ ]x;
+
+ # matches variations on (SV*)
+ my $sv_cast = qr[
+ (?:
+ \( \s* SV \s* \* \s* \) \s*
+ )?
+ ]x;
+
+ my $size = qr[ # Third arg (to setpvn)
+ , \s* (??{ $bal })
+ ]x;
my %targetable;
foreach my $key (keys %{ $output_expr_ref }) {
@@ -507,16 +522,20 @@ sub make_targetable {
# available to miniperl, and does not attempt to load the XS code.
use re 'eval';
- my ($t, $with_size, $arg, $sarg) =
+ my ($type, $with_size, $arg, $sarg) =
($output_expr_ref->{$key} =~
- m[^ \s+ sv_set ( [iunp] ) v (n)? # Type, is_setpvn
- \s* \( \s* $cast \$arg \s* ,
- \s* ( (??{ $bal }) ) # Set from
+ m[^
+ \s+
+ sv_set([iunp])v(n)? # Type, is_setpvn
+ \s*
+ \( \s*
+ $sv_cast \$arg \s* , \s*
+ ( (??{ $bal }) ) # Set from
( (??{ $size }) )? # Possible sizeof set-from
\) \s* ; \s* $
]x
);
- $targetable{$key} = [$t, $with_size, $arg, $sarg] if $t;
+ $targetable{$key} = [$type, $with_size, $arg, $sarg] if $type;
}
return %targetable;
}