Get rid of some extraneous elses

This commit is contained in:
twinaphex 2014-08-27 03:11:06 +02:00
parent 5c2006c072
commit cec2afe6cb
3 changed files with 13 additions and 19 deletions

View File

@ -175,13 +175,10 @@ static ssize_t alsa_write(void *data, const void *buf_, size_t size_)
eagain_retry = false; eagain_retry = false;
continue; continue;
} }
else
return written;
}
else if (frames == -EAGAIN) // Expected if we're running nonblock.
{
return written; return written;
} }
else if (frames == -EAGAIN) // Expected if we're running nonblock.
return written;
else if (frames < 0) else if (frames < 0)
{ {
RARCH_ERR("[ALSA]: Unknown error occured (%s).\n", snd_strerror(frames)); RARCH_ERR("[ALSA]: Unknown error occured (%s).\n", snd_strerror(frames));
@ -199,6 +196,7 @@ static ssize_t alsa_write(void *data, const void *buf_, size_t size_)
static bool alsa_stop(void *data) static bool alsa_stop(void *data)
{ {
alsa_t *alsa = (alsa_t*)data; alsa_t *alsa = (alsa_t*)data;
if (alsa->can_pause && !alsa->is_paused) if (alsa->can_pause && !alsa->is_paused)
{ {
if (snd_pcm_pause(alsa->pcm, 1) == 0) if (snd_pcm_pause(alsa->pcm, 1) == 0)
@ -206,11 +204,10 @@ static bool alsa_stop(void *data)
alsa->is_paused = true; alsa->is_paused = true;
return true; return true;
} }
else return false;
return false;
} }
else
return true; return true;
} }
static void alsa_set_nonblock_state(void *data, bool state) static void alsa_set_nonblock_state(void *data, bool state)
@ -236,8 +233,7 @@ static bool alsa_start(void *data)
return true; return true;
} }
} }
else return true;
return true;
} }
static void alsa_free(void *data) static void alsa_free(void *data)

View File

@ -267,11 +267,10 @@ static bool alsa_qsa_stop(void *data)
alsa->is_paused = true; alsa->is_paused = true;
return true; return true;
} }
else return false;
return false;
} }
else
return true; return true;
} }
static void alsa_qsa_set_nonblock_state(void *data, bool state) static void alsa_qsa_set_nonblock_state(void *data, bool state)
@ -308,9 +307,8 @@ static bool alsa_qsa_start(void *data)
return true; return true;
} }
} }
else
return true;
return true;
} }
static bool alsa_qsa_use_float(void *data) static bool alsa_qsa_use_float(void *data)

View File

@ -27,11 +27,11 @@ struct fifo_buffer
fifo_buffer_t *fifo_new(size_t size) fifo_buffer_t *fifo_new(size_t size)
{ {
fifo_buffer_t *buf = (fifo_buffer_t*)calloc(1, sizeof(*buf)); fifo_buffer_t *buf = (fifo_buffer_t*)calloc(1, sizeof(*buf));
if (buf == NULL) if (!buf)
return NULL; return NULL;
buf->buffer = (uint8_t*)calloc(1, size + 1); buf->buffer = (uint8_t*)calloc(1, size + 1);
if (buf->buffer == NULL) if (!buf->buffer)
{ {
free(buf); free(buf);
return NULL; return NULL;