Fix Mac build.

- Result of comparison against a string literal is unspecified (use strncmp instead).
- Explicit destructors.
- Invalid conversion NULL -> bool.