-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Milestone
Description
There are a handful of things that allocate strings for return values that we expect the app to free.
Should these be changed to return const char *
and follow the SDL_GetStringRule, so the app doesn't have to free it, they just have to use it and be done? (or copy it if they want to keep it around).
These are the things that return char *
with obvious non-allocations (SDL_getenv, SDL_strlwr, etc) filtered out.
SDL_stdinc.h:2895:extern SDL_DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
SDL_clipboard.h:75:extern SDL_DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
SDL_clipboard.h:120:extern SDL_DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void);
SDL_filesystem.h:83:extern SDL_DECLSPEC char *SDLCALL SDL_GetBasePath(void);
SDL_filesystem.h:140:extern SDL_DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
SDL_filesystem.h:243:extern SDL_DECLSPEC char *SDLCALL SDL_GetUserFolder(SDL_Folder folder);
SDL_filesystem.h:380:extern SDL_DECLSPEC char **SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count);
SDL_storage.h:404:extern SDL_DECLSPEC char **SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count);
SDL_gamepad.h:402:extern SDL_DECLSPEC char ** SDLCALL SDL_GetGamepadMappings(int *count);
SDL_gamepad.h:418:extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_JoystickGUID guid);
SDL_gamepad.h:438:extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad);
SDL_gamepad.h:663:extern SDL_DECLSPEC char *SDLCALL SDL_GetGamepadInstanceMapping(SDL_JoystickID instance_id);