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:
Ryan C. Gordon committed 2024-06-03 14:20:49 -04:00
1 parent b1f3682216
commit e23257307e
51 files changed
+262 -123

No files matched your search

+2
View File
@@ -360,6 +360,8 @@ extern SDL_DECLSPEC void *SDLCALL SDL_GetProperty(SDL_PropertiesID props, const
/**
* Get a string property on a set of properties.
*
* The returned string follows the SDL_GetStringRule.
*
* \param props the properties to query
* \param name the name of the property to query
* \param default_value the default value of the property