diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 567cda4a29..e7f52c8921 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1615,7 +1615,7 @@ static int menu_displaylist_parse_settings(menu_handle_t *menu, return -1; - for (; menu_setting_get_type(setting) != ST_END_GROUP; setting++) + for (; menu_setting_get_type(setting) != ST_END_GROUP; menu_settings_list_increment(&setting)) { const char *short_description = menu_setting_get_short_description(setting); const char *name = menu_setting_get_name(setting); @@ -1689,13 +1689,12 @@ static int menu_displaylist_parse_settings_in_subgroup(menu_displaylist_info_t * if ((strlen(name) != 0) && !strcmp(name, elem1)) break; } - info->setting++; + menu_settings_list_increment(&info->setting); } + menu_settings_list_increment(&info->setting); - info->setting++; - - for (; menu_setting_get_type(info->setting) != ST_END_SUB_GROUP; info->setting++) + for (; menu_setting_get_type(info->setting) != ST_END_SUB_GROUP; menu_settings_list_increment(&info->setting)) { const char *name = menu_setting_get_name(info->setting); const char *short_description = menu_setting_get_short_description(info->setting); @@ -2542,7 +2541,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) if (settings->menu.collapse_subgroups_enable) { - for (; menu_setting_get_type(setting) != ST_NONE; setting++) + for (; menu_setting_get_type(setting) != ST_NONE; menu_settings_list_increment(&setting)) { const char *short_description = menu_setting_get_short_description(setting); const char *name = menu_setting_get_name(setting); @@ -2559,7 +2558,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) } else { - for (; menu_setting_get_type(setting) != ST_NONE; setting++) + for (; menu_setting_get_type(setting) != ST_NONE; menu_settings_list_increment(&setting)) { char group_label[PATH_MAX_LENGTH]; const char *short_description = menu_setting_get_short_description(setting); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 6189199d61..3e36392752 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -64,6 +64,14 @@ static void menu_settings_info_list_free(rarch_setting_info_t *list_info) free(list_info); } +void menu_settings_list_increment(rarch_setting_t **list) +{ + if (!list || !*list) + return; + + *list = *list + 1; +} + static bool menu_settings_list_append(rarch_setting_t **list, rarch_setting_info_t *list_info, rarch_setting_t value) { @@ -335,7 +343,7 @@ rarch_setting_t *menu_setting_find(const char *label) needle = menu_hash_calculate(label); - for (; menu_setting_get_type(setting) != ST_NONE; setting++) + for (; menu_setting_get_type(setting) != ST_NONE; menu_settings_list_increment(&setting)) { const char *name = menu_setting_get_name(setting); const char *short_description = menu_setting_get_short_description(setting); @@ -6463,7 +6471,7 @@ void menu_setting_free(rarch_setting_t *list) if (!list) return; - for (; menu_setting_get_type(setting) != ST_NONE; setting++) + for (; menu_setting_get_type(setting) != ST_NONE; menu_settings_list_increment(&setting)) { if (flags & SD_FLAG_IS_DRIVER) { diff --git a/menu/menu_setting.h b/menu/menu_setting.h index 65f8fc9bfc..19c67a8377 100644 --- a/menu/menu_setting.h +++ b/menu/menu_setting.h @@ -308,6 +308,8 @@ void *setting_get_ptr(rarch_setting_t *setting); bool menu_setting_action_right(rarch_setting_t *setting, bool wraparound); +void menu_settings_list_increment(rarch_setting_t **list); + #ifdef __cplusplus } #endif