From 228569c8f8f67823484c38067eddf4045d0a15ba Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Aug 2014 03:28:22 +0200 Subject: [PATCH] Cleanup extraneous elses --- gfx/shader_cg.c | 17 +++++++---------- gfx/shader_glsl.c | 12 ++++-------- gfx/shader_hlsl.c | 9 +++------ input/apple_joypad.c | 4 ++-- input/linuxraw_input.c | 3 +-- input/linuxraw_joypad.c | 8 +++----- input/udev_joypad.c | 6 ++---- input/winxinput_joypad.c | 11 ++++------- input/x11_input.c | 3 +-- 9 files changed, 27 insertions(+), 46 deletions(-) diff --git a/gfx/shader_cg.c b/gfx/shader_cg.c index d0db603ab0..4d745bfc1a 100644 --- a/gfx/shader_cg.c +++ b/gfx/shader_cg.c @@ -165,8 +165,8 @@ static bool gl_cg_set_mvp(void *data, const math_matrix *mat) cgGLSetMatrixParameterfc(prg[active_index].mvp, mat->data); return true; } - else - return false; + + return false; } #define SET_COORD(name, coords_name, len) do { \ @@ -876,8 +876,7 @@ static unsigned gl_cg_num(void) { if (cg_active) return cg_shader->passes; - else - return 0; + return 0; } static bool gl_cg_filter_type(unsigned index, bool *smooth) @@ -889,16 +888,15 @@ static bool gl_cg_filter_type(unsigned index, bool *smooth) *smooth = cg_shader->pass[index - 1].filter == RARCH_FILTER_LINEAR; return true; } - else - return false; + + return false; } static enum gfx_wrap_type gl_cg_wrap_type(unsigned index) { if (cg_active && index) return cg_shader->pass[index - 1].wrap; - else - return RARCH_WRAP_BORDER; + return RARCH_WRAP_BORDER; } static void gl_cg_shader_scale(unsigned index, struct gfx_fbo_scale *scale) @@ -928,8 +926,7 @@ static bool gl_cg_mipmap_input(unsigned index) { if (cg_active && index) return cg_shader->pass[index - 1].mipmap; - else - return false; + return false; } static struct gfx_shader *gl_cg_get_current_shader(void) diff --git a/gfx/shader_glsl.c b/gfx/shader_glsl.c index 5033339500..408945368e 100644 --- a/gfx/shader_glsl.c +++ b/gfx/shader_glsl.c @@ -351,8 +351,7 @@ static bool link_program(GLuint prog) glUseProgram(prog); return true; } - else - return false; + return false; } static GLuint compile_program(const char *vertex, const char *fragment, unsigned i) @@ -1148,16 +1147,14 @@ static bool gl_glsl_filter_type(unsigned index, bool *smooth) *smooth = glsl_shader->pass[index - 1].filter == RARCH_FILTER_LINEAR; return true; } - else - return false; + return false; } static enum gfx_wrap_type gl_glsl_wrap_type(unsigned index) { if (glsl_enable && index) return glsl_shader->pass[index - 1].wrap; - else - return RARCH_WRAP_BORDER; + return RARCH_WRAP_BORDER; } static void gl_glsl_shader_scale(unsigned index, struct gfx_fbo_scale *scale) @@ -1187,8 +1184,7 @@ static bool gl_glsl_mipmap_input(unsigned index) { if (glsl_enable && index) return glsl_shader->pass[index - 1].mipmap; - else - return false; + return false; } static struct gfx_shader *gl_glsl_get_current_shader(void) diff --git a/gfx/shader_hlsl.c b/gfx/shader_hlsl.c index fe695e134c..5dea55f4e4 100644 --- a/gfx/shader_hlsl.c +++ b/gfx/shader_hlsl.c @@ -390,8 +390,7 @@ static unsigned hlsl_num(void) { if (hlsl_active) return cg_shader->passes; - else - return 0; + return 0; } static bool hlsl_filter_type(unsigned index, bool *smooth) @@ -403,8 +402,7 @@ static bool hlsl_filter_type(unsigned index, bool *smooth) *smooth = cg_shader->pass[index - 1].filter = RARCH_FILTER_LINEAR; return true; } - else - return false; + return false; } static void hlsl_shader_scale(unsigned index, struct gfx_fbo_scale *scale) @@ -425,8 +423,7 @@ static bool hlsl_set_mvp(void *data, const math_matrix *mat) prg[active_index].v_ctable->SetMatrix(d3d_device_ptr, prg[active_index].mvp, (D3DXMATRIX*)&prg[active_index].mvp_val); return true; } - else - return false; + return false; } static bool hlsl_mipmap_input(unsigned index) diff --git a/input/apple_joypad.c b/input/apple_joypad.c index 5c296d46ad..b71b813a34 100644 --- a/input/apple_joypad.c +++ b/input/apple_joypad.c @@ -332,8 +332,8 @@ static bool apple_joypad_button(unsigned port, uint16_t joykey) // Check hat. if (GET_HAT_DIR(joykey)) return false; - else // Check the button - return (port < MAX_PLAYERS && joykey < 32) ? (g_current_input_data.pad_buttons[port] & (1 << joykey)) != 0 : false; + // Check the button + return (port < MAX_PLAYERS && joykey < 32) ? (g_current_input_data.pad_buttons[port] & (1 << joykey)) != 0 : false; } static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis) diff --git a/input/linuxraw_input.c b/input/linuxraw_input.c index 4f6bd7e045..72fc9ac921 100644 --- a/input/linuxraw_input.c +++ b/input/linuxraw_input.c @@ -128,8 +128,7 @@ static bool linuxraw_is_pressed(linuxraw_input_t *linuxraw, const struct retro_k const struct retro_keybind *bind = &binds[id]; return bind->valid && linuxraw_key_pressed(linuxraw, binds[id].key); } - else - return false; + return false; } static int16_t linuxraw_analog_pressed(linuxraw_input_t *linuxraw, diff --git a/input/linuxraw_joypad.c b/input/linuxraw_joypad.c index 251e112d6c..ceb03216ac 100644 --- a/input/linuxraw_joypad.c +++ b/input/linuxraw_joypad.c @@ -103,11 +103,9 @@ static bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *p epoll_ctl(g_epoll, EPOLL_CTL_ADD, pad->fd, &event); return true; } - else - { - RARCH_ERR("[Joypad]: Failed to open pad %s (error: %s).\n", path, strerror(errno)); - return false; - } + + RARCH_ERR("[Joypad]: Failed to open pad %s (error: %s).\n", path, strerror(errno)); + return false; } static void handle_plugged_pad(void) diff --git a/input/udev_joypad.c b/input/udev_joypad.c index 076555f97c..99faf11bbf 100644 --- a/input/udev_joypad.c +++ b/input/udev_joypad.c @@ -76,8 +76,7 @@ static inline int16_t compute_axis(const struct input_absinfo *info, int value) return 0x7fff; else if (axis < -0x7fff) return -0x7fff; - else - return axis; + return axis; } static void poll_pad(unsigned p) @@ -532,8 +531,7 @@ static bool udev_joypad_button(unsigned port, uint16_t joykey) if (GET_HAT_DIR(joykey)) return udev_joypad_hat(pad, joykey); - else - return joykey < NUM_BUTTONS && pad->buttons[joykey]; + return joykey < NUM_BUTTONS && pad->buttons[joykey]; } static int16_t udev_joypad_axis(unsigned port, uint32_t joyaxis) diff --git a/input/winxinput_joypad.c b/input/winxinput_joypad.c index 83ad17a5d2..70b1078bb9 100644 --- a/input/winxinput_joypad.c +++ b/input/winxinput_joypad.c @@ -136,9 +136,8 @@ const char* winxinput_joypad_name (unsigned pad) if (xplayer < 0) return dinput_joypad.name(pad); - else - // TODO: Different name if disconnected? - return XBOX_CONTROLLER_NAMES[xplayer]; + // TODO: Different name if disconnected? + return XBOX_CONTROLLER_NAMES[xplayer]; } static bool winxinput_joypad_init(void) @@ -245,8 +244,7 @@ static bool winxinput_joypad_query_pad(unsigned pad) int xplayer = pad_index_to_xplayer_index(pad); if (xplayer > -1) return g_winxinput_states[xplayer].connected; - else - return dinput_joypad.query_pad(pad); + return dinput_joypad.query_pad(pad); } static void winxinput_joypad_destroy(void) @@ -392,8 +390,7 @@ static bool winxinput_joypad_rumble(unsigned pad, enum retro_rumble_effect effec { if (dinput_joypad.set_rumble) return dinput_joypad.set_rumble(pad, effect, strength); - else - return false; + return false; } diff --git a/input/x11_input.c b/input/x11_input.c index 143a135406..ed2e1d666e 100644 --- a/input/x11_input.c +++ b/input/x11_input.c @@ -81,8 +81,7 @@ static bool x_is_pressed(x11_input_t *x11, const struct retro_keybind *binds, un const struct retro_keybind *bind = &binds[id]; return bind->valid && x_key_pressed(x11, binds[id].key); } - else - return false; + return false; } static int16_t x_pressed_analog(x11_input_t *x11, const struct retro_keybind *binds, unsigned index, unsigned id)