mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-24 03:00:27 +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:
@@ -166,8 +166,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
|
||||
* "direct3d12" or "metal". These never have Unicode characters, and are not
|
||||
* meant to be proper names.
|
||||
*
|
||||
* The returned value points to a static, read-only string; do not modify or
|
||||
* free it!
|
||||
* The returned string follows the SDL_GetStringRule.
|
||||
*
|
||||
* \param index the index of the rendering driver; the value ranges from 0 to
|
||||
* SDL_GetNumRenderDrivers() - 1
|
||||
|
||||
Reference in New Issue
Block a user