mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-16 07:11:16 +00:00
Introduce formal policy for APIs that return strings.
This declares that any `const char *` returned from SDL is owned by SDL, and promises to be valid _at least_ until the next time the event queue runs, or SDL_Quit() is called, even if the thing that owns the string gets destroyed or changed before then. This is noted in the headers as "the SDL_GetStringRule", so this will both be greppable to find a detailed explaination in docs/README-strings.md and wikiheaders will automatically turn it into a link we can point at the appropriate documentation. Fixes #9902. (and several FIXMEs, both known and yet-undocumented.)
This commit is contained in:
@@ -158,6 +158,8 @@ extern SDL_DECLSPEC SDL_SensorID *SDLCALL SDL_GetSensors(int *count);
|
||||
/**
|
||||
* Get the implementation dependent name of a sensor.
|
||||
*
|
||||
* The returned string follows the SDL_GetStringRule.
|
||||
*
|
||||
* \param instance_id the sensor instance ID
|
||||
* \returns the sensor name, or NULL if `instance_id` is not valid
|
||||
*
|
||||
@@ -224,6 +226,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSensorProperties(SDL_Sensor
|
||||
/**
|
||||
* Get the implementation dependent name of a sensor.
|
||||
*
|
||||
* The returned string follows the SDL_GetStringRule.
|
||||
*
|
||||
* \param sensor The SDL_Sensor object
|
||||
* \returns the sensor name, or NULL if `sensor` is NULL.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user