pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc/files lintpkgsrc: clean up glob2regex
details: https://anonhg.NetBSD.org/pkgsrc/rev/1a804a25867a
branches: trunk
changeset: 382960:1a804a25867a
user: rillig <rillig%pkgsrc.org@localhost>
date: Tue Aug 09 18:42:40 2022 +0000
description:
lintpkgsrc: clean up glob2regex
diffstat:
pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diffs (36 lines):
diff -r ec8e8911d2d4 -r 1a804a25867a pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Tue Aug 09 18:35:43 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Tue Aug 09 18:42:40 2022 +0000
@@ -1,6 +1,6 @@
#!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.58 2022/08/09 18:35:43 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.59 2022/08/09 18:42:40 rillig Exp $
# Written by David Brownlee <abs%netbsd.org@localhost>.
#
@@ -892,20 +892,17 @@
$regex .= '\\+';
} elsif ($_ eq '\\' && @chars > 0) {
my $next = shift @chars;
- $regex .= $next =~ /\w/ ? "$next" : "\\$next";
+ $regex .= $next =~ /\w/ ? $next : "\\$next";
} elsif ($_ eq '.' || $_ eq '|') {
- $regex .= quotemeta;
+ $regex .= "\\$_";
} elsif ($_ eq '{') {
$regex .= '(';
++$alternative_depth;
} elsif ($_ eq '}') {
- if ($alternative_depth == 0) {
- # Error
- return undef;
- }
+ return undef if $alternative_depth == 0;
$regex .= ')';
--$alternative_depth;
- } elsif ($_ eq ',' && $alternative_depth) {
+ } elsif ($_ eq ',' && $alternative_depth > 0) {
$regex .= '|';
} elsif ($_ eq '[') {
$regex .= '[';
Home |
Main Index |
Thread Index |
Old Index