aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-10-30 01:32:10 +0300
committerZyX <kp-pav@yandex.ru>2017-10-30 01:32:10 +0300
commita9b203d23fcc6ba8c4e298b8e082db990e1ec04f (patch)
treeca7c6ca700a8aeef99069f45c6355c48a2217783 /src
parentb29a776550dadefefb891d01054ea21eb942bad1 (diff)
downloadrneovim-a9b203d23fcc6ba8c4e298b8e082db990e1ec04f.tar.gz
rneovim-a9b203d23fcc6ba8c4e298b8e082db990e1ec04f.tar.bz2
rneovim-a9b203d23fcc6ba8c4e298b8e082db990e1ec04f.zip
*: Fix linter errors
Big function in expressions.c may be refactored, if I ever catch the idea how to split it right.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/edit.c2
-rw-r--r--src/nvim/keymap.c24
-rw-r--r--src/nvim/mbyte.c26
-rw-r--r--src/nvim/syntax.c25
-rw-r--r--src/nvim/viml/parser/expressions.c8
-rw-r--r--src/nvim/viml/parser/expressions.h2
6 files changed, 47 insertions, 40 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 28722a4d10..859f98d2ad 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -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) {
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 6ed54464e8..0c8e47b02e 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -25,21 +25,21 @@
*/
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'},
- {MOD_MASK_META, MOD_MASK_META, (char_u)'T'},
- {MOD_MASK_CTRL, MOD_MASK_CTRL, (char_u)'C'},
- {MOD_MASK_SHIFT, MOD_MASK_SHIFT, (char_u)'S'},
- {MOD_MASK_MULTI_CLICK, MOD_MASK_2CLICK, (char_u)'2'},
- {MOD_MASK_MULTI_CLICK, MOD_MASK_3CLICK, (char_u)'3'},
- {MOD_MASK_MULTI_CLICK, MOD_MASK_4CLICK, (char_u)'4'},
- {MOD_MASK_CMD, MOD_MASK_CMD, (char_u)'D'},
+ { MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'M' },
+ { MOD_MASK_META, MOD_MASK_META, (char_u)'T' },
+ { MOD_MASK_CTRL, MOD_MASK_CTRL, (char_u)'C' },
+ { MOD_MASK_SHIFT, MOD_MASK_SHIFT, (char_u)'S' },
+ { MOD_MASK_MULTI_CLICK, MOD_MASK_2CLICK, (char_u)'2' },
+ { MOD_MASK_MULTI_CLICK, MOD_MASK_3CLICK, (char_u)'3' },
+ { MOD_MASK_MULTI_CLICK, MOD_MASK_4CLICK, (char_u)'4' },
+ { MOD_MASK_CMD, MOD_MASK_CMD, (char_u)'D' },
// 'A' must be the last one
- {MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'A'},
- {0, 0, NUL}
+ { MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'A' },
+ { 0, 0, NUL }
};
/*
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index 843007b97b..008bce6df6 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -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,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 1, 1, 1, 1, // 7?
+ 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, // 9?
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // A?
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // B?
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // C?
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // D?
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // E?
+ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0, // F?
};
/*
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index d787790bc3..e0bf74567d 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -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,8 +6265,9 @@ 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);
+ }
}
/*
@@ -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,9 +6690,8 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
if (i < 0) {
- emsgf(_(
- "E421: Color name or number not recognized: %s"),
- key_start);
+ emsgf(_("E421: Color name or number not recognized: %s"),
+ key_start);
error = true;
break;
}
diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c
index f5bc547d54..fc184f56f5 100644
--- a/src/nvim/viml/parser/expressions.c
+++ b/src/nvim/viml/parser/expressions.c
@@ -1814,8 +1814,8 @@ ExprAST viml_pexpr_parse(ParserState *const pstate, const int flags)
|| ((*kv_Z(ast_stack, 1))->type != kExprNodeConcat
&& ((*kv_Z(ast_stack, 1))->type
!= kExprNodeConcatOrSubscript))))
- ? kELFlagAllowFloat
- : 0));
+ ? kELFlagAllowFloat
+ : 0));
LexExprToken cur_token = viml_pexpr_next_token(
pstate, want_node_to_lexer_flags[want_node] | lexer_additional_flags);
if (cur_token.type == kExprLexEOC) {
@@ -1876,7 +1876,7 @@ viml_pexpr_parse_process_token:
// time.
//
// Here example will always contain a concat with "a:2" sucking colon,
- // making expression invalid both because there is no longer a spare colon
+ // making expression invalid both because there is no longer a spare colon
// for ternary and because concatenating dictionary with anything is not
// valid. There are more cases when this will make a difference though.
const bool node_is_key = (
@@ -2853,7 +2853,7 @@ viml_pexpr_parse_end:
}
kvi_destroy(ast_stack);
return ast;
-}
+} // NOLINT(readability/fn_size)
#undef NEW_NODE
#undef HL
diff --git a/src/nvim/viml/parser/expressions.h b/src/nvim/viml/parser/expressions.h
index d00d4855f3..668c2a4c84 100644
--- a/src/nvim/viml/parser/expressions.h
+++ b/src/nvim/viml/parser/expressions.h
@@ -189,7 +189,7 @@ typedef enum {
kExprNodeCall, ///< Function call.
/// Plain identifier: simple variable/function name
///
- /// Looks like "string", "g:Foo", etc: consists from a single
+ /// Looks like "string", "g:Foo", etc: consists from a single
/// kExprLexPlainIdentifier token.
kExprNodePlainIdentifier,
/// Plain dictionary key, for use with kExprNodeConcatOrSubscript