Remove returns int from Destroy/Close/Unlock functions

This commit is contained in:
Sylvain 2023-02-09 16:53:47 +01:00 committed by Sam Lantinga
parent 3bd737d44c
commit e2e5e670bf
9 changed files with 31 additions and 50 deletions

View file

@ -1094,14 +1094,12 @@ extern DECLSPEC int SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
* This function should be paired with a previous SDL_LockAudioDevice() call.
*
* \param dev the ID of the device to be unlocked
* \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_LockAudioDevice
*/
extern DECLSPEC int SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
/* @} *//* Audio lock functions */
/**
@ -1121,14 +1119,12 @@ extern DECLSPEC int SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
* for reuse in a new SDL_OpenAudioDevice() call immediately.
*
* \param dev an audio device previously opened with SDL_OpenAudioDevice()
* \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_OpenAudioDevice
*/
extern DECLSPEC int SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
/**
* Convert some audio data of one format to another format.

View file

@ -416,14 +416,12 @@ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_CreatePixelFormat(Uint32 pixel_for
* Free an SDL_PixelFormat structure allocated by SDL_CreatePixelFormat().
*
* \param format the SDL_PixelFormat structure to free
* \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_CreatePixelFormat
*/
extern DECLSPEC int SDLCALL SDL_DestroyPixelFormat(SDL_PixelFormat *format);
extern DECLSPEC void SDLCALL SDL_DestroyPixelFormat(SDL_PixelFormat *format);
/**
* Create a palette structure with the specified number of color entries.
@ -480,14 +478,12 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
* Free a palette created with SDL_CreatePalette().
*
* \param palette the SDL_Palette structure to be freed
* \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_CreatePalette
*/
extern DECLSPEC int SDLCALL SDL_DestroyPalette(SDL_Palette * palette);
extern DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette * palette);
/**
* Map an RGB triple to an opaque pixel value for a given pixel format.

View file

@ -1439,15 +1439,13 @@ extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
* to "Invalid texture".
*
* \param texture the texture to destroy
* \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_CreateTexture
* \sa SDL_CreateTextureFromSurface
*/
extern DECLSPEC int SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
/**
* Destroy the rendering context for a window and free associated textures.
@ -1456,14 +1454,12 @@ extern DECLSPEC int SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
* the SDL error message to "Invalid renderer". See SDL_GetError().
*
* \param renderer the rendering context
* \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_CreateRenderer
*/
extern DECLSPEC int SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
/**
* Force the rendering context to flush any pending commands to the underlying

View file

@ -1527,15 +1527,13 @@ extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOperati
* the SDL error message to "Invalid window". See SDL_GetError().
*
* \param window the window to destroy
* \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_CreateWindow
* \sa SDL_CreateWindowFrom
*/
extern DECLSPEC int SDLCALL SDL_DestroyWindow(SDL_Window *window);
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window);
/**

View file

@ -1553,25 +1553,23 @@ int SDL_LockAudioDevice(SDL_AudioDeviceID devid)
return 0;
}
int SDL_UnlockAudioDevice(SDL_AudioDeviceID devid)
void SDL_UnlockAudioDevice(SDL_AudioDeviceID devid)
{
/* Obtain a lock on the mixing buffers */
SDL_AudioDevice *device = get_audio_device(devid);
if (!device) {
return SDL_InvalidParamError("devid");
return;
}
current_audio.impl.UnlockDevice(device);
return 0;
}
int SDL_CloseAudioDevice(SDL_AudioDeviceID devid)
void SDL_CloseAudioDevice(SDL_AudioDeviceID devid)
{
SDL_AudioDevice *device = get_audio_device(devid);
if (!device) {
return SDL_InvalidParamError("devid");
return;
}
close_audio_device(device);
return 0;
}
void SDL_QuitAudio(void)

View file

