diff options
author | Eric Wong <e@80x24.org> | 2022-08-04 08:17:01 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-08-04 20:09:35 +0000 |
commit | 956fa442de1699e078cc7babb7a34af83d143307 (patch) | |
tree | fb039457a4d215bdea30deb4c6f49d84df3e6beb | |
parent | fca813000ce319e9a320f0fdc9ee7272810f8833 (diff) | |
download | public-inbox-956fa442de1699e078cc7babb7a34af83d143307.tar.gz |
We can reduce ops and temporary objects here by folding the stringification into the `for' loop and push directly into the {mailboxlist} array; relying on autovivification to turn it into a noop for the initial population.
-rw-r--r-- | lib/PublicInbox/IMAP.pm | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 9955984b..bed633e5 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -354,17 +354,14 @@ sub ensure_slices_exist ($$) { my ($imapd, $ibx) = @_; my $mb_top = $ibx->{newsgroup} // return; my $mailboxes = $imapd->{mailboxes}; - my @created; + my $list = $imapd->{mailboxlist}; # may be undef, just autoviv + noop for (my $i = int($ibx->art_max/UID_SLICE); $i >= 0; --$i) { my $sub_mailbox = "$mb_top.$i"; last if exists $mailboxes->{$sub_mailbox}; $mailboxes->{$sub_mailbox} = $ibx; $sub_mailbox =~ s/\Ainbox\./INBOX./i; # more familiar to users - push @created, $sub_mailbox; + push @$list, qq[* LIST (\\HasNoChildren) "." $sub_mailbox\r\n] } - return unless @created; - my $l = $imapd->{mailboxlist} or return; - push @$l, map { qq[* LIST (\\HasNoChildren) "." $_\r\n] } @created; } sub inbox_lookup ($$;$) { |