Refactor error checking helpers to use macros.

Performance difference is probably negligible as they're out of hot code
sections, but simplifies the code a bit and avoids calling functions
like SDL_GetError() when there's no error, which could plausibly have
unintended consequences.