Sun Apr 26 08:44:42 2009 UTC ()
Removed unused functions.


(rillig)
diff -r1.807 -r1.808 pkgsrc/pkgtools/pkglint/files/pkglint.pl

cvs diff -r1.807 -r1.808 pkgsrc/pkgtools/pkglint/files/Attic/pkglint.pl (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/pkglint.pl 2009/04/04 18:36:04 1.807
+++ pkgsrc/pkgtools/pkglint/files/Attic/pkglint.pl 2009/04/26 08:44:42 1.808
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1#! @PERL@ 1#! @PERL@
2# $NetBSD: pkglint.pl,v 1.807 2009/04/04 18:36:04 rillig Exp $ 2# $NetBSD: pkglint.pl,v 1.808 2009/04/26 08:44:42 rillig Exp $
3# 3#
4 4
5# pkglint - static analyzer and checker for pkgsrc packages 5# pkglint - static analyzer and checker for pkgsrc packages
6# 6#
7# Written by: 7# Written by:
8# Roland Illig <rillig@NetBSD.org> 8# Roland Illig <rillig@NetBSD.org>
9# 9#
10# Based on work by: 10# Based on work by:
11# Hubert Feyrer <hubertf@NetBSD.org> 11# Hubert Feyrer <hubertf@NetBSD.org>
12# Thorsten Frueauf <frueauf@NetBSD.org> 12# Thorsten Frueauf <frueauf@NetBSD.org>
13# Thomas Klausner <wiz@NetBSD.org> 13# Thomas Klausner <wiz@NetBSD.org>
14# and others. 14# and others.
15# 15#
@@ -40,64 +40,51 @@ package PkgLint::Util; @@ -40,64 +40,51 @@ package PkgLint::Util;
40# cific. Currently it contains the boolean constants C<false> and C<true>, 40# cific. Currently it contains the boolean constants C<false> and C<true>,
41# as well as a function to print text in a table format, and a function 41# as well as a function to print text in a table format, and a function
42# that converts an array into a hash. The latter is just for convenience 42# that converts an array into a hash. The latter is just for convenience
43# because I don't know of a Perl operator similar to qw() that can be used 43# because I don't know of a Perl operator similar to qw() that can be used
44# for creating a hash. 44# for creating a hash.
45#========================================================================== 45#==========================================================================
46BEGIN { 46BEGIN {
47 use Exporter; 47 use Exporter;
48 use vars qw(@ISA @EXPORT_OK); 48 use vars qw(@ISA @EXPORT_OK);
49 @ISA = qw(Exporter); 49 @ISA = qw(Exporter);
50 @EXPORT_OK = qw( 50 @EXPORT_OK = qw(
51 assert 51 assert
52 false true dont_know doesnt_matter 52 false true dont_know doesnt_matter
53 min max 
54 array_to_hash normalize_pathname print_table 53 array_to_hash normalize_pathname print_table
55 ); 54 );
56} 55}
57 56
58use enum qw(false true dont_know doesnt_matter); 57use enum qw(false true dont_know doesnt_matter);
59 58
60sub assert($$) { 59sub assert($$) {
61 my ($cond, $msg) = @_; 60 my ($cond, $msg) = @_;
62 my (@callers, $n); 61 my (@callers, $n);
63 62
64 if (!$cond) { 63 if (!$cond) {
65 print STDERR ("FATAL: Assertion failed: ${msg}.\n"); 64 print STDERR ("FATAL: Assertion failed: ${msg}.\n");
66 65
67 for ($n = 0; my @info = caller($n); $n++) { 66 for ($n = 0; my @info = caller($n); $n++) {
68 push(@callers, [$info[2], $info[3]]); 67 push(@callers, [$info[2], $info[3]]);
69 } 68 }
70 69
71 for (my $i = $#callers; $i >= 0; $i--) { 70 for (my $i = $#callers; $i >= 0; $i--) {
72 my $info = $callers[$i]; 71 my $info = $callers[$i];
73 printf STDERR (" line %4d called %s\n", $info->[0], $info->[1]); 72 printf STDERR (" line %4d called %s\n", $info->[0], $info->[1]);
74 } 73 }
75 exit(1); 74 exit(1);
76 } 75 }
77} 76}
78 77
79sub min($$) { 
80 my ($a, $b) = @_; 
81 
82 return ($a < $b) ? $a : $b; 
83} 
84 
85sub max($$) { 
86 my ($a, $b) = @_; 
87 
88 return ($a > $b) ? $a : $b; 
89} 
90 
91# Prints the C<$table> on the C<$out> stream. The C<$table> shall be an 78# Prints the C<$table> on the C<$out> stream. The C<$table> shall be an
92# array of rows, each row shall be an array of cells, and each cell shall 79# array of rows, each row shall be an array of cells, and each cell shall
93# be a string. 80# be a string.
94sub print_table($$) { 81sub print_table($$) {
95 my ($out, $table) = @_; 82 my ($out, $table) = @_;
96 my (@width) = (); 83 my (@width) = ();
97 foreach my $row (@{$table}) { 84 foreach my $row (@{$table}) {
98 foreach my $i (0..$#{$row}) { 85 foreach my $i (0..$#{$row}) {
99 if (!defined($width[$i]) || length($row->[$i]) > $width[$i]) { 86 if (!defined($width[$i]) || length($row->[$i]) > $width[$i]) {
100 $width[$i] = length($row->[$i]); 87 $width[$i] = length($row->[$i]);
101 } 88 }
102 } 89 }
103 } 90 }