From 0bf2fa89784344973bceaa6f6163f46885ebf8e6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 27 Apr 2026 09:33:46 -0400 Subject: [PATCH] internal: Replace SDL_PUSH_ERROR with SDL_PushError. Reference Issue #15458. --- src/SDL_error_c.h | 12 ------------ src/SDL_internal.h | 13 +++++++++---- src/video/SDL_video.c | 4 ++-- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/SDL_error_c.h b/src/SDL_error_c.h index 7d53783d88..2997c10fa3 100644 --- a/src/SDL_error_c.h +++ b/src/SDL_error_c.h @@ -52,16 +52,4 @@ typedef struct SDL_error // Defined in SDL_thread.c extern SDL_error *SDL_GetErrBuf(bool create); -// Macros to save and restore error values -#define SDL_PushError() \ - char *saved_error = SDL_strdup(SDL_GetError()) - -#define SDL_PopError() \ - do { \ - if (saved_error) { \ - SDL_SetError("%s", saved_error); \ - SDL_free(saved_error); \ - } \ - } while (0) - #endif // SDL_error_c_h_ diff --git a/src/SDL_internal.h b/src/SDL_internal.h index 967dab3c67..d8c3b4320f 100644 --- a/src/SDL_internal.h +++ b/src/SDL_internal.h @@ -276,11 +276,16 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode); } while (0) #endif -#define PUSH_SDL_ERROR() \ - { char *_error = SDL_strdup(SDL_GetError()); +// Macros to save and restore error values +#define SDL_PushError() do { \ + char *saved_error = SDL_strdup(SDL_GetError()) -#define POP_SDL_ERROR() \ - SDL_SetError("%s", _error); SDL_free(_error); } +#define SDL_PopError() \ + if (saved_error) { \ + SDL_SetError("%s", saved_error); \ + SDL_free(saved_error); \ + } \ +} while (0) #if defined(SDL_DISABLE_INVALID_PARAMS) #ifdef DEBUG diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 8308eba5d9..0a387fad2a 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2584,9 +2584,9 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props) SDL_UpdateWindowHierarchy(window, parent); if (_this->CreateSDLWindow && !_this->CreateSDLWindow(_this, window, props)) { - PUSH_SDL_ERROR() + SDL_PushError(); SDL_DestroyWindow(window); - POP_SDL_ERROR() + SDL_PopError(); return NULL; }