]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchidx: use regexp as first arg for `split' op
authorEric Wong <e@80x24.org>
Mon, 20 Jun 2022 19:27:28 +0000 (19:27 +0000)
committerEric Wong <e@80x24.org>
Tue, 21 Jun 2022 10:39:09 +0000 (10:39 +0000)
Current implementations of Perl5 don't have optimizations for
single-character field separators (unlike another non-Perl5 VM
I'm familiar with).

lib/PublicInbox/SearchIdx.pm

index 85fae4adf8b7f3f81c014776af5cbcd9fe29ef6d..50e260508a2935dc5ed5bd1e6489cf7fb5be763d 100644 (file)
@@ -236,8 +236,8 @@ sub index_old_diff_fn {
 
        # no renames or space support for traditional diffs,
        # find the number of leading common paths to strip:
-       my @fa = split('/', $fa);
-       my @fb = split('/', $fb);
+       my @fa = split(m'/', $fa);
+       my @fb = split(m'/', $fb);
        while (scalar(@fa) && scalar(@fb)) {
                $fa = join('/', @fa);
                $fb = join('/', @fb);
@@ -278,12 +278,12 @@ sub index_diff ($$$) {
                                                        $xnq);
                } elsif (m!^--- ("?[^/]+/.+)!) {
                        my $fn = $1;
-                       $fn = (split('/', git_unquote($fn), 2))[1];
+                       $fn = (split(m'/', git_unquote($fn), 2))[1];
                        $seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq);
                        $in_diff = 1;
                } elsif (m!^\+\+\+ ("?[^/]+/.+)!)  {
                        my $fn = $1;
-                       $fn = (split('/', git_unquote($fn), 2))[1];
+                       $fn = (split(m'/', git_unquote($fn), 2))[1];
                        $seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq);
                        $in_diff = 1;
                } elsif (/^--- (\S+)/) {