Added SDL_SetFreeableProperty() for internal use
parent
432ce3f167
commit
bba2a5d360
|
@ -375,6 +375,16 @@ int SDL_SetProperty(SDL_PropertiesID props, const char *name, void *value)
|
||||||
return SDL_PrivateSetProperty(props, name, property);
|
return SDL_PrivateSetProperty(props, name, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CleanupFreeableProperty(void *userdata, void *value)
|
||||||
|
{
|
||||||
|
SDL_free(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int SDL_SetFreeableProperty(SDL_PropertiesID props, const char *name, void *value)
|
||||||
|
{
|
||||||
|
return SDL_SetPropertyWithCleanup(props, name, value, CleanupFreeableProperty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void CleanupSurface(void *userdata, void *value)
|
static void CleanupSurface(void *userdata, void *value)
|
||||||
{
|
{
|
||||||
SDL_Surface *surface = (SDL_Surface *)value;
|
SDL_Surface *surface = (SDL_Surface *)value;
|
||||||
|
|
|
@ -20,5 +20,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int SDL_InitProperties(void);
|
extern int SDL_InitProperties(void);
|
||||||
|
extern int SDL_SetFreeableProperty(SDL_PropertiesID props, const char *name, void *value);
|
||||||
extern int SDL_SetSurfaceProperty(SDL_PropertiesID props, const char *name, SDL_Surface *surface);
|
extern int SDL_SetSurfaceProperty(SDL_PropertiesID props, const char *name, SDL_Surface *surface);
|
||||||
extern void SDL_QuitProperties(void);
|
extern void SDL_QuitProperties(void);
|
||||||
|
|
Loading…
Reference in New Issue