pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Removed unused code. Changed on...
details: https://anonhg.NetBSD.org/pkgsrc/rev/e1e99e91f53e
branches: trunk
changeset: 550873:e1e99e91f53e
user: rillig <rillig%pkgsrc.org@localhost>
date: Tue Dec 02 09:00:28 2008 +0000
description:
Removed unused code. Changed one constructor call to match the pattern
of all the others. Explained how to get an overview of the code.
diffstat:
pkgtools/pkglint/files/pkglint.pl | 61 +++-----------------------------------
1 files changed, 5 insertions(+), 56 deletions(-)
diffs (90 lines):
diff -r 86d11b62bb02 -r e1e99e91f53e pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Tue Dec 02 00:47:50 2008 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Tue Dec 02 09:00:28 2008 +0000
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.791 2008/11/30 22:19:01 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.792 2008/12/02 09:00:28 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -22,6 +22,9 @@
# All rights reserved.
# Freely redistributable. Absolutely no warranty.
+# To get an overview of the code, run:
+# sed -n -e 's,^\(sub .*\) {.*, \1,p' -e '/^package/p'
+
#==========================================================================
# Note: The @EXPORT clauses in the packages must be in a BEGIN block,
# because otherwise the names starting with an uppercase letter are not
@@ -274,60 +277,6 @@
#== End of PkgLint::Logging ===============================================
#==========================================================================
-# A File is a structure containing the contents of a file:
-# name: string The name of the file.
-# lines: array of string The physical lines in the file.
-#==========================================================================
-package PkgLint::File;
-
-use enum qw(NAME LINES);
-
-sub new($$$) {
- my ($class, $name, $lines) = @_;
- my $self = [$name, $lines];
- bless($self, $class);
- return $self;
-}
-
-sub name($) { return shift(@_)->[NAME]; }
-sub lines($) { return shift(@_)->[LINES]; }
-
-sub load($$) {
- my ($self, $fname) = @_;
- my ($lines);
-
- $lines = [];
- open(F, "<", $fname) or return undef;
- while (defined(my $line = <F>)) {
- push(@{$lines}, $line);
- }
- close(F) or return undef;
-
- $self->[NAME] = $fname;
- $self->[LINES] = $lines;
- return $self;
-}
-
-#==========================================================================
-# A Location is a structure containing a location in a file:
-# lineno: int The line number in the file
-# colno: int The column number in the file
-#==========================================================================
-package PkgLint::Location;
-
-use enum qw(LINENO COLNO);
-
-sub new($$$$) {
- my ($class, $lineno, $colno) = @_;
- my ($self) = ([$lineno, $colno]);
- bless($self, $class);
- return $self;
-}
-
-sub lineno($) { return shift(@_)->[LINENO]; }
-sub colno($) { return shift(@_)->[COLNO]; }
-
-#==========================================================================
# A SimpleMatch is the result of applying a regular expression to a Perl
# scalar value. It can return the range and the text of the captured
# groups.
@@ -2871,7 +2820,7 @@
if ($lineno <= $#{$lines} && $lines->[$lineno]->text =~ $regex) {
${$lineno_ref}++;
- return new PkgLint::SimpleMatch($lines->[$lineno]->text, \@-, \@+);
+ return PkgLint::SimpleMatch->new($lines->[$lineno]->text, \@-, \@+);
} else {
return false;
}
Home |
Main Index |
Thread Index |
Old Index