*: Fix linter errors

Big function in expressions.c may be refactored, if I ever catch the idea how to 
split it right.
This commit is contained in:
ZyX
2017-10-30 01:32:10 +03:00
parent b29a776550
commit a9b203d23f
6 changed files with 47 additions and 40 deletions

View File

@@ -6080,7 +6080,7 @@ char_u *add_char2buf(int c, char_u *s)
{
char_u temp[MB_MAXBYTES + 1];
const int len = utf_char2bytes(c, temp);
for (int i = 0; i < len; ++i) {
for (int i = 0; i < len; i++) {
c = temp[i];
// Need to escape K_SPECIAL and CSI like in the typeahead buffer.
if (c == K_SPECIAL) {

View File

@@ -25,8 +25,8 @@
*/
static const struct modmasktable {
short mod_mask; ///< Bit-mask for particular key modifier.
short mod_flag; ///< Bit(s) for particular key modifier.
uint16_t mod_mask; ///< Bit-mask for particular key modifier.
uint16_t mod_flag; ///< Bit(s) for particular key modifier.
char_u name; ///< Single letter name of modifier.
} mod_mask_table[] = {
{ MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'M' },

View File

@@ -98,15 +98,23 @@ const uint8_t utf8len_tab[] = {
// Like utf8len_tab above, but using a zero for illegal lead bytes.
const uint8_t utf8len_tab_zero[] = {
//1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 2
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 4
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 6
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 8
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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 0, // F?
};
/*

View File

@@ -5930,7 +5930,8 @@ static void syntime_report(void)
// When making changes here, also change runtime/colors/default.vim!
static const char *highlight_init_both[] = {
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
"Conceal "
"ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
"Cursor guibg=fg guifg=bg",
"lCursor guibg=fg guifg=bg",
"DiffText cterm=bold ctermbg=Red gui=bold guibg=Red",
@@ -6211,11 +6212,9 @@ void syn_init_cmdline_highlight(bool reset, bool init)
///
/// @param both include groups where 'bg' doesn't matter
/// @param reset clear groups first
void
init_highlight(int both, int reset)
void init_highlight(bool both, bool reset)
{
int i;
static int had_both = FALSE;
static int had_both = false;
// Try finding the color scheme file. Used when a color file was loaded
// and 'background' or 't_Co' is changed.
@@ -6235,9 +6234,9 @@ init_highlight(int both, int reset)
* Didn't use a color file, use the compiled-in colors.
*/
if (both) {
had_both = TRUE;
had_both = true;
const char *const *const pp = highlight_init_both;
for (i = 0; pp[i] != NULL; i++) {
for (size_t i = 0; pp[i] != NULL; i++) {
do_highlight(pp[i], reset, true);
}
} else if (!had_both) {
@@ -6250,7 +6249,7 @@ init_highlight(int both, int reset)
const char *const *const pp = ((*p_bg == 'l')
? highlight_init_light
: highlight_init_dark);
for (i = 0; pp[i] != NULL; i++) {
for (size_t i = 0; pp[i] != NULL; i++) {
do_highlight(pp[i], reset, true);
}
@@ -6266,9 +6265,10 @@ init_highlight(int both, int reset)
: "Visual cterm=NONE ctermbg=DarkGrey"), false, true);
} else {
do_highlight("Visual cterm=reverse ctermbg=NONE", false, true);
if (*p_bg == 'l')
if (*p_bg == 'l') {
do_highlight("Search ctermfg=black", false, true);
}
}
/*
* If syntax highlighting is enabled load the highlighting for it.
@@ -6452,7 +6452,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
restore_cterm_colors();
// Clear all default highlight groups and load the defaults.
for (int idx = 0; idx < highlight_ga.ga_len; ++idx) {
for (int idx = 0; idx < highlight_ga.ga_len; idx++) {
highlight_clear(idx);
}
init_highlight(true, true);
@@ -6690,8 +6690,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
if (i < 0) {
emsgf(_(
"E421: Color name or number not recognized: %s"),
emsgf(_("E421: Color name or number not recognized: %s"),
key_start);
error = true;
break;

View File

@@ -2853,7 +2853,7 @@ viml_pexpr_parse_end:
}
kvi_destroy(ast_stack);
return ast;
}
} // NOLINT(readability/fn_size)
#undef NEW_NODE
#undef HL