From f34113de515522dd76709403be5015698c6fbd29 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Tue, 24 May 2022 22:07:47 +0200 Subject: Use realloc(3) directly It is simply not true realloc(3) cannot be used with NULL pointers. --- src/gfx/sdl-1.2/src/env.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/gfx/sdl-1.2/src/env.c b/src/gfx/sdl-1.2/src/env.c index d77503d..18cfe95 100644 --- a/src/gfx/sdl-1.2/src/env.c +++ b/src/gfx/sdl-1.2/src/env.c @@ -27,13 +27,7 @@ static struct void gfx_register_sprite(struct sprite *const s) { - /* realloc(3) could had been used directly, but Win9x relies on - * a C89/C90 library implementation, where calling realloc(3) - * with a NULL pointer is undefined behaviour. */ - if (!list) - list = malloc(sizeof *list); - else - list = realloc(list, (list_len + 1) * sizeof *list); + list = realloc(list, (list_len + 1) * sizeof *list); if (list) list[list_len++] = s; -- cgit v1.2.3