diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-31 18:34:32 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-07-31 18:34:32 +0100 |
commit | 101d57b34b72f4fbc7df1b6edfd64c64a6be14fc (patch) | |
tree | 246feb7236973fb7a526652ab5795f49a808e553 /src/help.c | |
parent | c146d974f13450453a7c1f5ab10b105c515f0ccb (diff) |
patch 9.0.0124: code has more indent than neededv9.0.0124
Problem: Code has more indent than needed.
Solution: Use continue and return statements. (closes #10824)
Diffstat (limited to 'src/help.c')
-rw-r--r-- | src/help.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/help.c b/src/help.c index 0f43c0063c..9dbd2561f5 100644 --- a/src/help.c +++ b/src/help.c @@ -1220,38 +1220,38 @@ do_helptags(char_u *dirname, int add_help_tags, int ignore_writeerr) for (i = 0; i < filecount; ++i) { len = (int)STRLEN(files[i]); - if (len > 4) + if (len <= 4) + continue; + + if (STRICMP(files[i] + len - 4, ".txt") == 0) { - if (STRICMP(files[i] + len - 4, ".txt") == 0) - { - // ".txt" -> language "en" - lang[0] = 'e'; - lang[1] = 'n'; - } - else if (files[i][len - 4] == '.' - && ASCII_ISALPHA(files[i][len - 3]) - && ASCII_ISALPHA(files[i][len - 2]) - && TOLOWER_ASC(files[i][len - 1]) == 'x') - { - // ".abx" -> language "ab" - lang[0] = TOLOWER_ASC(files[i][len - 3]); - lang[1] = TOLOWER_ASC(files[i][len - 2]); - } - else - continue; + // ".txt" -> language "en" + lang[0] = 'e'; + lang[1] = 'n'; + } + else if (files[i][len - 4] == '.' + && ASCII_ISALPHA(files[i][len - 3]) + && ASCII_ISALPHA(files[i][len - 2]) + && TOLOWER_ASC(files[i][len - 1]) == 'x') + { + // ".abx" -> language "ab" + lang[0] = TOLOWER_ASC(files[i][len - 3]); + lang[1] = TOLOWER_ASC(files[i][len - 2]); + } + else + continue; - // Did we find this language already? - for (j = 0; j < ga.ga_len; j += 2) - if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0) - break; - if (j == ga.ga_len) - { - // New language, add it. - if (ga_grow(&ga, 2) == FAIL) - break; - ((char_u *)ga.ga_data)[ga.ga_len++] = lang[0]; - ((char_u *)ga.ga_data)[ga.ga_len++] = lang[1]; - } + // Did we find this language already? + for (j = 0; j < ga.ga_len; j += 2) + if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0) + break; + if (j == ga.ga_len) + { + // New language, add it. + if (ga_grow(&ga, 2) == FAIL) + break; + ((char_u *)ga.ga_data)[ga.ga_len++] = lang[0]; + ((char_u *)ga.ga_data)[ga.ga_len++] = lang[1]; } } |