SDL: SDL_CloseJoystick() should return void, not int

From e65e2c8ed7a849e6502d2c98f8e822c409968e20 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 9 Feb 2023 17:25:57 -0800
Subject: [PATCH] SDL_CloseJoystick() should return void, not int

---
 include/SDL3/SDL_joystick.h   | 4 +---
 src/dynapi/SDL_dynapi_procs.h | 2 +-
 src/joystick/SDL_joystick.c   | 7 +++----
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/include/SDL3/SDL_joystick.h b/include/SDL3/SDL_joystick.h
index 0ef2235f1caf..b2389ccf5e88 100644
--- a/include/SDL3/SDL_joystick.h
+++ b/include/SDL3/SDL_joystick.h
@@ -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.
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index a1e9c252147a..4b66477b6806 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -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)
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index f5556a316255..75db4b7651f9 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -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)