]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
hval: use File::Spec::Functions::abs2rel
authorEric Wong <e@80x24.org>
Tue, 12 Nov 2024 20:34:32 +0000 (20:34 +0000)
committerEric Wong <e@80x24.org>
Fri, 15 Nov 2024 20:27:38 +0000 (20:27 +0000)
Function calls are faster than method dispatch and abs2rel() may
be called hundreds/thousands of times when listing associated
inboxes||coderepos.

lib/PublicInbox/Hval.pm

index 963dbb7150a81b64aa87429a77a014c254558d24..d44b656217c1168cb8c4587a5751828299b7ea43 100644 (file)
@@ -13,7 +13,7 @@ our @EXPORT_OK = qw/ascii_html obfuscate_addrs to_filename src_escape
                to_attr prurl mid_href fmt_ts ts2str utf8_maybe/;
 use POSIX qw(strftime);
 my $enc_ascii = find_encoding('us-ascii');
-use File::Spec;
+use File::Spec::Functions qw(abs2rel);
 
 # safe-ish acceptable filename pattern for portability
 our $FN = '[a-zA-Z0-9][a-zA-Z0-9_\-\.]+[a-zA-Z0-9]'; # needs \z anchor
@@ -76,7 +76,7 @@ sub prurl ($$) {
        } elsif ($dslash < 0 && substr($u, 0, 1) ne '/' &&
                        substr(my $path = $env->{PATH_INFO}, 0, 1) eq '/') {
                # this won't touch the FS at all:
-               File::Spec->abs2rel("/$u", $path);
+               abs2rel "/$u", $path;
        } else {
                $u;
        }