@ -144,7 +144,7 @@ SDL_DYNAPI_PROC(void,SDL_ClearComposition,(void),(),)
SDL_DYNAPI_PROC(void,SDL_ClearError,(void),(),)
SDL_DYNAPI_PROC(void,SDL_ClearHints,(void),(),)
SDL_DYNAPI_PROC(int,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),return)
SDL_DYNAPI_PROC(int,SDL_CloseAudioDevice,(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_CloseSensor,(SDL_Sensor *a),(a),)
@ -184,13 +184,13 @@ SDL_DYNAPI_PROC(Uint32,SDL_DequeueAudio,(SDL_AudioDeviceID a, void *b, Uint32 c)
SDL_DYNAPI_PROC(void,SDL_DestroyAudioStream,(SDL_AudioStream *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyCond,(SDL_cond *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_mutex *a),(a),)
SDL_DYNAPI_PROC(int,SDL_DestroyPalette,(SDL_Palette *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_DestroyPixelFormat,(SDL_PixelFormat *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_DestroyRenderer,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_DestroyPalette,(SDL_Palette *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyPixelFormat,(SDL_PixelFormat *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyRenderer,(SDL_Renderer *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroySemaphore,(SDL_sem *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroySurface,(SDL_Surface *a),(a),)
SDL_DYNAPI_PROC(int,SDL_DestroyTexture,(SDL_Texture *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_DestroyWindow,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_DestroyTexture,(SDL_Texture *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DestroyWindow,(SDL_Window *a),(a),)
SDL_DYNAPI_PROC(void,SDL_DetachThread,(SDL_Thread *a),(a),)
SDL_DYNAPI_PROC(int,SDL_DetachVirtualJoystick,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(void,SDL_DisableScreenSaver,(void),(),)
@ -722,7 +722,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputShown,(void),(),return)
SDL_DYNAPI_PROC(SDL_threadID,SDL_ThreadID,(void),(),return)
SDL_DYNAPI_PROC(int,SDL_TryLockMutex,(SDL_mutex *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_UnloadObject,(void *a),(a),)
SDL_DYNAPI_PROC(int,SDL_UnlockAudioDevice,(SDL_AudioDeviceID a),(a),return)
SDL_DYNAPI_PROC(void,SDL_UnlockAudioDevice,(SDL_AudioDeviceID a),(a),)
SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),)
SDL_DYNAPI_PROC(int,SDL_UnlockMutex,(SDL_mutex *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_UnlockSurface,(SDL_Surface *a),(a),)

View file

@ -4089,9 +4089,9 @@ static int SDL_DestroyTextureInternal(SDL_Texture *texture, SDL_bool is_destroyi
return 0;
}
int SDL_DestroyTexture(SDL_Texture *texture)
void SDL_DestroyTexture(SDL_Texture *texture)
{
return SDL_DestroyTextureInternal(texture, SDL_FALSE /* is_destroying */);
SDL_DestroyTextureInternal(texture, SDL_FALSE /* is_destroying */);
}
static void SDL_DiscardAllCommands(SDL_Renderer *renderer)
@ -4116,9 +4116,9 @@ static void SDL_DiscardAllCommands(SDL_Renderer *renderer)
}
}
int SDL_DestroyRenderer(SDL_Renderer *renderer)
void SDL_DestroyRenderer(SDL_Renderer *renderer)
{
CHECK_RENDERER_MAGIC(renderer, -1);
CHECK_RENDERER_MAGIC(renderer,);
SDL_DelEventWatch(SDL_RendererEventWatch, renderer);
@ -4147,7 +4147,6 @@ int SDL_DestroyRenderer(SDL_Renderer *renderer)
/* Free the renderer instance */
renderer->DestroyRenderer(renderer);
return 0;
}
int SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh)

View file

@ -623,19 +623,19 @@ int SDL_InitFormat(SDL_PixelFormat *format, Uint32 pixel_format)
return 0;
}
int SDL_DestroyPixelFormat(SDL_PixelFormat *format)
void SDL_DestroyPixelFormat(SDL_PixelFormat *format)
{
SDL_PixelFormat *prev;
if (format == NULL) {
return SDL_InvalidParamError("format");
return;
}
SDL_AtomicLock(&formats_lock);
if (--format->refcount > 0) {
SDL_AtomicUnlock(&formats_lock);
return 0;
return;
}
/* Remove this format from our list */
@ -656,7 +656,7 @@ int SDL_DestroyPixelFormat(SDL_PixelFormat *format)
SDL_DestroyPalette(format->palette);
}
SDL_free(format);
return 0;
return;
}
SDL_Palette *
@ -744,17 +744,16 @@ int SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors,
return status;
}
int SDL_DestroyPalette(SDL_Palette *palette)
void SDL_DestroyPalette(SDL_Palette *palette)
{
if (palette == NULL) {
return SDL_InvalidParamError("palette");
return;
}
if (--palette->refcount > 0) {
return 0;
return;
}
SDL_free(palette->colors);
SDL_free(palette);
return 0;
}
/*

View file

@ -3128,11 +3128,11 @@ SDL_Window *SDL_GetFocusWindow(void)
return NULL;
}
int SDL_DestroyWindow(SDL_Window *window)
void SDL_DestroyWindow(SDL_Window *window)
{
SDL_VideoDisplay *display;
CHECK_WINDOW_MAGIC(window, -1);
CHECK_WINDOW_MAGIC(window,);
window->is_destroying = SDL_TRUE;
@ -3209,7 +3209,6 @@ int SDL_DestroyWindow(SDL_Window *window)
}
SDL_free(window);
return 0;
}
SDL_bool SDL_ScreenSaverEnabled()