Merge "muxedit: remove a few redundant NULL checks"

This commit is contained in:
pascal massimino 2012-04-28 02:50:27 -07:00 committed by Gerrit Code Review
commit 82654f961d

View File

@ -29,7 +29,8 @@ static void MuxInit(WebPMux* const mux) {
WebPMux* WebPNewInternal(int version) { WebPMux* WebPNewInternal(int version) {
WebPMux* const mux = (version == WEBP_MUX_ABI_VERSION) ? WebPMux* const mux = (version == WEBP_MUX_ABI_VERSION) ?
(WebPMux*)malloc(sizeof(WebPMux)) : NULL; (WebPMux*)malloc(sizeof(WebPMux)) : NULL;
if (mux) MuxInit(mux); // If mux is NULL MuxInit is a noop.
MuxInit(mux);
return mux; return mux;
} }
@ -75,7 +76,7 @@ static WebPMuxError MuxSet(WebPMux* const mux, TAG_ID id, uint32_t nth,
WebPImageInfo* image_info, int copy_data) { WebPImageInfo* image_info, int copy_data) {
WebPChunk chunk; WebPChunk chunk;
WebPMuxError err = WEBP_MUX_NOT_FOUND; WebPMuxError err = WEBP_MUX_NOT_FOUND;
if (mux == NULL) return WEBP_MUX_INVALID_ARGUMENT; assert(mux != NULL);
assert(!IsWPI(id)); assert(!IsWPI(id));
ChunkInit(&chunk); ChunkInit(&chunk);