
3 Apr
2022
3 Apr
'22
9:45 a.m.
I found this same problem with some ASAN experiments I've been playing with, and addressed it in the same way.
I don't see good solution. :-(
There's always the option of reverting the refactor as it applies to just a small number of cases and is making it harder to write the correct logic.
Maybe moving to dev as a loop variable and having NULL terminated arrays should fix that.
Doing this just to fix the syntactic sugar feels like addressing the wrong problem.
For now probably your solution is a good compromise. But, please rewrite it to have all three more visible in a for-loop:
for (i = 0; \ i < cd_count[file] && (dev = console_devices[file][i]); \ i++)
With reformatting
Reviewed-by: Andrew Scull ascull@google.com