Eliminate unnecessary NULL checks before tjFree()

+ document that tjFree() accepts NULL pointers without complaint.
Effectively, it has had that behavior all along, but the API does not
guarantee that tjFree() will be implemented with free() behind the
scenes, so it's best to formalize the behavior.
This commit is contained in:
DRC
2020-01-08 14:22:35 -06:00
parent fdf8903354
commit 00607ec260
7 changed files with 19 additions and 18 deletions

View File

@@ -550,7 +550,7 @@ static void doTest(int w, int h, const int *formats, int nformats, int subsamp,
bailout:
if (chandle) tjDestroy(chandle);
if (dhandle) tjDestroy(dhandle);
if (dstBuf) tjFree(dstBuf);
tjFree(dstBuf);
}
@@ -666,7 +666,7 @@ static void bufSizeTest(void)
bailout:
free(srcBuf);
if (dstBuf) tjFree(dstBuf);
tjFree(dstBuf);
if (handle) tjDestroy(handle);
}
@@ -839,7 +839,7 @@ static int doBmpTest(const char *ext, int width, int align, int height, int pf,
unlink(filename);
bailout:
if (buf) tjFree(buf);
tjFree(buf);
if (exitStatus < 0) return exitStatus;
return retval;
}