SDL_CloseJoystick() should return void, not int

This commit is contained in:
Sam Lantinga 2023-02-09 17:25:57 -08:00
parent 9ff15e5382
commit e65e2c8ed7
3 changed files with 5 additions and 8 deletions

View file

@ -970,14 +970,12 @@ extern DECLSPEC int SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const
* Close a joystick previously opened with SDL_OpenJoystick().
*
* \param joystick The joystick device to close
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_OpenJoystick
*/
extern DECLSPEC int SDLCALL SDL_CloseJoystick(SDL_Joystick *joystick);
extern DECLSPEC void SDLCALL SDL_CloseJoystick(SDL_Joystick *joystick);
/**
* Get the battery level of a joystick as SDL_JoystickPowerLevel.

View file

@ -146,7 +146,7 @@ SDL_DYNAPI_PROC(void,SDL_ClearHints,(void),(),)
SDL_DYNAPI_PROC(int,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),return)
SDL_DYNAPI_PROC(void,SDL_CloseAudioDevice,(SDL_AudioDeviceID a),(a),)
SDL_DYNAPI_PROC(void,SDL_CloseGamepad,(SDL_Gamepad *a),(a),)
SDL_DYNAPI_PROC(int,SDL_CloseJoystick,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_CloseJoystick,(SDL_Joystick *a),(a),)
SDL_DYNAPI_PROC(void,SDL_CloseSensor,(SDL_Sensor *a),(a),)
SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(int,SDL_CondBroadcast,(SDL_cond *a),(a),return)

View file

@ -1217,7 +1217,7 @@ int SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size)
/*
* Close a joystick previously opened with SDL_OpenJoystick()
*/
int SDL_CloseJoystick(SDL_Joystick *joystick)
void SDL_CloseJoystick(SDL_Joystick *joystick)
{
SDL_Joystick *joysticklist;
SDL_Joystick *joysticklistprev;
@ -1225,12 +1225,12 @@ int SDL_CloseJoystick(SDL_Joystick *joystick)
SDL_LockJoysticks();
{
CHECK_JOYSTICK_MAGIC(joystick, -1);
CHECK_JOYSTICK_MAGIC(joystick,);
/* First decrement ref count */
if (--joystick->ref_count > 0) {
SDL_UnlockJoysticks();
return 0;
return;
}
if (joystick->rumble_expiration) {
@ -1277,7 +1277,6 @@ int SDL_CloseJoystick(SDL_Joystick *joystick)
SDL_free(joystick);
}
SDL_UnlockJoysticks();
return 0;
}
void SDL_QuitJoysticks(void)