Conform to revised coding style for do { ... } while (...);

Spacing change only: put the opening { on a line of its own, not after
the do, so that it lines up with the closing }; and put the while on
the same line as the closing, so as to make clear that we're not
looking at a while (...) { /* empty */ } written as while (...);

Did also include one blank line for clarity of reading.
... and braces, required by our coding standard, round the one-line body of an if inside the do-while's block.