src/SDL.c
changeset 6927 982b03203b73
parent 6924 5be9b933146a
child 7009 161b7b6a5303
     1.1 --- a/src/SDL.c	Mon Feb 25 16:52:52 2013 -0800
     1.2 +++ b/src/SDL.c	Mon Feb 25 16:52:54 2013 -0800
     1.3 @@ -68,14 +68,9 @@
     1.4  
     1.5  /* Private helper to check if a system needs init. */
     1.6  static SDL_bool
     1.7 -SDL_PrivateShouldInitSubsystem(Uint32 flags, Uint32 subsystem)
     1.8 +SDL_PrivateShouldInitSubsystem(Uint32 subsystem)
     1.9  {
    1.10 -    int subsystem_index;
    1.11 -    if ((flags & subsystem) == 0) {
    1.12 -      return SDL_FALSE;
    1.13 -    }
    1.14 -
    1.15 -    subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
    1.16 +    int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
    1.17      SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
    1.18      return (SDL_SubsystemRefCount[subsystem_index] == 0);
    1.19  }
    1.20 @@ -106,8 +101,8 @@
    1.21  
    1.22      /* Initialize the timer subsystem */
    1.23      if ((flags & SDL_INIT_TIMER) ){
    1.24 -        if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_TIMER)) {
    1.25  #if !SDL_TIMERS_DISABLED
    1.26 +        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) {
    1.27              if (SDL_TimerInit() < 0) {
    1.28                  return (-1);
    1.29              }
    1.30 @@ -121,8 +116,8 @@
    1.31  
    1.32      /* Initialize the video/event subsystem */
    1.33      if ((flags & SDL_INIT_VIDEO) ){
    1.34 -        if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_VIDEO)) {
    1.35  #if !SDL_VIDEO_DISABLED
    1.36 +        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) {
    1.37              if (SDL_VideoInit(NULL) < 0) {
    1.38                  return (-1);
    1.39              }
    1.40 @@ -136,8 +131,8 @@
    1.41  
    1.42      /* Initialize the audio subsystem */
    1.43      if ((flags & SDL_INIT_AUDIO) ){
    1.44 -        if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_AUDIO)) {
    1.45  #if !SDL_AUDIO_DISABLED
    1.46 +        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) {
    1.47              if (SDL_AudioInit(NULL) < 0) {
    1.48                  return (-1);
    1.49              }
    1.50 @@ -156,8 +151,8 @@
    1.51  
    1.52      /* Initialize the joystick subsystem */
    1.53      if ((flags & SDL_INIT_JOYSTICK) ){
    1.54 -        if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_JOYSTICK)) {
    1.55  #if !SDL_JOYSTICK_DISABLED
    1.56 +        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
    1.57             if (SDL_JoystickInit() < 0) {
    1.58                 return (-1);
    1.59             }
    1.60 @@ -170,8 +165,8 @@
    1.61      }
    1.62  
    1.63      if ((flags & SDL_INIT_GAMECONTROLLER) ){
    1.64 -        if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_GAMECONTROLLER)) {
    1.65  #if !SDL_JOYSTICK_DISABLED
    1.66 +        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) {
    1.67              if (SDL_GameControllerInit() < 0) {
    1.68                  return (-1);
    1.69              }
    1.70 @@ -185,11 +180,11 @@
    1.71  
    1.72      /* Initialize the haptic subsystem */
    1.73      if ((flags & SDL_INIT_HAPTIC) ){
    1.74 -        if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_HAPTIC)) {
    1.75  #if !SDL_HAPTIC_DISABLED
    1.76 +        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) {
    1.77              if (SDL_HapticInit() < 0) {
    1.78 -             return (-1);
    1.79 -         }
    1.80 +                return (-1);
    1.81 +            }
    1.82          }
    1.83          SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC);
    1.84  #else
    1.85 @@ -441,4 +436,4 @@
    1.86  
    1.87  #endif /* __WIN32__ */
    1.88  
    1.89 -/* vi: set ts=4 sw=4 expandtab: */
    1.90 +/* vi: set sts=4 ts=4 sw=4 expandtab: */