aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-27 12:14:32 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-27 14:05:41 -0500
commit883114e8824ecf5094faa2c860bd1379228d209f (patch)
tree4cfa4e02744ad97a2f03c2bfec397bbb0a4cdc6b /src/nvim/syntax.c
parented0131e3d941edce315bc115b68ebf33bf6eaf31 (diff)
downloadrneovim-883114e8824ecf5094faa2c860bd1379228d209f.tar.gz
rneovim-883114e8824ecf5094faa2c860bd1379228d209f.tar.bz2
rneovim-883114e8824ecf5094faa2c860bd1379228d209f.zip
vim-patch:8.2.0928: many type casts are used for vim_strnsave()
Problem: Many type casts are used for vim_strnsave(). Solution: Make the length argument size_t instead of int. (Ken Takata, closes vim/vim#5633) Remove some type casts. https://github.com/vim/vim/commit/df44a27b53586fccfc6a3aedc89061fdd9a515ff N/A patches for version.c: vim-patch:8.2.0315: build failure on HP-UX system Problem: Build failure on HP-UX system. Solution: Use LONG_LONG_MIN instead of LLONG_MIN. Add type casts for switch statement. (John Marriott) https://github.com/vim/vim/commit/c593bec4120f122e8a9129ec461968f1bd214435 vim-patch:8.2.1052: build failure with older compilers Problem: Build failure with older compilers. Solution: Move declaration to start of block. https://github.com/vim/vim/commit/7acde51832f383f9a6d2e740cd0420b433ea841a vim-patch:8.2.2229: build failure without the +eval feature Problem: build failure without the +eval feature. Solution: Add #ifdef. https://github.com/vim/vim/commit/39cb2dab18e85fc60f116a4543e433616872b690 vim-patch:8.2.2232: compiler error for falling through into next case Problem: Compiler error for falling through into next case. Solution: Move FALLTHROUGH below the #endif https://github.com/vim/vim/commit/9618a25b9c054f0ee4e267d2db96b6e7c113ed7a
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index e91d560284..4d88df5a3a 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -4186,10 +4186,10 @@ get_syn_options(
arg = skiptowhite(arg);
if (gname_start == arg)
return NULL;
- gname = vim_strnsave(gname_start, (int)(arg - gname_start));
- if (STRCMP(gname, "NONE") == 0)
+ gname = vim_strnsave(gname_start, arg - gname_start);
+ if (STRCMP(gname, "NONE") == 0) {
*opt->sync_idx = NONE_IDX;
- else {
+ } else {
syn_id = syn_name2id(gname);
int i;
for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; )
@@ -4587,7 +4587,7 @@ syn_cmd_region(
while (*key_end && !ascii_iswhite(*key_end) && *key_end != '=')
++key_end;
xfree(key);
- key = vim_strnsave_up(rest, (int)(key_end - rest));
+ key = vim_strnsave_up(rest, key_end - rest);
if (STRCMP(key, "MATCHGROUP") == 0) {
item = ITEM_MATCHGROUP;
} else if (STRCMP(key, "START") == 0) {
@@ -5047,8 +5047,8 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
EMSG2(_("E401: Pattern delimiter not found: %s"), arg);
return NULL;
}
- /* store the pattern and compiled regexp program */
- ci->sp_pattern = vim_strnsave(arg + 1, (int)(end - arg - 1));
+ // store the pattern and compiled regexp program
+ ci->sp_pattern = vim_strnsave(arg + 1, end - arg - 1);
/* Make 'cpoptions' empty, to avoid the 'l' flag */
cpo_save = p_cpo;
@@ -5136,7 +5136,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
arg_end = skiptowhite(arg_start);
next_arg = skipwhite(arg_end);
xfree(key);
- key = vim_strnsave_up(arg_start, (int)(arg_end - arg_start));
+ key = vim_strnsave_up(arg_start, arg_end - arg_start);
if (STRCMP(key, "CCOMMENT") == 0) {
if (!eap->skip)
curwin->w_s->b_syn_sync_flags |= SF_CCOMMENT;
@@ -5195,7 +5195,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
if (!eap->skip) {
/* store the pattern and compiled regexp program */
curwin->w_s->b_syn_linecont_pat =
- vim_strnsave(next_arg + 1, (int)(arg_end - next_arg - 1));
+ vim_strnsave(next_arg + 1, arg_end - next_arg - 1);
curwin->w_s->b_syn_linecont_ic = curwin->w_s->b_syn_ic;
/* Make 'cpoptions' empty, to avoid the 'l' flag */
@@ -5555,18 +5555,17 @@ void ex_syntax(exarg_T *eap)
{
char_u *arg = eap->arg;
char_u *subcmd_end;
- char_u *subcmd_name;
- int i;
syn_cmdlinep = eap->cmdlinep;
- /* isolate subcommand name */
- for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); ++subcmd_end)
- ;
- subcmd_name = vim_strnsave(arg, (int)(subcmd_end - arg));
- if (eap->skip) /* skip error messages for all subcommands */
- ++emsg_skip;
- for (i = 0;; ++i) {
+ // isolate subcommand name
+ for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); subcmd_end++) {
+ }
+ char_u *const subcmd_name = vim_strnsave(arg, subcmd_end - arg);
+ if (eap->skip) { // skip error messages for all subcommands
+ emsg_skip++;
+ }
+ for (int i = 0;; i++) {
if (subcommands[i].name == NULL) {
EMSG2(_("E410: Invalid :syntax subcommand: %s"), subcmd_name);
break;
@@ -6719,7 +6718,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
xfree(key);
key = (char *)vim_strnsave_up((const char_u *)key_start,
- (int)(linep - key_start));
+ linep - key_start);
linep = (const char *)skipwhite((const char_u *)linep);
if (strcmp(key, "NONE") == 0) {