Mercurial > vim
diff src/option.c @ 28357:86b6432aa1d8 v8.2.4704
patch 8.2.4704: using "else" after return or break increases indent
Commit: https://github.com/vim/vim/commit/f26c16144ddb27642c09f2cf5271afd163b36306
Author: =?UTF-8?q?Dundar=20G=C3=B6c?= <gocdundar@gmail.com>
Date: Thu Apr 7 13:26:34 2022 +0100
patch 8.2.4704: using "else" after return or break increases indent
Problem: Using "else" after return or break increases indent.
Solution: Remove "else" and reduce indent. (Goc Dundar, closes https://github.com/vim/vim/issues/10099)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 07 Apr 2022 14:30:02 +0200 |
parents | 8bc8071928ed |
children | 473cfd79bcd8 |
line wrap: on
line diff
--- a/src/option.c +++ b/src/option.c @@ -4384,38 +4384,36 @@ set_option_value( #endif if (flags & P_STRING) return set_string_option(opt_idx, string, opt_flags); - else + + varp = get_varp_scope(&(options[opt_idx]), opt_flags); + if (varp != NULL) // hidden option is not changed { - varp = get_varp_scope(&(options[opt_idx]), opt_flags); - if (varp != NULL) // hidden option is not changed + if (number == 0 && string != NULL) { - if (number == 0 && string != NULL) + int idx; + + // Either we are given a string or we are setting option + // to zero. + for (idx = 0; string[idx] == '0'; ++idx) + ; + if (string[idx] != NUL || idx == 0) { - int idx; - - // Either we are given a string or we are setting option - // to zero. - for (idx = 0; string[idx] == '0'; ++idx) - ; - if (string[idx] != NUL || idx == 0) - { - // There's another character after zeros or the string - // is empty. In both cases, we are trying to set a - // num option using a string. - semsg(_(e_number_required_after_str_equal_str), - name, string); - return NULL; // do nothing as we hit an error - - } + // There's another character after zeros or the string + // is empty. In both cases, we are trying to set a + // num option using a string. + semsg(_(e_number_required_after_str_equal_str), + name, string); + return NULL; // do nothing as we hit an error + } - if (flags & P_NUM) - return set_num_option(opt_idx, varp, number, - NULL, 0, opt_flags); - else - return set_bool_option(opt_idx, varp, (int)number, - opt_flags); } + if (flags & P_NUM) + return set_num_option(opt_idx, varp, number, + NULL, 0, opt_flags); + else + return set_bool_option(opt_idx, varp, (int)number, opt_flags); } + } return NULL; }