changeset 30402:9fc779fd3721

Declare variable closer to where it is used.
author reimar
date Wed, 27 Jan 2010 18:23:19 +0000
parents a97f9a9f30d1
children 22633d3fbffe
files libao2/ao_alsa.c
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa.c	Wed Jan 27 18:21:27 2010 +0000
+++ b/libao2/ao_alsa.c	Wed Jan 27 18:23:19 2010 +0000
@@ -315,7 +315,6 @@
 {
     unsigned int alsa_buffer_time = 500000; /* 0.5 s */
     unsigned int alsa_fragcount = 16;
-    int open_mode;
     int err;
     int block;
     strarg_t device;
@@ -469,15 +468,8 @@
 
     mp_msg(MSGT_AO,MSGL_V,"alsa-init: using device %s\n", alsa_device);
 
-    //setting modes for block or nonblock-mode
-    if (!block) {
-      open_mode = SND_PCM_NONBLOCK;
-    }
-    else {
-      open_mode = 0;
-    }
-
     if (!alsa_handler) {
+      int open_mode = block ? 0 : SND_PCM_NONBLOCK;
       int isac3 =  AF_FORMAT_IS_AC3(format);
       //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC
       if ((err = try_open_device(alsa_device, open_mode, isac3)) < 0)