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:
parent
21411c6418
commit
4f55271571
100 changed files with 737 additions and 853 deletions
|
@ -149,11 +149,11 @@ typedef enum SDL_SensorType
|
|||
* \param count a pointer filled in with the number of sensors returned, may
|
||||
* be NULL.
|
||||
* \returns a 0 terminated array of sensor 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.
|
||||
*/
|
||||
extern SDL_DECLSPEC const SDL_SensorID * SDLCALL SDL_GetSensors(int *count);
|
||||
extern SDL_DECLSPEC SDL_SensorID * SDLCALL SDL_GetSensors(int *count);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a sensor.
|
||||
|
@ -165,7 +165,7 @@ extern SDL_DECLSPEC const SDL_SensorID * SDLCALL SDL_GetSensors(int *count);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id);
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id);
|
||||
|
||||
/**
|
||||
* Get the type of a sensor.
|
||||
|
@ -235,7 +235,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSensorProperties(SDL_Sensor
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor);
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor);
|
||||
|
||||
/**
|
||||
* Get the type of a sensor.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue