Simplify flags testing (#7220)

This commit is contained in:
Sylvain Becker
2023-02-03 22:08:42 +01:00
committed by GitHub
parent dcd17f5473
commit cb6b8b0132
46 changed files with 218 additions and 218 deletions

View File

@@ -175,18 +175,18 @@ int SDL_InitSubSystem(Uint32 flags)
SDL_DBus_Init();
#endif
if ((flags & SDL_INIT_GAMEPAD)) {
if (flags & SDL_INIT_GAMEPAD) {
/* game controller implies joystick */
flags |= SDL_INIT_JOYSTICK;
}
if ((flags & (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO))) {
if (flags & (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO)) {
/* video or joystick or audio implies events */
flags |= SDL_INIT_EVENTS;
}
#if SDL_VIDEO_DRIVER_WINDOWS
if ((flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK))) {
if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) {
if (SDL_HelperWindowCreate() < 0) {
goto quit_and_error;
}
@@ -198,7 +198,7 @@ int SDL_InitSubSystem(Uint32 flags)
#endif
/* Initialize the event subsystem */
if ((flags & SDL_INIT_EVENTS)) {
if (flags & SDL_INIT_EVENTS) {
#if !SDL_EVENTS_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_EVENTS)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_EVENTS);
@@ -217,7 +217,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the timer subsystem */
if ((flags & SDL_INIT_TIMER)) {
if (flags & SDL_INIT_TIMER) {
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY
if (SDL_ShouldInitSubsystem(SDL_INIT_TIMER)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_TIMER);
@@ -236,7 +236,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the video subsystem */
if ((flags & SDL_INIT_VIDEO)) {
if (flags & SDL_INIT_VIDEO) {
#if !SDL_VIDEO_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_VIDEO)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_VIDEO);
@@ -255,7 +255,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the audio subsystem */
if ((flags & SDL_INIT_AUDIO)) {
if (flags & SDL_INIT_AUDIO) {
#if !SDL_AUDIO_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_AUDIO)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_AUDIO);
@@ -274,7 +274,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the joystick subsystem */
if ((flags & SDL_INIT_JOYSTICK)) {
if (flags & SDL_INIT_JOYSTICK) {
#if !SDL_JOYSTICK_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_JOYSTICK);
@@ -292,7 +292,7 @@ int SDL_InitSubSystem(Uint32 flags)
#endif
}
if ((flags & SDL_INIT_GAMEPAD)) {
if (flags & SDL_INIT_GAMEPAD) {
#if !SDL_JOYSTICK_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_GAMEPAD)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_GAMEPAD);
@@ -311,7 +311,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the haptic subsystem */
if ((flags & SDL_INIT_HAPTIC)) {
if (flags & SDL_INIT_HAPTIC) {
#if !SDL_HAPTIC_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_HAPTIC)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_HAPTIC);
@@ -330,7 +330,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the sensor subsystem */
if ((flags & SDL_INIT_SENSOR)) {
if (flags & SDL_INIT_SENSOR) {
#if !SDL_SENSOR_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_SENSOR)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_SENSOR);
@@ -366,7 +366,7 @@ void SDL_QuitSubSystem(Uint32 flags)
{
/* Shut down requested initialized subsystems */
#if !SDL_SENSOR_DISABLED
if ((flags & SDL_INIT_SENSOR)) {
if (flags & SDL_INIT_SENSOR) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_SENSOR)) {
SDL_QuitSensors();
}
@@ -375,7 +375,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_JOYSTICK_DISABLED
if ((flags & SDL_INIT_GAMEPAD)) {
if (flags & SDL_INIT_GAMEPAD) {
/* game controller implies joystick */
flags |= SDL_INIT_JOYSTICK;
@@ -385,7 +385,7 @@ void SDL_QuitSubSystem(Uint32 flags)
SDL_DecrementSubsystemRefCount(SDL_INIT_GAMEPAD);
}
if ((flags & SDL_INIT_JOYSTICK)) {
if (flags & SDL_INIT_JOYSTICK) {
/* joystick implies events */
flags |= SDL_INIT_EVENTS;
@@ -397,7 +397,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_HAPTIC_DISABLED
if ((flags & SDL_INIT_HAPTIC)) {
if (flags & SDL_INIT_HAPTIC) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_HAPTIC)) {
SDL_QuitHaptics();
}
@@ -406,7 +406,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_AUDIO_DISABLED
if ((flags & SDL_INIT_AUDIO)) {
if (flags & SDL_INIT_AUDIO) {
/* audio implies events */
flags |= SDL_INIT_EVENTS;
@@ -418,7 +418,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_VIDEO_DISABLED
if ((flags & SDL_INIT_VIDEO)) {
if (flags & SDL_INIT_VIDEO) {
/* video implies events */
flags |= SDL_INIT_EVENTS;
@@ -430,7 +430,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY
if ((flags & SDL_INIT_TIMER)) {
if (flags & SDL_INIT_TIMER) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_TIMER)) {
SDL_QuitTimers();
}
@@ -439,7 +439,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_EVENTS_DISABLED
if ((flags & SDL_INIT_EVENTS)) {
if (flags & SDL_INIT_EVENTS) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) {
SDL_QuitEvents();
}