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;
} }
@@ -1530,8 +1529,8 @@ int syntax_check_changed(linenr_T lnum)
* is valid. * is valid.
*/ */
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;
} }
@@ -1576,7 +1577,7 @@ syn_finish_line (
* done. * done.
*/ */
int int
get_syntax_attr ( get_syntax_attr(
colnr_T col, colnr_T col,
bool *can_spell, bool *can_spell,
int keep_state /* keep state of char at "col" */ int keep_state /* keep state of char at "col" */
@@ -1625,11 +1626,11 @@ get_syntax_attr (
* Get syntax attributes for current_lnum, current_col. * Get syntax attributes for current_lnum, current_col.
*/ */
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;
@@ -2459,7 +2460,7 @@ static void check_keepend(void)
* Return the flags for the matched END. * Return the flags for the matched END.
*/ */
static void static void
update_si_end ( update_si_end(
stateitem_T *sip, stateitem_T *sip,
int startcol, /* where to start searching for the end */ int startcol, /* where to start searching for the end */
int force /* when TRUE overrule a previous end */ int force /* when TRUE overrule a previous end */
@@ -2552,15 +2553,15 @@ static void pop_current_state(void)
* computed. * computed.
*/ */
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;
@@ -2794,12 +2795,12 @@ static void limit_pos_zero(lpos_T *pos, lpos_T *limit)
* Add offset to matched text for end of match or highlight. * Add offset to matched text for end of match or highlight.
*/ */
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;
@@ -2842,12 +2843,12 @@ syn_add_end_off (
* Avoid resulting column to become negative. * Avoid resulting column to become negative.
*/ */
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,10 +2934,10 @@ 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(
char_u *line, char_u *line,
int startcol, /* position in line to check for keyword */ int startcol, /* position in line to check for keyword */
int *endcolp, /* return: character after found keyword */ int *endcolp, /* return: character after found keyword */
@@ -3447,7 +3448,7 @@ void syn_maybe_on(void)
* Handle ":syntax [list]" command: list current syntax words. * Handle ":syntax [list]" command: list current syntax words.
*/ */
static void static void
syn_cmd_list ( syn_cmd_list(
exarg_T *eap, exarg_T *eap,
int syncing /* when TRUE: list syncing items */ int syncing /* when TRUE: list syncing items */
) )
@@ -3561,7 +3562,7 @@ static int last_matchgroup;
* List one syntax item, for ":syntax" or "syntax list syntax_name". * List one syntax item, for ":syntax" or "syntax list syntax_name".
*/ */
static void static void
syn_list_one ( syn_list_one(
int id, int id,
int syncing, /* when TRUE: list syncing items */ int syncing, /* when TRUE: list syncing items */
int link_only /* when TRUE; list link-only too */ int link_only /* when TRUE; list link-only too */
@@ -3797,7 +3798,7 @@ static void put_pattern(char *s, int c, synpat_T *spp, int attr)
* Return TRUE if the header has been printed. * Return TRUE if the header has been printed.
*/ */
static int static int
syn_list_keywords ( syn_list_keywords(
int id, int id,
hashtab_T *ht, hashtab_T *ht,
int did_header, /* header has already been printed */ int did_header, /* header has already been printed */
@@ -4392,7 +4393,7 @@ error:
* Also ":syntax sync match {name} [[grouphere | groupthere] {group-name}] .." * Also ":syntax sync match {name} [[grouphere | groupthere] {group-name}] .."
*/ */
static void static void
syn_cmd_match ( syn_cmd_match(
exarg_T *eap, exarg_T *eap,
int syncing /* TRUE for ":syntax sync match .. " */ int syncing /* TRUE for ":syntax sync match .. " */
) )
@@ -4490,7 +4491,7 @@ syn_cmd_match (
* start {start} .. [skip {skip}] end {end} .. [{options}]". * start {start} .. [skip {skip}] end {end} .. [{options}]".
*/ */
static void static void
syn_cmd_region ( syn_cmd_region(
exarg_T *eap, exarg_T *eap,
int syncing /* TRUE for ":syntax sync region .." */ int syncing /* TRUE for ":syntax sync region .." */
) )
@@ -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)
{ {
/* /*
@@ -5227,7 +5222,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
* returns FAIL for some error, OK for success. * returns FAIL for some error, OK for success.
*/ */
static int static int
get_id_list ( get_id_list(
char_u **arg, char_u **arg,
int keylen, // length of keyword int keylen, // length of keyword
int16_t **list, // where to store the resulting list, if not int16_t **list, // where to store the resulting list, if not
@@ -5422,17 +5417,17 @@ static short *copy_id_list(short *list)
* This function is called very often, keep it fast!! * This function is called very often, keep it fast!!
*/ */
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