You can change it to `while (1)` and `break` out of the loop if the following for-loop does not find anything to do. That way, you do not need to check twice if there is something still to do.