mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.2871: unnessary VIM_ISDIGIT() calls, badly indented code
Problem: Unnessary VIM_ISDIGIT() calls, badly indented code. Solution: Call skipdigits() on the next character. Improve indenting. (Dominique Pellé, closes #8227)
This commit is contained in:
parent
796139ae3a
commit
4781d6fd86
@ -169,8 +169,7 @@ buf_init_chartab(
|
|||||||
}
|
}
|
||||||
if (VIM_ISDIGIT(*p))
|
if (VIM_ISDIGIT(*p))
|
||||||
c = getdigits(&p);
|
c = getdigits(&p);
|
||||||
else
|
else if (has_mbyte)
|
||||||
if (has_mbyte)
|
|
||||||
c = mb_ptr2char_adv(&p);
|
c = mb_ptr2char_adv(&p);
|
||||||
else
|
else
|
||||||
c = *p++;
|
c = *p++;
|
||||||
@ -180,8 +179,7 @@ buf_init_chartab(
|
|||||||
++p;
|
++p;
|
||||||
if (VIM_ISDIGIT(*p))
|
if (VIM_ISDIGIT(*p))
|
||||||
c2 = getdigits(&p);
|
c2 = getdigits(&p);
|
||||||
else
|
else if (has_mbyte)
|
||||||
if (has_mbyte)
|
|
||||||
c2 = mb_ptr2char_adv(&p);
|
c2 = mb_ptr2char_adv(&p);
|
||||||
else
|
else
|
||||||
c2 = *p++;
|
c2 = *p++;
|
||||||
|
@ -9674,9 +9674,9 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (t_colors > 1)
|
if (t_colors > 1)
|
||||||
modec = 'c';
|
modec = 'c';
|
||||||
else
|
else
|
||||||
modec = 't';
|
modec = 't';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (TOLOWER_ASC(what[0]))
|
switch (TOLOWER_ASC(what[0]))
|
||||||
|
@ -2384,7 +2384,7 @@ do_one_cmd(
|
|||||||
* count, it's a buffer name.
|
* count, it's a buffer name.
|
||||||
*/
|
*/
|
||||||
if ((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg)
|
if ((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg)
|
||||||
&& (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg)) == NUL
|
&& (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg + 1)) == NUL
|
||||||
|| VIM_ISWHITE(*p)))
|
|| VIM_ISWHITE(*p)))
|
||||||
{
|
{
|
||||||
n = getdigits(&ea.arg);
|
n = getdigits(&ea.arg);
|
||||||
@ -3730,7 +3730,7 @@ modifier_len(char_u *cmd)
|
|||||||
char_u *p = cmd;
|
char_u *p = cmd;
|
||||||
|
|
||||||
if (VIM_ISDIGIT(*cmd))
|
if (VIM_ISDIGIT(*cmd))
|
||||||
p = skipwhite(skipdigits(cmd));
|
p = skipwhite(skipdigits(cmd + 1));
|
||||||
for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i)
|
for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i)
|
||||||
{
|
{
|
||||||
for (j = 0; p[j] != NUL; ++j)
|
for (j = 0; p[j] != NUL; ++j)
|
||||||
|
@ -607,7 +607,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
|
|||||||
cur_item = res;
|
cur_item = res;
|
||||||
init_tv(&item);
|
init_tv(&item);
|
||||||
if (res != NULL)
|
if (res != NULL)
|
||||||
init_tv(res);
|
init_tv(res);
|
||||||
|
|
||||||
fill_numbuflen(reader);
|
fill_numbuflen(reader);
|
||||||
p = reader->js_buf + reader->js_used;
|
p = reader->js_buf + reader->js_used;
|
||||||
|
@ -3985,12 +3985,13 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
|
|||||||
op_formatexpr(oap); // use expression
|
op_formatexpr(oap); // use expression
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
if (*p_fp != NUL || *curbuf->b_p_fp != NUL)
|
if (*p_fp != NUL || *curbuf->b_p_fp != NUL)
|
||||||
op_colon(oap); // use external command
|
op_colon(oap); // use external command
|
||||||
else
|
else
|
||||||
op_format(oap, FALSE); // use internal function
|
op_format(oap, FALSE); // use internal function
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_FORMAT2:
|
case OP_FORMAT2:
|
||||||
op_format(oap, TRUE); // use internal function
|
op_format(oap, TRUE); // use internal function
|
||||||
break;
|
break;
|
||||||
|
@ -3824,7 +3824,7 @@ find_extra(char_u **pp)
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (VIM_ISDIGIT(*str))
|
if (VIM_ISDIGIT(*str))
|
||||||
str = skipdigits(str);
|
str = skipdigits(str + 1);
|
||||||
else if (*str == '/' || *str == '?')
|
else if (*str == '/' || *str == '?')
|
||||||
{
|
{
|
||||||
str = skip_regexp(str + 1, *str, FALSE);
|
str = skip_regexp(str + 1, *str, FALSE);
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2871,
|
||||||
/**/
|
/**/
|
||||||
2870,
|
2870,
|
||||||
/**/
|
/**/
|
||||||
|
@ -8341,11 +8341,11 @@ compile_endtry(char_u *arg, cctx_T *cctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_PROFILE
|
#ifdef FEAT_PROFILE
|
||||||
if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||||
.isn_type == ISN_PROF_START)
|
.isn_type == ISN_PROF_START)
|
||||||
// move the profile start after "endtry" so that it's not counted when
|
// move the profile start after "endtry" so that it's not counted when
|
||||||
// the exception is rethrown.
|
// the exception is rethrown.
|
||||||
--instr->ga_len;
|
--instr->ga_len;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fill in the "end" label in jumps at the end of the blocks, if not
|
// Fill in the "end" label in jumps at the end of the blocks, if not
|
||||||
|
Loading…
x
Reference in New Issue
Block a user