mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-03 23:00:14 +02:00
Ensure that all functions that follow the SDL_GetStringRule return temporary memory
This commit is contained in:
@@ -88,7 +88,6 @@ SDL_COMPILE_TIME_ASSERT(SDL_expand_byte_10_size, SDL_arraysize(SDL_expand_byte_1
|
||||
|
||||
/* Helper functions */
|
||||
|
||||
// This doesn't need SDL_FreeLater since it returns string literals.
|
||||
#define CASE(X) \
|
||||
case X: \
|
||||
return #X;
|
||||
|
||||
@@ -515,11 +515,10 @@ int SDL_GetNumVideoDrivers(void)
|
||||
return SDL_arraysize(bootstrap) - 1;
|
||||
}
|
||||
|
||||
// this returns string literals, so there's no need to use SDL_FreeLater.
|
||||
const char *SDL_GetVideoDriver(int index)
|
||||
{
|
||||
if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
|
||||
return bootstrap[index]->name;
|
||||
return SDL_CreateTemporaryString(bootstrap[index]->name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -657,14 +656,13 @@ pre_driver_error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
// this returns string literals, so there's no need to use SDL_FreeLater.
|
||||
const char *SDL_GetCurrentVideoDriver(void)
|
||||
{
|
||||
if (!_this) {
|
||||
SDL_UninitializedVideo();
|
||||
return NULL;
|
||||
}
|
||||
return _this->name;
|
||||
return SDL_CreateTemporaryString(_this->name);
|
||||
}
|
||||
|
||||
SDL_VideoDevice *SDL_GetVideoDevice(void)
|
||||
|
||||
Reference in New Issue
Block a user