From 1ee075debf6e52e895455cceca51b36256b99cbd Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 8 May 2024 20:01:04 +0300 Subject: [PATCH] remove most of SDL_OutOfMemory() calls where SDL is the allocator. Since SDL3 commit 447b508a77b8601d23ca48cf189fe4436ab33572, SDL_malloc, SDL_calloc, and SDL_realloc already calls SDL_OutOfMemory(). Note: Not touching SDL_stack_alloc cases: @slouken noted that on some platforms alloca() can return NULL, so SDL_OutOfMemory() is the correct thing to do in that case. and it doesn't hurt to call it twice. --- src/SDL_ttf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c index 15222b3f..0bd35509 100644 --- a/src/SDL_ttf.c +++ b/src/SDL_ttf.c @@ -3788,7 +3788,6 @@ static SDL_Surface* TTF_Render_Wrapped_Internal(TTF_Font *font, const char *text strLines = (char **)SDL_realloc(strLines, maxNumLines * sizeof (*strLines)); if (strLines == NULL) { strLines = saved; - SDL_OutOfMemory(); goto failure; } }