]> Sergey Matveev's repositories - public-inbox.git/commitdiff
over: get_xref3: modify rows in-place
authorEric Wong <e@80x24.org>
Thu, 4 Aug 2022 08:16:58 +0000 (08:16 +0000)
committerEric Wong <e@80x24.org>
Thu, 4 Aug 2022 20:09:33 +0000 (20:09 +0000)
There's no need to create two intermediate arrays when we can
modify the existing arrayref.

lib/PublicInbox/Over.pm

index 786f9d922282ea3358c7664462ceb8b591d05e4d..d6409b2a5fdb2017a69344aed92e60be77b2eb44 100644 (file)
@@ -273,13 +273,13 @@ SELECT ibx_id,xnum,oidbin FROM xref3 WHERE docid = ? ORDER BY ibx_id,xnum ASC
        my $eidx_key_sth = $dbh->prepare_cached(<<'', undef, 1);
 SELECT eidx_key FROM inboxes WHERE ibx_id = ?
 
-       [ map {
-               my $r = $_;
+       for my $r (@$rows) {
                $eidx_key_sth->execute($r->[0]);
                my $eidx_key = $eidx_key_sth->fetchrow_array;
                $eidx_key //= "missing://ibx_id=$r->[0]";
-               "$eidx_key:$r->[1]:".unpack('H*', $r->[2]);
-       } @$rows ];
+               $r = "$eidx_key:$r->[1]:".unpack('H*', $r->[2]);
+       }
+       $rows;
 }
 
 sub next_by_mid {