Cleaned up some code and comments.

There should be no impacting changes in this commit.
Simplified some of the GUID code.

This change applies some recommendations from jralls. It better utilizes for loops,
and usage of swap. We also try to make sure the null guid is not freed since it's
reused, and catch a c++ exception to make sure it doens't escape into C code when
parsing a GUID.
Added new tests.

Added tests for string_to_guid and guid_replace.