Mercurial > vim
comparison src/syntax.c @ 20830:9064044fd4f6 v8.2.0967
patch 8.2.0967: unnecessary type casts for vim_strnsave()
Commit: https://github.com/vim/vim/commit/71ccd03ee8a43b20000214a9c99dcc90f039edca
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 12 22:59:11 2020 +0200
patch 8.2.0967: unnecessary type casts for vim_strnsave()
Problem: Unnecessary type casts for vim_strnsave().
Solution: Remove the type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 12 Jun 2020 23:00:04 +0200 |
parents | d9a2e5dcfd9f |
children | e35955a787a8 |
comparison
equal
deleted
inserted
replaced
20829:3d0d6410aecd | 20830:9064044fd4f6 |
---|---|
4650 } | 4650 } |
4651 gname_start = arg; | 4651 gname_start = arg; |
4652 arg = skiptowhite(arg); | 4652 arg = skiptowhite(arg); |
4653 if (gname_start == arg) | 4653 if (gname_start == arg) |
4654 return NULL; | 4654 return NULL; |
4655 gname = vim_strnsave(gname_start, (int)(arg - gname_start)); | 4655 gname = vim_strnsave(gname_start, arg - gname_start); |
4656 if (gname == NULL) | 4656 if (gname == NULL) |
4657 return NULL; | 4657 return NULL; |
4658 if (STRCMP(gname, "NONE") == 0) | 4658 if (STRCMP(gname, "NONE") == 0) |
4659 *opt->sync_idx = NONE_IDX; | 4659 *opt->sync_idx = NONE_IDX; |
4660 else | 4660 else |
4661 { | 4661 { |
4662 syn_id = syn_name2id(gname); | 4662 syn_id = syn_name2id(gname); |
4663 for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; ) | 4663 for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; ) |
4664 if (SYN_ITEMS(curwin->w_s)[i].sp_syn.id == syn_id | 4664 if (SYN_ITEMS(curwin->w_s)[i].sp_syn.id == syn_id |
4665 && SYN_ITEMS(curwin->w_s)[i].sp_type == SPTYPE_START) | 4665 && SYN_ITEMS(curwin->w_s)[i].sp_type |
4666 == SPTYPE_START) | |
4666 { | 4667 { |
4667 *opt->sync_idx = i; | 4668 *opt->sync_idx = i; |
4668 break; | 4669 break; |
4669 } | 4670 } |
4670 if (i < 0) | 4671 if (i < 0) |
5654 { | 5655 { |
5655 semsg(_("E401: Pattern delimiter not found: %s"), arg); | 5656 semsg(_("E401: Pattern delimiter not found: %s"), arg); |
5656 return NULL; | 5657 return NULL; |
5657 } | 5658 } |
5658 // store the pattern and compiled regexp program | 5659 // store the pattern and compiled regexp program |
5659 if ((ci->sp_pattern = vim_strnsave(arg + 1, (int)(end - arg - 1))) == NULL) | 5660 if ((ci->sp_pattern = vim_strnsave(arg + 1, end - arg - 1)) == NULL) |
5660 return NULL; | 5661 return NULL; |
5661 | 5662 |
5662 // Make 'cpoptions' empty, to avoid the 'l' flag | 5663 // Make 'cpoptions' empty, to avoid the 'l' flag |
5663 cpo_save = p_cpo; | 5664 cpo_save = p_cpo; |
5664 p_cpo = (char_u *)""; | 5665 p_cpo = (char_u *)""; |
5834 } | 5835 } |
5835 | 5836 |
5836 if (!eap->skip) | 5837 if (!eap->skip) |
5837 { | 5838 { |
5838 // store the pattern and compiled regexp program | 5839 // store the pattern and compiled regexp program |
5839 if ((curwin->w_s->b_syn_linecont_pat = vim_strnsave(next_arg + 1, | 5840 if ((curwin->w_s->b_syn_linecont_pat = |
5840 (int)(arg_end - next_arg - 1))) == NULL) | 5841 vim_strnsave(next_arg + 1, |
5842 arg_end - next_arg - 1)) == NULL) | |
5841 { | 5843 { |
5842 finished = TRUE; | 5844 finished = TRUE; |
5843 break; | 5845 break; |
5844 } | 5846 } |
5845 curwin->w_s->b_syn_linecont_ic = curwin->w_s->b_syn_ic; | 5847 curwin->w_s->b_syn_linecont_ic = curwin->w_s->b_syn_ic; |
6270 syn_cmdlinep = eap->cmdlinep; | 6272 syn_cmdlinep = eap->cmdlinep; |
6271 | 6273 |
6272 // isolate subcommand name | 6274 // isolate subcommand name |
6273 for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); ++subcmd_end) | 6275 for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); ++subcmd_end) |
6274 ; | 6276 ; |
6275 subcmd_name = vim_strnsave(arg, (int)(subcmd_end - arg)); | 6277 subcmd_name = vim_strnsave(arg, subcmd_end - arg); |
6276 if (subcmd_name != NULL) | 6278 if (subcmd_name != NULL) |
6277 { | 6279 { |
6278 if (eap->skip) // skip error messages for all subcommands | 6280 if (eap->skip) // skip error messages for all subcommands |
6279 ++emsg_skip; | 6281 ++emsg_skip; |
6280 for (i = 0; ; ++i) | 6282 for (i = 0; ; ++i) |