internal: Replace SDL_PUSH_ERROR with SDL_PushError.

Reference Issue #15458.
This commit is contained in:
Ryan C. Gordon
2026-04-27 09:33:46 -04:00
parent c46dfdba54
commit 0bf2fa8978
3 changed files with 11 additions and 18 deletions

View File

@@ -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_

View File

@@ -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

View File

@@ -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;
}