Explorar el Código

internal: Replace SDL_PUSH_ERROR with SDL_PushError.

Reference Issue #15458.
Ryan C. Gordon hace 2 semanas
padre
commit
0bf2fa8978
Se han modificado 3 ficheros con 12 adiciones y 19 borrados
  1. 0 12
      src/SDL_error_c.h
  2. 10 5
      src/SDL_internal.h
  3. 2 2
      src/video/SDL_video.c

+ 0 - 12
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_

+ 10 - 5
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());
-
-#define POP_SDL_ERROR() \
-    SDL_SetError("%s", _error); SDL_free(_error); }
+// Macros to save and restore error values
+#define SDL_PushError() do { \
+    char *saved_error = SDL_strdup(SDL_GetError())
+
+#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

+ 2 - 2
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;
     }