diff options
author | Steffen Mueller <smueller@cpan.org> | 2011-02-13 20:13:45 +0100 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2011-07-12 20:54:49 +0200 |
commit | 737750de48d44241d455db7a289c4e5074109068 (patch) | |
tree | 821700d83dca064c1f867987dbb897fb37f20a19 /dist | |
parent | 2d9f8a35117b0288e33788faa7c42dfebfa07672 (diff) | |
download | perl-737750de48d44241d455db7a289c4e5074109068.tar.gz |
More whitespace bug-compatibility
Diffstat (limited to 'dist')
-rw-r--r-- | dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm index b6d07bc7d1..b4688abacd 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm @@ -661,10 +661,10 @@ sub _get_inputmap_hash { foreach my $xstype (keys %$lookup) { $rv{$xstype} = $storage->[ $lookup->{$xstype} ]->code; - # Squash trailing whitespace to one line break max + # Squash trailing whitespace to one line break # This isn't strictly necessary, but makes the output more similar # to the original ExtUtils::ParseXS. - $rv{$xstype} =~ s/\s+?\n\z/\n/; + $rv{$xstype} =~ s/\s*\z/\n/; } return \%rv; @@ -705,6 +705,11 @@ sub _get_outputmap_hash { my %rv; foreach my $xstype (keys %$lookup) { $rv{$xstype} = $storage->[ $lookup->{$xstype} ]->code; + + # Squash trailing whitespace to one line break + # This isn't strictly necessary, but makes the output more similar + # to the original ExtUtils::ParseXS. + $rv{$xstype} =~ s/\s*\z/\n/; } return \%rv; @@ -811,7 +816,7 @@ sub _parse { if ($section eq 'typemap') { my $line = $_; s/^\s+//; s/\s+$//; - next if /^#/ or /^$/; + next if $_ eq '' or /^#/; my($type, $kind, $proto) = /^(.*?\S)\s+(\S+)\s*($ExtUtils::ParseXS::Constants::PrototypeRegexp*)$/o or warn("Warning: File '$filename' Line $lineno '$line' TYPEMAP entry needs 2 or 3 columns\n"), next; @@ -825,8 +830,9 @@ sub _parse { ) ); } elsif (/^\s/) { + s/\s+$//; $$current .= $$current eq '' ? $_ : "\n".$_; - } elsif (/^$/) { + } elsif ($_ eq '') { next; } elsif ($section eq 'input') { s/\s+$//; |