Cleaning up error handling with goto
if(!ex)
- err(1, "unable to allocate memory");
- printf("%s\n", example_get_message(ex));
- if(!example_update_message(ex, "goodbye")) {
- int temperrno = errno;
- example_destroy(ex);
- errno = temperrno;
- err(1, "unable to update");
- }
- printf("%s\n", example_get_message(ex));
+ goto out;