summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorJonathan Stowe <gellyfish@gellyfish.com>2001-03-29 10:34:12 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-29 14:41:52 +0000
commitf1f595f582f5c084b3fa5f855859610439f2b2ce (patch)
tree4423252cf0f647e6d15e603635591458ba3ad3f0 /utils
parentaa500c9e11a992a997c7eaeb4ede67f77851dd92 (diff)
downloadperl-f1f595f582f5c084b3fa5f855859610439f2b2ce.tar.gz
h2xs -w nits
Message-ID: <Pine.LNX.4.30.0103290929130.19409-100000@orpheus.gellyfish.com> p4raw-id: //depot/perl@9439
Diffstat (limited to 'utils')
-rw-r--r--utils/h2xs.PL22
1 files changed, 12 insertions, 10 deletions
diff --git a/utils/h2xs.PL b/utils/h2xs.PL
index 896d05f5c8..425704bd81 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 <<END;
'LIBS' => ['$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');