diff options
author | NRK <nrk@disroot.org> | 2021-11-17 06:32:51 +0600 |
---|---|---|
committer | N-R-K <79544946+N-R-K@users.noreply.github.com> | 2021-12-12 17:58:17 +0600 |
commit | 22ca3b567dd08c0086399221cb1413fa4eb74e2e (patch) | |
tree | f6fda105cc5ca31a1f5ca1d2e4469a4221c55645 | |
parent | 3b6db44267438fb0f9d67b3783d3bc6713c3c07f (diff) |
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.
-rw-r--r-- | image.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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)); |