vim-patch:8.0.0481: unnecessary if statement

Problem:    Unnecessary if statement.
Solution:   Remove the statement.  Fix "it's" vs "its" mistakes. (Dominique
            Pelle, closes vim/vim#1568)
aab93b12cb
This commit is contained in:
Jan Edmund Lazo
2018-06-08 09:47:32 -04:00
parent eeeaf04c5e
commit 2add88eedc

View File

@@ -491,7 +491,7 @@ void syntax_start(win_T *wp, linenr_T lnum)
while (current_lnum < lnum) { while (current_lnum < lnum) {
syn_start_line(); syn_start_line();
(void)syn_finish_line(FALSE); (void)syn_finish_line(FALSE);
++current_lnum; current_lnum++;
/* If we parsed at least "minlines" lines or started at a valid /* If we parsed at least "minlines" lines or started at a valid
* state, the current state is considered valid. */ * state, the current state is considered valid. */
@@ -723,10 +723,8 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
syn_start_line(); syn_start_line();
for (;; ) { for (;; ) {
had_sync_point = syn_finish_line(TRUE); had_sync_point = syn_finish_line(TRUE);
/* // When a sync point has been found, remember where, and
* When a sync point has been found, remember where, and // continue to look for another one, further on in the line.
* continue to look for another one, further on in the line.
*/
if (had_sync_point && current_state.ga_len) { if (had_sync_point && current_state.ga_len) {
cur_si = &CUR_STATE(current_state.ga_len - 1); cur_si = &CUR_STATE(current_state.ga_len - 1);
if (cur_si->si_m_endpos.lnum > start_lnum) { if (cur_si->si_m_endpos.lnum > start_lnum) {
@@ -805,9 +803,10 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
current_col = found_m_endpos.col; current_col = found_m_endpos.col;
current_lnum = found_m_endpos.lnum; current_lnum = found_m_endpos.lnum;
(void)syn_finish_line(FALSE); (void)syn_finish_line(FALSE);
++current_lnum; current_lnum++;
} else } else {
current_lnum = start_lnum; current_lnum = start_lnum;
}
break; break;
} }
@@ -1531,7 +1530,7 @@ int syntax_check_changed(linenr_T lnum)
*/ */
static int static int
syn_finish_line( syn_finish_line(
int syncing /* called for syncing */ int syncing // called for syncing
) )
{ {
stateitem_T *cur_si; stateitem_T *cur_si;
@@ -1549,19 +1548,21 @@ syn_finish_line (
cur_si = &CUR_STATE(current_state.ga_len - 1); cur_si = &CUR_STATE(current_state.ga_len - 1);
if (cur_si->si_idx >= 0 if (cur_si->si_idx >= 0
&& (SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags && (SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags
& (HL_SYNC_HERE|HL_SYNC_THERE))) & (HL_SYNC_HERE|HL_SYNC_THERE))) {
return TRUE; return TRUE;
}
/* syn_current_attr() will have skipped the check for an item /* syn_current_attr() will have skipped the check for an item
* that ends here, need to do that now. Be careful not to go * that ends here, need to do that now. Be careful not to go
* past the NUL. */ * past the NUL. */
prev_current_col = current_col; prev_current_col = current_col;
if (syn_getcurline()[current_col] != NUL) if (syn_getcurline()[current_col] != NUL) {
++current_col; current_col++;
}
check_state_ends(); check_state_ends();
current_col = prev_current_col; current_col = prev_current_col;
} }
++current_col; current_col++;
} }
return FALSE; return FALSE;
} }
@@ -1626,10 +1627,10 @@ get_syntax_attr (
*/ */
static int static int
syn_current_attr( syn_current_attr(
int syncing, /* When 1: called for syncing */ int syncing, // When 1: called for syncing
int displaying, /* result will be displayed */ int displaying, // result will be displayed
bool *can_spell, /* return: do spell checking */ bool *can_spell, // return: do spell checking
int keep_state /* keep syntax stack afterwards */ int keep_state // keep syntax stack afterwards
) )
{ {
int syn_id; int syn_id;
@@ -2553,14 +2554,14 @@ static void pop_current_state(void)
*/ */
static void static void
find_endpos( find_endpos(
int idx, /* index of the pattern */ int idx, // index of the pattern
lpos_T *startpos, /* where to start looking for an END match */ lpos_T *startpos, // where to start looking for an END match
lpos_T *m_endpos, /* return: end of match */ lpos_T *m_endpos, // return: end of match
lpos_T *hl_endpos, /* return: end of highlighting */ lpos_T *hl_endpos, // return: end of highlighting
long *flagsp, /* return: flags of matching END */ long *flagsp, // return: flags of matching END
lpos_T *end_endpos, /* return: end of end pattern match */ lpos_T *end_endpos, // return: end of end pattern match
int *end_idx, /* return: group ID for end pat. match, or 0 */ int *end_idx, // return: group ID for end pat. match, or 0
reg_extmatch_T *start_ext /* submatches from the start pattern */ reg_extmatch_T *start_ext // submatches from the start pattern
) )
{ {
colnr_T matchcol; colnr_T matchcol;
@@ -2795,11 +2796,11 @@ static void limit_pos_zero(lpos_T *pos, lpos_T *limit)
*/ */
static void static void
syn_add_end_off( syn_add_end_off(
lpos_T *result, /* returned position */ lpos_T *result, // returned position
regmmatch_T *regmatch, /* start/end of match */ regmmatch_T *regmatch, // start/end of match
synpat_T *spp, /* matched pattern */ synpat_T *spp, // matched pattern
int idx, /* index of offset */ int idx, // index of offset
int extra /* extra chars for offset to start */ int extra // extra chars for offset to start
) )
{ {
int col; int col;
@@ -2843,11 +2844,11 @@ syn_add_end_off (
*/ */
static void static void
syn_add_start_off( syn_add_start_off(
lpos_T *result, /* returned position */ lpos_T *result, // returned position
regmmatch_T *regmatch, /* start/end of match */ regmmatch_T *regmatch, // start/end of match
synpat_T *spp, synpat_T *spp,
int idx, int idx,
int extra /* extra chars for offset to end */ int extra // extra chars for offset to end
) )
{ {
int col; int col;
@@ -2933,7 +2934,7 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T
/* /*
* Check one position in a line for a matching keyword. * Check one position in a line for a matching keyword.
* The caller must check if a keyword can start at startcol. * The caller must check if a keyword can start at startcol.
* Return it's ID if found, 0 otherwise. * Return its ID if found, 0 otherwise.
*/ */
static int static int
check_keyword_id( check_keyword_id(
@@ -4838,10 +4839,8 @@ static void syn_combine_list(short **clstr1, short **clstr2, int list_op)
*clstr1 = clstr; *clstr1 = clstr;
} }
/* // Lookup a syntax cluster name and return its ID.
* Lookup a syntax cluster name and return it's ID. // If it is not found, 0 is returned.
* If it is not found, 0 is returned.
*/
static int syn_scl_name2id(char_u *name) static int syn_scl_name2id(char_u *name)
{ {
// Avoid using stricmp() too much, it's slow on some systems // Avoid using stricmp() too much, it's slow on some systems
@@ -4869,12 +4868,10 @@ static int syn_scl_namen2id(char_u *linep, int len)
return id; return id;
} }
/* // Find syntax cluster name in the table and return its ID.
* Find syntax cluster name in the table and return it's ID. // The argument is a pointer to the name and the length of the name.
* The argument is a pointer to the name and the length of the name. // If it doesn't exist yet, a new entry is created.
* If it doesn't exist yet, a new entry is created. // Return 0 for failure.
* Return 0 for failure.
*/
static int syn_check_cluster(char_u *pp, int len) static int syn_check_cluster(char_u *pp, int len)
{ {
int id; int id;
@@ -4890,11 +4887,9 @@ static int syn_check_cluster(char_u *pp, int len)
return id; return id;
} }
/* // Add new syntax cluster and return its ID.
* Add new syntax cluster and return it's ID. // "name" must be an allocated string, it will be consumed.
* "name" must be an allocated string, it will be consumed. // Return 0 for failure.
* Return 0 for failure.
*/
static int syn_add_cluster(char_u *name) static int syn_add_cluster(char_u *name)
{ {
/* /*
@@ -5423,16 +5418,16 @@ static short *copy_id_list(short *list)
*/ */
static int static int
in_id_list( in_id_list(
stateitem_T *cur_si, /* current item or NULL */ stateitem_T *cur_si, // current item or NULL
short *list, /* id list */ int16_t *list, // id list
struct sp_syn *ssp, /* group id and ":syn include" tag of group */ struct sp_syn *ssp, // group id and ":syn include" tag of group
int contained /* group id is contained */ int contained // group id is contained
) )
{ {
int retval; int retval;
short *scl_list; int16_t *scl_list;
short item; int16_t item;
short id = ssp->id; int16_t id = ssp->id;
static int depth = 0; static int depth = 0;
int r; int r;
@@ -6774,7 +6769,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
break; break;
} }
// Use the _16 table to check if its a valid color name. // Use the _16 table to check if it's a valid color name.
color = color_numbers_16[i]; color = color_numbers_16[i];
if (color >= 0) { if (color >= 0) {
if (t_colors == 8) { if (t_colors == 8) {
@@ -7490,7 +7485,7 @@ int syn_check_group(const char_u *pp, int len)
return id; return id;
} }
/// Add new highlight group and return it's ID. /// Add new highlight group and return its ID.
/// ///
/// @param name must be an allocated string, it will be consumed. /// @param name must be an allocated string, it will be consumed.
/// @return 0 for failure, else the allocated group id /// @return 0 for failure, else the allocated group id