Skip to content

Commit 0bf2fa8

Browse files
committed
internal: Replace SDL_PUSH_ERROR with SDL_PushError.
Reference Issue #15458.
1 parent c46dfdb commit 0bf2fa8

3 files changed

Lines changed: 12 additions & 19 deletions

File tree

src/SDL_error_c.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,4 @@ typedef struct SDL_error
5252
// Defined in SDL_thread.c
5353
extern SDL_error *SDL_GetErrBuf(bool create);
5454

55-
// Macros to save and restore error values
56-
#define SDL_PushError() \
57-
char *saved_error = SDL_strdup(SDL_GetError())
58-
59-
#define SDL_PopError() \
60-
do { \
61-
if (saved_error) { \
62-
SDL_SetError("%s", saved_error); \
63-
SDL_free(saved_error); \
64-
} \
65-
} while (0)
66-
6755
#endif // SDL_error_c_h_

src/SDL_internal.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,16 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
276276
} while (0)
277277
#endif
278278

279-
#define PUSH_SDL_ERROR() \
280-
{ char *_error = SDL_strdup(SDL_GetError());
281-
282-
#define POP_SDL_ERROR() \
283-
SDL_SetError("%s", _error); SDL_free(_error); }
279+
// Macros to save and restore error values
280+
#define SDL_PushError() do { \
281+
char *saved_error = SDL_strdup(SDL_GetError())
282+
283+
#define SDL_PopError() \
284+
if (saved_error) { \
285+
SDL_SetError("%s", saved_error); \
286+
SDL_free(saved_error); \
287+
} \
288+
} while (0)
284289

285290
#if defined(SDL_DISABLE_INVALID_PARAMS)
286291
#ifdef DEBUG

src/video/SDL_video.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,9 +2584,9 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
25842584
SDL_UpdateWindowHierarchy(window, parent);
25852585

25862586
if (_this->CreateSDLWindow && !_this->CreateSDLWindow(_this, window, props)) {
2587-
PUSH_SDL_ERROR()
2587+
SDL_PushError();
25882588
SDL_DestroyWindow(window);
2589-
POP_SDL_ERROR()
2589+
SDL_PopError();
25902590
return NULL;
25912591
}
25922592

0 commit comments

Comments
 (0)