From d839157d13e2efd566f132c264d56143faf98980 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 21 Nov 2015 09:45:05 +0100 Subject: [PATCH] (menu_setting.c) Add do{}while(0) to macros --- menu/menu_setting.c | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index ecc194e5bc..8a8570ea73 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2656,82 +2656,82 @@ static void general_write_handler(void *data) } #define START_GROUP(group_info, NAME, parent_group) \ -{ \ +do{ \ group_info.name = NAME; \ if (!(menu_settings_list_append(list, list_info, setting_group_setting (ST_GROUP, NAME, parent_group)))) return false; \ -} +}while(0) #define END_GROUP(list, list_info, parent_group) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_group_setting (ST_END_GROUP, 0, parent_group)))) return false; \ -} +}while(0) #define START_SUB_GROUP(list, list_info, NAME, group_info, subgroup_info, parent_group) \ -{ \ +do{ \ subgroup_info.name = NAME; \ if (!(menu_settings_list_append(list, list_info, setting_subgroup_setting (ST_SUB_GROUP, NAME, group_info, parent_group)))) return false; \ -} +}while(0) #define END_SUB_GROUP(list, list_info, parent_group) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_group_setting (ST_END_SUB_GROUP, 0, parent_group)))) return false; \ -} +}while(0) #define CONFIG_ACTION(NAME, SHORT, group_info, subgroup_info, parent_group) \ -{ \ +do{ \ if (!menu_settings_list_append(list, list_info, setting_action_setting (NAME, SHORT, group_info, subgroup_info, parent_group))) return false; \ -} +}while(0) #define CONFIG_BOOL(TARGET, NAME, SHORT, DEF, OFF, ON, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \ -{ \ +do{ \ if (!menu_settings_list_append(list, list_info, setting_bool_setting (NAME, SHORT, TARGET, DEF, OFF, ON, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))return false; \ -} +}while(0) #define CONFIG_INT(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_int_setting (NAME, SHORT, &TARGET, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \ -} +}while(0) #define CONFIG_UINT(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_uint_setting (NAME, SHORT, &TARGET, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \ -} +}while(0) #define CONFIG_FLOAT(TARGET, NAME, SHORT, DEF, ROUNDING, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_float_setting (NAME, SHORT, &TARGET, DEF, ROUNDING, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \ -} +}while(0) #define CONFIG_PATH(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_string_setting(ST_PATH, NAME, SHORT, TARGET, sizeof(TARGET), DEF, "", group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \ -} +}while(0) #define CONFIG_DIR(TARGET, NAME, SHORT, DEF, EMPTY, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_string_setting(ST_DIR, NAME, SHORT, TARGET, sizeof(TARGET), DEF, EMPTY, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \ -} +}while(0) #define CONFIG_STRING(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_string_setting(ST_STRING, NAME, SHORT, TARGET, sizeof(TARGET), DEF, "", group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \ -} +}while(0) #define CONFIG_STRING_OPTIONS(TARGET, NAME, SHORT, DEF, OPTS, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_string_setting_options(ST_STRING_OPTIONS, NAME, SHORT, TARGET, sizeof(TARGET), DEF, "", OPTS, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \ -} +}while(0) #define CONFIG_HEX(TARGET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_hex_setting(NAME, SHORT, &TARGET, DEF, group_info, subgroup_info, parent_group, CHANGE_HANDLER, READ_HANDLER)))) return false; \ -} +}while(0) /* Please strdup() NAME and SHORT */ #define CONFIG_BIND(TARGET, PLAYER, PLAYER_OFFSET, NAME, SHORT, DEF, group_info, subgroup_info, parent_group) \ -{ \ +do{ \ if (!(menu_settings_list_append(list, list_info, setting_bind_setting (NAME, SHORT, &TARGET, PLAYER, PLAYER_OFFSET, DEF, group_info, subgroup_info, parent_group)))) return false; \ -} +}while(0) #ifdef GEKKO #define MAX_GAMMA_SETTING 2