From: Jonathan Stowe Date: Thu, 29 Mar 2001 09:34:12 +0000 (+0100) Subject: h2xs -w nits X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f1f595f582f5c084b3fa5f855859610439f2b2ce;p=p5sagit%2Fp5-mst-13.2.git h2xs -w nits Message-ID: p4raw-id: //depot/perl@9439 --- diff --git a/utils/h2xs.PL b/utils/h2xs.PL index 896d05f..425704b 100644 --- a/utils/h2xs.PL +++ b/utils/h2xs.PL @@ -26,7 +26,7 @@ print "Extracting $file (with variable substitutions)\n"; # You can use $Config{...} to use Configure variables. print OUT <<"!GROK!THIS!"; -$Config{startperl} +$Config{startperl} -w eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}' if \$running_under_some_shell; !GROK!THIS! @@ -471,7 +471,9 @@ $opt_c = 1 if $opt_A; $opt_c = $opt_f = 1 if $opt_X; my %const_xsub = map { $_,1 } split(/,+/, $opt_s) if $opt_s; -my $extralibs; + +my $extralibs = ''; + my @path_h; while (my $arg = shift) { @@ -635,7 +637,8 @@ if( @path_h ){ my ($ext, $nested, @modparts, $modfname, $modpname); -(chdir 'ext', $ext = 'ext/') if -d 'ext'; + +$ext = chdir 'ext' ? 'ext/' : ''; if( $module =~ /::/ ){ $nested = 1; @@ -896,7 +899,7 @@ sub AUTOLOAD { my \$constname; $tmp (\$constname = \$AUTOLOAD) =~ s/.*:://; - croak "&$module::constant not defined" if \$constname eq 'constant'; + croak "&${module}::constant not defined" if \$constname eq 'constant'; my \$val = constant(\$constname, \@_ ? \$_[0] : 0); if (\$! != 0) { if (\$! =~ /Invalid/ || \$!{EINVAL}) { @@ -1196,7 +1199,7 @@ END for my $n (@$list) { my $c = substr $n, $off, 1; $leading{$c} = [] unless exists $leading{$c}; - push @{$leading{$c}}, substr $n, $off + 1; + push @{$leading{$c}}, $off < length $n ? substr $n, $off + 1 : $n } if (keys(%leading) == 1) { @@ -1287,7 +1290,7 @@ if( ! $opt_c ) { static int not_here(char *s) { - croak("$module::%s not implemented on this architecture", s); + croak("${module}::%s not implemented on this architecture", s); return -1; } @@ -1298,8 +1301,7 @@ END print_tievar_subs(\*XS, $_, $vdecl_hash{$_}) for @vdecls; -my $prefix; -$prefix = "PREFIX = $opt_p" if defined $opt_p; +my $prefix = defined $opt_p ? "PREFIX = $opt_p" : ''; # Now switch from C to XS by issuing the first MODULE declaration: print XS <<"END"; @@ -1634,7 +1636,7 @@ sub normalize_type { # Second arg: do not strip const's before \* else { $type =~ s/$ignore_mods//go; } - $type =~ s/([^\s\w])/ \1 /g; + $type =~ s/([^\s\w])/ $1 /g; $type =~ s/\s+$//; $type =~ s/^\s+//; $type =~ s/\s+/ /g; @@ -1745,7 +1747,7 @@ EOC print PL < ['$extralibs'], # e.g., '-lm' 'DEFINE' => '$opt_F', # e.g., '-DHAVE_SOMETHING' -$Icomment 'INC' => '$I', # e.g., '$Ihelp-I/usr/include/other' +$Icomment 'INC' => '$I', # e.g., '${Ihelp}-I/usr/include/other' END my $C = grep $_ ne "$modfname.c", (glob '*.c'), (glob '*.cc'), (glob '*.C');