mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 06:34:35 +00:00
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:
parent
b1f3682216
commit
e23257307e
51 changed files with 262 additions and 123 deletions
|
|
@ -191,12 +191,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < devcount; i++) {
|
||||
SDL_AudioStream *stream = NULL;
|
||||
char *devname = SDL_GetAudioDeviceName(devices[i]);
|
||||
const char *devname = SDL_GetAudioDeviceName(devices[i]);
|
||||
int j;
|
||||
SDL_AudioSpec spec;
|
||||
|
||||
SDL_Log("Testing audio device: %s\n", devname);
|
||||
SDL_free(devname);
|
||||
|
||||
if (SDL_GetAudioDeviceFormat(devices[i], &spec, NULL) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GetAudioDeviceFormat() failed: %s\n", SDL_GetError());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue