img_load_webp: simplify multi-frame allocation

C89 standard specifies:
If ptr is a null pointer, the realloc function behaves like the malloc
function for the specified size.
master
NRK 2021-11-17 06:32:51 +06:00 committed by N-R-K
parent 3b6db44267
commit 22ca3b567d
1 changed files with 1 additions and 4 deletions

View File

@ -348,10 +348,7 @@ static bool img_load_webp(img_t *img, const fileinfo_t *file)
img->w = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
img->h = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
if (img->multi.cap == 0) {
img->multi.cap = info.frame_count;
img->multi.frames = emalloc(img->multi.cap * sizeof(img_frame_t));
} else if (info.frame_count > img->multi.cap) {
if (info.frame_count > img->multi.cap) {
img->multi.cap = info.frame_count;
img->multi.frames = erealloc(img->multi.frames,
img->multi.cap * sizeof(img_frame_t));