On Thu Oct 12 11:40:12 2023 +0000, Nikolay Sivov wrote:
I thought FOR_EACH_ENTRY_SAFE() is not safe enough if I'm going to remove 'instr', and potentially 'next' and past it.
I don't think that's a problem: the pointers will become dangling, but that's not a problem as long as you don't dereference them (which you do not, given that you immediately break out of the loop). If you like it better, you can also break out of the loop before slicing and slice (and deallocate) after the loop.
Well, you can also leave it like it is, it's not broken. Just a bit slower than it could be.