cmp_mem() improvements

I've implemented the improvements you proposed in your comments for #10

- NULL for got and expected is handled
- reworked logic so `memcmp()` is not needed
- cosmetic fix in diagnostics