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:
@@ -96,7 +96,7 @@ extern SDL_DECLSPEC SDL_TouchID *SDLCALL SDL_GetTouchDevices(int *count);
|
||||
/**
|
||||
* Get the touch device name as reported from the driver.
|
||||
*
|
||||
* You do not own the returned string, do not modify or free it.
|
||||
* The returned string follows the SDL_GetStringRule.
|
||||
*
|
||||
* \param touchID the touch device instance ID.
|
||||
* \returns touch device name, or NULL on error; call SDL_GetError() for more
|
||||
@@ -104,7 +104,7 @@ extern SDL_DECLSPEC SDL_TouchID *SDLCALL SDL_GetTouchDevices(int *count);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC const char* SDLCALL SDL_GetTouchDeviceName(SDL_TouchID touchID);
|
||||
extern SDL_DECLSPEC const char *SDLCALL SDL_GetTouchDeviceName(SDL_TouchID touchID);
|
||||
|
||||
/**
|
||||
* Get the type of the given touch device.
|
||||
|
||||
Reference in New Issue
Block a user