]> Sergey Matveev's repositories - public-inbox.git/commitdiff
ds: guard ToClose against DESTROY side-effects
authorEric Wong <e@yhbt.net>
Sun, 12 Jan 2020 21:17:50 +0000 (21:17 +0000)
committerEric Wong <e@yhbt.net>
Mon, 13 Jan 2020 23:21:24 +0000 (23:21 +0000)
This does not affect our current code, but theoretically a
DESTROY callback could call PublicInbox::DS::close to enqueue
elements into the ToClose array.  So take a similar strategy as
we do with other queues (e.g. $nextq) by swapping references to
arrays, rather than operating on the array itself.

Since close operations are relatively rare, we can rely on
auto-vivification via "push" ops to create the array on an
as-needed basis.

Since we're in the area, clean up the PostLoopCallback
invocation to use the ternary operator rather than a confusing
(to me) combination of statements.

Finally, add a prototype to strengthen compile-time checking,
and move it in front of our only caller to make use of
the prototype.


No differences found