diff options
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r-- | src/nvim/syntax.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index b7a485598b..6787ca8080 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -3943,7 +3943,7 @@ get_syn_options ( if (strchr(first_letters, *arg) == NULL) break; - for (fidx = sizeof(flagtab) / sizeof(struct flag); --fidx >= 0; ) { + for (fidx = ARRAY_SIZE(flagtab); --fidx >= 0; ) { p = flagtab[fidx].name; int i; for (i = 0, len = 0; p[i] != NUL; i += 2, ++len) @@ -5157,22 +5157,21 @@ get_id_list ( regmatch.rm_ic = TRUE; id = 0; for (int i = highlight_ga.ga_len; --i >= 0; ) { - if (!vim_regexec(®match, HL_TABLE()[i].sg_name, (colnr_T)0)) { - continue; - } - if (round == 2) { - /* Got more items than expected; can happen - * when adding items that match: - * "contains=a.*b,axb". - * Go back to first round */ - if (count >= total_count) { - free(retval); - round = 1; - } else - retval[count] = i + 1; + if (vim_regexec(®match, HL_TABLE()[i].sg_name, (colnr_T)0)) { + if (round == 2) { + /* Got more items than expected; can happen + * when adding items that match: + * "contains=a.*b,axb". + * Go back to first round */ + if (count >= total_count) { + free(retval); + round = 1; + } else + retval[count] = i + 1; + } + ++count; + id = -1; /* remember that we found one */ } - ++count; - id = -1; /* remember that we found one */ } vim_regfree(regmatch.regprog); } @@ -6296,7 +6295,7 @@ do_highlight ( attr = 0; off = 0; while (arg[off] != NUL) { - for (i = sizeof(hl_attr_table) / sizeof(int); --i >= 0; ) { + for (i = ARRAY_SIZE(hl_attr_table); --i >= 0; ) { len = (int)STRLEN(hl_name_table[i]); if (STRNICMP(arg + off, hl_name_table[i], len) == 0) { attr |= hl_attr_table[i]; @@ -6417,7 +6416,7 @@ do_highlight ( /* reduce calls to STRICMP a bit, it can be slow */ off = TOUPPER_ASC(*arg); - for (i = (sizeof(color_names) / sizeof(char *)); --i >= 0; ) + for (i = ARRAY_SIZE(color_names); --i >= 0; ) if (off == color_names[i][0] && STRICMP(arg + 1, color_names[i] + 1) == 0) break; |