Don't automatically free temporary memory, let the application call SDL_FreeTemporaryMemory() when it's ready.

Also mark up all functions that return temporary memory with SDL_DECLSPEC_TEMP, to help people implementing language bindings.

Fixes https://github.com/libsdl-org/SDL/issues/10378
This commit is contained in:
Sam Lantinga committed 2024-07-26 10:05:03 -07:00
1 parent 2f38a4bf5e
commit 5e513ecc7f
31 files changed
+124 -402

No files matched your search

+1 -4
View File
@@ -378,9 +378,6 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetPointerProperty(SDL_PropertiesID props
/**
* Get a string property from a group of properties.
*
* This returns temporary memory which will be automatically freed later, and
* can be claimed with SDL_ClaimTemporaryMemory().
*
* \param props the properties to query.
* \param name the name of the property to query.
* \param default_value the default value of the property.
@@ -395,7 +392,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetPointerProperty(SDL_PropertiesID props
* \sa SDL_HasProperty
* \sa SDL_SetStringProperty
*/
extern SDL_DECLSPEC const char * SDLCALL SDL_GetStringProperty(SDL_PropertiesID props, const char *name, const char *default_value);
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetStringProperty(SDL_PropertiesID props, const char *name, const char *default_value);
/**
* Get a number property from a group of properties.