From cec2afe6cbf85d556c4508c2a8634ac553b39077 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Aug 2014 03:11:06 +0200 Subject: [PATCH] Get rid of some extraneous elses --- audio/alsa.c | 18 +++++++----------- audio/alsa_qsa.c | 10 ++++------ fifo_buffer.c | 4 ++-- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/audio/alsa.c b/audio/alsa.c index 4da1be37aa..ae579fd8a9 100644 --- a/audio/alsa.c +++ b/audio/alsa.c @@ -175,13 +175,10 @@ static ssize_t alsa_write(void *data, const void *buf_, size_t size_) eagain_retry = false; continue; } - else - return written; - } - else if (frames == -EAGAIN) // Expected if we're running nonblock. - { return written; } + else if (frames == -EAGAIN) // Expected if we're running nonblock. + return written; else if (frames < 0) { 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) { alsa_t *alsa = (alsa_t*)data; + if (alsa->can_pause && !alsa->is_paused) { if (snd_pcm_pause(alsa->pcm, 1) == 0) @@ -206,11 +204,10 @@ static bool alsa_stop(void *data) alsa->is_paused = true; return true; } - else - return false; + return false; } - else - return true; + + return true; } static void alsa_set_nonblock_state(void *data, bool state) @@ -236,8 +233,7 @@ static bool alsa_start(void *data) return true; } } - else - return true; + return true; } static void alsa_free(void *data) diff --git a/audio/alsa_qsa.c b/audio/alsa_qsa.c index e3f6166518..e011e4a3ac 100644 --- a/audio/alsa_qsa.c +++ b/audio/alsa_qsa.c @@ -267,11 +267,10 @@ static bool alsa_qsa_stop(void *data) alsa->is_paused = true; return true; } - else - return false; + return false; } - else - return true; + + return true; } static void alsa_qsa_set_nonblock_state(void *data, bool state) @@ -308,9 +307,8 @@ static bool alsa_qsa_start(void *data) return true; } } - else - return true; + return true; } static bool alsa_qsa_use_float(void *data) diff --git a/fifo_buffer.c b/fifo_buffer.c index c6538ff55f..82258b389b 100644 --- a/fifo_buffer.c +++ b/fifo_buffer.c @@ -27,11 +27,11 @@ struct fifo_buffer fifo_buffer_t *fifo_new(size_t size) { fifo_buffer_t *buf = (fifo_buffer_t*)calloc(1, sizeof(*buf)); - if (buf == NULL) + if (!buf) return NULL; buf->buffer = (uint8_t*)calloc(1, size + 1); - if (buf->buffer == NULL) + if (!buf->buffer) { free(buf); return NULL;