diff options
Diffstat (limited to 'rpmconstant/rpmh2tbl')
-rwxr-xr-x | rpmconstant/rpmh2tbl | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/rpmconstant/rpmh2tbl b/rpmconstant/rpmh2tbl index a198526..3f989c8 100755 --- a/rpmconstant/rpmh2tbl +++ b/rpmconstant/rpmh2tbl @@ -129,7 +129,7 @@ my $ch = *STDOUT; sub parseconst { my ($header) = @_; - my ($hbasename) = $header =~ m#(?:.*/)(.*)$#; + my ($hbasename) = $header =~ m!(?:.*/)(.*)$!; my $hconstant = $file_const{$hbasename} or return; open(my $hheader, "<", $header) or die "Can't open $header\n"; @@ -138,14 +138,14 @@ sub parseconst { my $i; my $line = <$hheader>; - $line =~ /^\s*#\s*ifndef\s+(\S+)/; - my $headerdef = $1 if($1); + my $headerdef; + $headerdef = $1 if $line =~ /^\s*#\s*ifndef\s+(\S+)/; while ($line = <$hheader>) { - $line =~ s#^\s*/\*[^\*]*\*/##; + $line =~ s!^\s*/\*[^\*]*\*/!!; my ($w, $c) = $line =~ m!(?:#\s*define\s*)?([\w_]+)[^(/\*)]*(/\*.*\*/)?!; defined($w) or next; - foreach my $regexp (keys %{$hconstant}) { + foreach my $regexp (keys %$hconstant) { if ($w =~ /$regexp/) { $constants_found{$hconstant->{$regexp}}{$w}{n} ||= ++$i; $constants_found{$hconstant->{$regexp}}{$w}{c} ||= $c; @@ -156,7 +156,7 @@ sub parseconst { close($hheader); - while (my ($tbl, $const) = each (%constants_found)) { + while (my ($tbl, $const) = each %constants_found) { $tableprefix{$tbl} ||= ""; print $ch <<EOF; @@ -166,12 +166,12 @@ sub parseconst { EOF printf $ch "static const struct rpmconstant_s %sctbl[] = {\n", $tbl; - print $ch "#ifdef $headerdef\n" if ($headerdef); + print $ch "#ifdef $headerdef\n" if $headerdef; foreach my $c (sort { $const->{$a}{n} <=> $const->{$b}{n} } keys %$const) { - printf $ch "\t{ \"%s\", %s }, %s\n", + printf $ch qq(\t{ "%s", %s }, %s\n), uc($const->{$c}{s} || $c), $c, $const->{$c}{c} || ""; } - print $ch "#endif /* $headerdef */\n" if ($headerdef); + print $ch "#endif /* $headerdef */\n" if $headerdef; printf $ch "\t{ %s, %s } /* NULL terminated (%s) */\n", "NULL", "0", $tbl; print $ch "};\n"; printf $ch "const struct rpmconstant_s * %sctable = %sctbl;\n\n", $tbl, $tbl; @@ -203,9 +203,9 @@ foreach (@ARGV) { print $ch "static const struct rpmconstantlist_s rpmconstanttp[] = {\n"; foreach (sort(@availlabletables)) { printf $ch "\t{ %s, %s, %s },\n", - '(void *)'.$_."ctbl", + '(void *)' . $_ . "ctbl", '"' . lc($_) . '"', - $tableprefix{$_} ? "\"$tableprefix{$_}\"" : "NULL"; + $tableprefix{$_} ? qq("$tableprefix{$_}") : "NULL"; } printf $ch "\t{ %s, %s, %s } /* NULL terminated */\n", "(void *) NULL", "NULL", "NULL"; print $ch "};\n"; |