浏览代码

audio: Moved a variable into nested scope where it's actually used.

Ryan C. Gordon 3 周之前
父节点
当前提交
ac3afa1f38
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1 3
      src/audio/SDL_audio.c

+ 1 - 3
src/audio/SDL_audio.c

@@ -2464,11 +2464,9 @@ void SDL_DefaultAudioDeviceChanged(SDL_AudioDevice *new_default_device)
 
                 SDL_SetAudioPostmixCallback(logdev->instance_id, logdev->postmix, logdev->postmix_userdata);
 
-                SDL_PendingAudioDeviceEvent *p;
-
                 // Queue an event for each logical device we moved.
                 if (spec_changed) {
-                    p = (SDL_PendingAudioDeviceEvent *)SDL_malloc(sizeof(SDL_PendingAudioDeviceEvent));
+                    SDL_PendingAudioDeviceEvent *p = (SDL_PendingAudioDeviceEvent *)SDL_malloc(sizeof(SDL_PendingAudioDeviceEvent));
                     if (p) { // if this failed, no event for you, but you have deeper problems anyhow.
                         p->type = SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED;
                         p->devid = logdev->instance_id;