I'm debating which version would be more suitable in parameters of code length, readability and maintenance. This is a portion of a set of functions which together parse a Gif file.Version 1:if ((errno = GifLoadHeaders(g, &bufTemp)) != GIF_SUCCESS) {    GifDispose(g);    *gPtr = NULL;    return errno;}if ((errno = GifLoadGCT(g, &bufTemp)) != GIF_SUCCESS) {    GifDispose(g);    *gPtr = NULL;    return errno;}if ((errno = GifLoadImages(g, &bufTemp)) != GIF_SUCCESS) {    GifDispose(g);    *gPtr = NULL;    return errno;}Version 2:if ((errno = GifLoadHeaders(g, &bufTemp)) != GIF_SUCCESS    || (errno = GifLoadGCT(g, &bufTemp)) != GIF_SUCCESS    || (errno = GifLoadImages(g, &bufTemp)) != GIF_SUCCESS) {    GifDispose(g);    *gPtr = NULL;    return errno;}I generally prefer the latter version. Maybe there's a more optimal third solution to my issue. Any help?EDIT:I'm sorry I did not include the entire routine. The code I've included is used in the function GifParse which initializes a given pointer to a Gif structure, which is named gPtr.
Error handling for function calls to parse a GIF file
c;image;comparative review;error handling
I like your second option better than the first, and I like @DaveJarvis answer best.  There are times when neither of these options is possible or elegant. For example when the called functions have many parameters your 2nd option gets ugly.  And when there is more than one resource, the separate function design can be tricky. Just for the sake of it, here is another option:int status = GifLoadHeaders(g, &buf);if (status == GIF_SUCCESS) {    status = GifLoadGCT(g, &buf);}if (status == GIF_SUCCESS) {    status = GifLoadImages(g, &buf);}if (status != GIF_SUCCESS) {    GifDispose(g);    *gPtr = NULL;    return status;}// etcYou can of course start nesting things, but that usually gets unreadable after a few levels.  My example above might be easier to step through in a debugger than your 2nd option. Note the use of status instead of the global errno.  The errno variable is a bit special and should not normally not be written by you (and certainly not to anything other than 0).  Also I replaced bufTemp with the shorter buf for readability.