Get rid of some duplicate get_prev/get_next functions

This commit is contained in:
twinaphex 2014-08-26 23:11:35 +02:00
parent db396976ee
commit d05d909373
3 changed files with 15 additions and 83 deletions

View File

@ -317,7 +317,7 @@ static int find_driver_index(unsigned cmd, const char *driver)
return -1; return -1;
} }
static void find_prev_driver(unsigned cmd, char *str, size_t sizeof_str) void find_prev_driver(unsigned cmd, char *str, size_t sizeof_str)
{ {
int i = find_driver_index(cmd, str); int i = find_driver_index(cmd, str);
if (i > 0) if (i > 0)
@ -326,7 +326,7 @@ static void find_prev_driver(unsigned cmd, char *str, size_t sizeof_str)
RARCH_WARN("Couldn't find any previous driver (current one: \"%s\").\n", str); RARCH_WARN("Couldn't find any previous driver (current one: \"%s\").\n", str);
} }
static void find_next_driver(unsigned cmd, char *str, size_t sizeof_str) void find_next_driver(unsigned cmd, char *str, size_t sizeof_str)
{ {
int i = find_driver_index(cmd, str); int i = find_driver_index(cmd, str);
if (i >= 0) if (i >= 0)
@ -357,67 +357,6 @@ static void find_osk_driver(void)
} }
} }
void find_prev_osk_driver(void)
{
find_prev_driver(RARCH_DRIVER_OSK, g_settings.osk.driver, sizeof(g_settings.osk.driver));
}
void find_next_osk_driver(void)
{
find_next_driver(RARCH_DRIVER_OSK, g_settings.osk.driver, sizeof(g_settings.osk.driver));
}
void find_prev_camera_driver(void)
{
find_prev_driver(RARCH_DRIVER_CAMERA, g_settings.camera.driver, sizeof(g_settings.camera.driver));
}
void find_next_camera_driver(void)
{
find_next_driver(RARCH_DRIVER_CAMERA, g_settings.camera.driver, sizeof(g_settings.camera.driver));
}
void find_prev_video_driver(void)
{
find_prev_driver(RARCH_DRIVER_VIDEO, g_settings.video.driver, sizeof(g_settings.video.driver));
}
void find_next_video_driver(void)
{
find_next_driver(RARCH_DRIVER_VIDEO, g_settings.video.driver, sizeof(g_settings.video.driver));
}
void find_prev_location_driver(void)
{
find_prev_driver(RARCH_DRIVER_LOCATION, g_settings.location.driver, sizeof(g_settings.location.driver));
}
void find_next_location_driver(void)
{
find_next_driver(RARCH_DRIVER_LOCATION, g_settings.location.driver, sizeof(g_settings.location.driver));
}
void find_prev_audio_driver(void)
{
find_prev_driver(RARCH_DRIVER_AUDIO, g_settings.audio.driver, sizeof(g_settings.audio.driver));
}
void find_next_audio_driver(void)
{
find_next_driver(RARCH_DRIVER_AUDIO, g_settings.audio.driver, sizeof(g_settings.audio.driver));
}
void find_prev_input_driver(void)
{
find_prev_driver(RARCH_DRIVER_INPUT, g_settings.input.driver, sizeof(g_settings.input.driver));
}
void find_next_input_driver(void)
{
find_next_driver(RARCH_DRIVER_INPUT, g_settings.input.driver, sizeof(g_settings.input.driver));
}
void init_osk(void) void init_osk(void)
{ {
// Resource leaks will follow if osk is initialized twice. // Resource leaks will follow if osk is initialized twice.

View File

@ -478,24 +478,17 @@ void uninit_video_input(void);
void init_audio(void); void init_audio(void);
void uninit_audio(void); void uninit_audio(void);
void find_prev_driver(unsigned cmd, char *str, size_t sizeof_str);
void find_next_driver(unsigned cmd, char *str, size_t sizeof_str);
void find_prev_resampler_driver(void); void find_prev_resampler_driver(void);
void find_prev_video_driver(void);
void find_prev_audio_driver(void);
void find_prev_input_driver(void);
void find_next_video_driver(void);
void find_next_audio_driver(void);
void find_next_input_driver(void);
void find_next_resampler_driver(void); void find_next_resampler_driver(void);
void init_camera(void); void init_camera(void);
void uninit_camera(void); void uninit_camera(void);
void find_prev_camera_driver(void);
void find_next_camera_driver(void);
void init_location(void); void init_location(void);
void uninit_location(void); void uninit_location(void);
void find_prev_location_driver(void);
void find_next_location_driver(void);
void driver_set_monitor_refresh_rate(float hz); void driver_set_monitor_refresh_rate(float hz);
bool driver_monitor_fps_statistics(double *refresh_rate, double *deviation, unsigned *sample_points); bool driver_monitor_fps_statistics(double *refresh_rate, double *deviation, unsigned *sample_points);

View File

@ -3373,15 +3373,15 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t
break; break;
case MENU_SETTINGS_DRIVER_VIDEO: case MENU_SETTINGS_DRIVER_VIDEO:
if (action == MENU_ACTION_LEFT) if (action == MENU_ACTION_LEFT)
find_prev_video_driver(); find_prev_driver(RARCH_DRIVER_VIDEO, g_settings.video.driver, sizeof(g_settings.video.driver));
else if (action == MENU_ACTION_RIGHT) else if (action == MENU_ACTION_RIGHT)
find_next_video_driver(); find_next_driver(RARCH_DRIVER_VIDEO, g_settings.video.driver, sizeof(g_settings.video.driver));
break; break;
case MENU_SETTINGS_DRIVER_AUDIO: case MENU_SETTINGS_DRIVER_AUDIO:
if (action == MENU_ACTION_LEFT) if (action == MENU_ACTION_LEFT)
find_prev_audio_driver(); find_prev_driver(RARCH_DRIVER_AUDIO, g_settings.audio.driver, sizeof(g_settings.audio.driver));
else if (action == MENU_ACTION_RIGHT) else if (action == MENU_ACTION_RIGHT)
find_next_audio_driver(); find_next_driver(RARCH_DRIVER_AUDIO, g_settings.audio.driver, sizeof(g_settings.audio.driver));
break; break;
case MENU_SETTINGS_DRIVER_AUDIO_DEVICE: case MENU_SETTINGS_DRIVER_AUDIO_DEVICE:
if (action == MENU_ACTION_OK) if (action == MENU_ACTION_OK)
@ -3397,21 +3397,21 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t
break; break;
case MENU_SETTINGS_DRIVER_INPUT: case MENU_SETTINGS_DRIVER_INPUT:
if (action == MENU_ACTION_LEFT) if (action == MENU_ACTION_LEFT)
find_prev_input_driver(); find_prev_driver(RARCH_DRIVER_INPUT, g_settings.input.driver, sizeof(g_settings.input.driver));
else if (action == MENU_ACTION_RIGHT) else if (action == MENU_ACTION_RIGHT)
find_next_input_driver(); find_next_driver(RARCH_DRIVER_INPUT, g_settings.input.driver, sizeof(g_settings.input.driver));
break; break;
case MENU_SETTINGS_DRIVER_CAMERA: case MENU_SETTINGS_DRIVER_CAMERA:
if (action == MENU_ACTION_LEFT) if (action == MENU_ACTION_LEFT)
find_prev_camera_driver(); find_prev_driver(RARCH_DRIVER_CAMERA, g_settings.camera.driver, sizeof(g_settings.camera.driver));
else if (action == MENU_ACTION_RIGHT) else if (action == MENU_ACTION_RIGHT)
find_next_camera_driver(); find_next_driver(RARCH_DRIVER_CAMERA, g_settings.camera.driver, sizeof(g_settings.camera.driver));
break; break;
case MENU_SETTINGS_DRIVER_LOCATION: case MENU_SETTINGS_DRIVER_LOCATION:
if (action == MENU_ACTION_LEFT) if (action == MENU_ACTION_LEFT)
find_prev_location_driver(); find_prev_driver(RARCH_DRIVER_LOCATION, g_settings.location.driver, sizeof(g_settings.location.driver));
else if (action == MENU_ACTION_RIGHT) else if (action == MENU_ACTION_RIGHT)
find_next_location_driver(); find_next_driver(RARCH_DRIVER_LOCATION, g_settings.location.driver, sizeof(g_settings.location.driver));
break; break;
#ifdef HAVE_MENU #ifdef HAVE_MENU
case MENU_SETTINGS_DRIVER_MENU: case MENU_SETTINGS_DRIVER_MENU: