Removed SDL_INIT_EVERYTHING

Fixes https://github.com/libsdl-org/SDL/issues/8709
main
Sam Lantinga 2024-01-18 03:51:56 -08:00
parent 26996e2c02
commit c540c77756
7 changed files with 11 additions and 12 deletions

View File

@ -3,6 +3,6 @@
void inc_sdl_noslash(void) { void inc_sdl_noslash(void) {
SDL_SetMainReady(); SDL_SetMainReady();
SDL_Init(SDL_INIT_EVERYTHING); SDL_Init(0);
SDL_Quit(); SDL_Quit();
} }

View File

@ -3,6 +3,6 @@
void inc_sdl_slash(void) { void inc_sdl_slash(void) {
SDL_SetMainReady(); SDL_SetMainReady();
SDL_Init(SDL_INIT_EVERYTHING); SDL_Init(0);
SDL_Quit(); SDL_Quit();
} }

View File

@ -716,6 +716,7 @@ The following symbols have been renamed:
The following symbols have been removed: The following symbols have been removed:
* SDL_INIT_NOPARACHUTE * SDL_INIT_NOPARACHUTE
* SDL_INIT_EVERYTHING - you should only initialize the subsystems you are using
## SDL_joystick.h ## SDL_joystick.h

View File

@ -61,10 +61,6 @@ typedef enum
SDL_INIT_EVENTS = 0x00004000, SDL_INIT_EVENTS = 0x00004000,
SDL_INIT_SENSOR = 0x00008000 SDL_INIT_SENSOR = 0x00008000
} SDL_InitFlags; } SDL_InitFlags;
#define SDL_INIT_EVERYTHING ( \
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMEPAD | SDL_INIT_SENSOR \
)
/** /**
* Initialize the SDL library. * Initialize the SDL library.
@ -94,7 +90,7 @@ typedef enum
* - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically initializes the * - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically initializes the
* joystick subsystem * joystick subsystem
* - `SDL_INIT_EVENTS`: events subsystem * - `SDL_INIT_EVENTS`: events subsystem
* - `SDL_INIT_EVERYTHING`: all of the above subsystems * - `SDL_INIT_SENSOR`: sensor subsystem
* *
* Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem() * Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem()
* for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or * for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or

View File

@ -47,6 +47,8 @@
#include "joystick/SDL_joystick_c.h" #include "joystick/SDL_joystick_c.h"
#include "sensor/SDL_sensor_c.h" #include "sensor/SDL_sensor_c.h"
#define SDL_INIT_EVERYTHING ~0U
/* Initialization/Cleanup routines */ /* Initialization/Cleanup routines */
#include "timer/SDL_timer_c.h" #include "timer/SDL_timer_c.h"
#ifdef SDL_VIDEO_DRIVER_WINDOWS #ifdef SDL_VIDEO_DRIVER_WINDOWS

View File

@ -256,12 +256,12 @@ static int platform_testDefaultInit(void *arg)
int ret; int ret;
int subsystem; int subsystem;
subsystem = SDL_WasInit(SDL_INIT_EVERYTHING); subsystem = SDL_WasInit(0);
SDLTest_AssertCheck(subsystem != 0, SDLTest_AssertCheck(subsystem != 0,
"SDL_WasInit(0): returned %i, expected != 0", "SDL_WasInit(0): returned %i, expected != 0",
subsystem); subsystem);
ret = SDL_Init(SDL_WasInit(SDL_INIT_EVERYTHING)); ret = SDL_Init(0);
SDLTest_AssertCheck(ret == 0, SDLTest_AssertCheck(ret == 0,
"SDL_Init(0): returned %i, expected 0, error: %s", "SDL_Init(0): returned %i, expected 0, error: %s",
ret, ret,

View File

@ -15,12 +15,12 @@ static void subsystemsSetUp(void *arg)
/* CHECKME: can we use SDL_Quit here, or this will break the flow of tests? */ /* CHECKME: can we use SDL_Quit here, or this will break the flow of tests? */
SDL_Quit(); SDL_Quit();
/* Alternate variant without SDL_Quit: /* Alternate variant without SDL_Quit:
while (SDL_WasInit(SDL_INIT_EVERYTHING) != 0) { while (SDL_WasInit(0) != 0) {
SDL_QuitSubSystem(SDL_INIT_EVERYTHING); SDL_QuitSubSystem(~0U);
} }
*/ */
SDLTest_AssertPass("Reset all subsystems before subsystems test"); SDLTest_AssertPass("Reset all subsystems before subsystems test");
SDLTest_AssertCheck(SDL_WasInit(SDL_INIT_EVERYTHING) == 0, "Check result from SDL_WasInit(SDL_INIT_EVERYTHING)"); SDLTest_AssertCheck(SDL_WasInit(0) == 0, "Check result from SDL_WasInit(0)");
} }
static void subsystemsTearDown(void *arg) static void subsystemsTearDown(void *arg)