Skip to content

Commit

Permalink
patch 9.0.0925: two conditions are always false
Browse files Browse the repository at this point in the history
Problem:    Two conditions are always false.
Solution:   Remove the conditions.  Update return value types to make clear
            what could be returned. (closes #11593)
  • Loading branch information
zeertzjq authored and brammool committed Nov 23, 2022
1 parent c3e06e4 commit df3c0eb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
58 changes: 28 additions & 30 deletions src/tag.c
Expand Up @@ -202,7 +202,7 @@ free_tagfunc_option(void)

#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Mark the global 'tagfunc' callback with 'copyID' so that it is not garbage
* Mark the global 'tagfunc' callback with "copyID" so that it is not garbage
* collected.
*/
int
Expand Down Expand Up @@ -1773,7 +1773,7 @@ findtags_in_help_init(findtags_state_T *st)
int i;
char_u *s;

// Keep 'en' as the language if the file extension is '.txt'
// Keep "en" as the language if the file extension is ".txt"
if (st->is_txt)
STRCPY(st->help_lang, "en");
else
Expand Down Expand Up @@ -1883,9 +1883,9 @@ emacs_tags_incstack_free(void)
/*
* Emacs tags line with CTRL-L: New file name on next line.
* The file name is followed by a ','. Remember etag file name in ebuf.
* The FILE pointer to the tags file is stored in 'st->fp'. If another tags
* The FILE pointer to the tags file is stored in "st->fp". If another tags
* file is included, then the FILE pointer to the new tags file is stored in
* 'st->fp'. The old file pointer is saved in incstack.
* "st->fp". The old file pointer is saved in incstack.
*/
static void
emacs_tags_new_filename(findtags_state_T *st)
Expand Down Expand Up @@ -2131,7 +2131,7 @@ findtags_get_next_line(findtags_state_T *st, tagsearch_info_T *sinfo_p)
}

/*
* Parse a tags file header line in 'st->lbuf'.
* Parse a tags file header line in "st->lbuf".
* Returns TRUE if the current line in st->lbuf is not a tags header line and
* should be parsed as a regular tag line. Returns FALSE if the line is a
* header line and the next header line should be read.
Expand Down Expand Up @@ -2254,10 +2254,16 @@ findtags_start_state_handler(

/*
* Parse a tag line read from a tags file.
* Returns OK if a tags line is successfully parsed.
* Returns FAIL if a format error is encountered.
* Also compares the tag name in "tagpp->tagname" with a search pattern in
* "st->orgpat->head" as a quick check if the tag may match.
* Returns:
* - TAG_MATCH_SUCCESS if the tag may match
* - TAG_MATCH_FAIL if the tag doesn't match
* - TAG_MATCH_NEXT to look for the next matching tag (used in a binary search)
* - TAG_MATCH_STOP if all the tags are processed without a match. Uses the
* values in "margs" for doing the comparison.
*/
static int
static tagmatch_status_T
findtags_parse_line(
findtags_state_T *st,
tagptrs_T *tagpp,
Expand Down Expand Up @@ -2424,14 +2430,12 @@ findtags_matchargs_init(findtags_match_args_T *margs, int flags)
}

/*
* Compares the tag name in 'tagpp->tagname' with a search pattern in
* 'st->orgpat.head'.
* Returns TAG_MATCH_SUCCESS if the tag matches, TAG_MATCH_FAIL if the tag
* doesn't match, TAG_MATCH_NEXT to look for the next matching tag (used in a
* binary search) and TAG_MATCH_STOP if all the tags are processed without a
* match. Uses the values in 'margs' for doing the comparison.
* Compares the tag name in "tagpp->tagname" with a search pattern in
* "st->orgpat->pat".
* Returns TRUE if the tag matches, FALSE if the tag doesn't match.
* Uses the values in "margs" for doing the comparison.
*/
static tagmatch_status_T
static int
findtags_match_tag(
findtags_state_T *st,
tagptrs_T *tagpp,
Expand Down Expand Up @@ -2487,11 +2491,11 @@ findtags_match_tag(
margs->match_re = TRUE;
}

return match ? TAG_MATCH_SUCCESS : TAG_MATCH_FAIL;
return match;
}

/*
* Convert the encoding of a line read from a tags file in 'st->lbuf'.
* Convert the encoding of a line read from a tags file in "st->lbuf".
* Converting the pattern from 'enc' to the tags file encoding doesn't work,
* because characters are not recognized. The converted line is saved in
* st->lbuf.
Expand Down Expand Up @@ -2756,7 +2760,7 @@ findtags_add_match(

/*
* Read and get all the tags from file st->tag_fname.
* Sets 'st->stop_searching' to TRUE to stop searching for additional tags.
* Sets "st->stop_searching" to TRUE to stop searching for additional tags.
*/
static void
findtags_get_all_tags(
Expand Down Expand Up @@ -2885,14 +2889,8 @@ findtags_get_all_tags(
return;
}

retval = findtags_match_tag(st, &tagp, margs);
if (retval == TAG_MATCH_NEXT)
continue;
if (retval == TAG_MATCH_STOP)
break;

// If a match is found, add it to ht_match[] and ga_match[].
if (retval == TAG_MATCH_SUCCESS)
if (findtags_match_tag(st, &tagp, margs))
{
if (findtags_add_match(st, &tagp, margs, buf_ffname, &hash)
== FAIL)
Expand All @@ -2902,10 +2900,10 @@ findtags_get_all_tags(
}

/*
* Search for tags matching 'st->orgpat.pat' in the 'st->tag_fname' tags file.
* Information needed to search for the tags is in the 'st' state structure.
* The matching tags are returned in 'st'. If an error is encountered, then
* 'st->stop_searching' is set to TRUE.
* Search for tags matching "st->orgpat->pat" in the "st->tag_fname" tags file.
* Information needed to search for the tags is in the "st" state structure.
* The matching tags are returned in "st". If an error is encountered, then
* "st->stop_searching" is set to TRUE.
*/
static void
findtags_in_file(findtags_state_T *st, char_u *buf_ffname)
Expand Down Expand Up @@ -2977,7 +2975,7 @@ findtags_in_file(findtags_state_T *st, char_u *buf_ffname)
}

/*
* Copy the tags found by find_tags() to 'matchesp'.
* Copy the tags found by find_tags() to "matchesp".
* Returns the number of matches copied.
*/
static int
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
925,
/**/
924,
/**/
Expand Down

0 comments on commit df3c0eb

Please sign in to comment.