mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-20 15:51:07 +01:00
Removed temporary memory from the API
It was intended to make the API easier to use, but various automatic garbage collection all had flaws, and making the application periodically clean up temporary memory added cognitive load to using the API, and in many cases was it was difficult to restructure threaded code to handle this. So, we're largely going back to the original system, where the API returns allocated results and you free them. In addition, to solve the problems we originally wanted temporary memory for: * Short strings with a finite count, like device names, get stored in a per-thread string pool. * Events continue to use temporary memory internally, which is cleaned up on the next event processing cycle.
This commit is contained in:
@@ -204,14 +204,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void);
|
||||
* \param count a pointer filled in with the number of joysticks returned, may
|
||||
* be NULL.
|
||||
* \returns a 0 terminated array of joystick instance IDs or NULL on failure;
|
||||
* call SDL_GetError() for more information.
|
||||
* call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_HasJoystick
|
||||
* \sa SDL_OpenJoystick
|
||||
*/
|
||||
extern SDL_DECLSPEC_TEMP const SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count);
|
||||
extern SDL_DECLSPEC_FREE SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a joystick.
|
||||
@@ -227,7 +227,7 @@ extern SDL_DECLSPEC_TEMP const SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *co
|
||||
* \sa SDL_GetJoystickName
|
||||
* \sa SDL_GetJoysticks
|
||||
*/
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickNameForID(SDL_JoystickID instance_id);
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickNameForID(SDL_JoystickID instance_id);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent path of a joystick.
|
||||
@@ -243,7 +243,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickNameForID(SDL_Joyst
|
||||
* \sa SDL_GetJoystickPath
|
||||
* \sa SDL_GetJoysticks
|
||||
*/
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickPathForID(SDL_JoystickID instance_id);
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPathForID(SDL_JoystickID instance_id);
|
||||
|
||||
/**
|
||||
* Get the player index of a joystick.
|
||||
@@ -661,7 +661,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetJoystickProperties(SDL_Joyst
|
||||
*
|
||||
* \sa SDL_GetJoystickNameForID
|
||||
*/
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *joystick);
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent path of a joystick.
|
||||
@@ -674,7 +674,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *
|
||||
*
|
||||
* \sa SDL_GetJoystickPathForID
|
||||
*/
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickPath(SDL_Joystick *joystick);
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPath(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the player index of an opened joystick.
|
||||
@@ -789,7 +789,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickFirmwareVersion(SDL_Joystick *
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joystick);
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the type of an opened joystick.
|
||||
|
||||
Reference in New Issue
Block a user