Fix evaluation order issue

clang gets unhappy about uninitialized values here.
Allocate space for NUL byte in test code

Caught by ASan.
Fix condition with empty body

Found by clang's warnings.
Address some obvious clang warnings

There's a bunch, but these seemed pretty obvious.