To: vim_dev@googlegroups.com Subject: Patch 9.0.0925 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0925 Problem: Two conditions are always false. Solution: Remove the conditions. Update return value types to make clear what could be returned. (closes #11593) Files: src/tag.c *** ../vim-9.0.0924/src/tag.c 2022-11-02 13:30:37.538314551 +0000 --- src/tag.c 2022-11-23 11:22:09.727790845 +0000 *************** *** 202,208 **** #if defined(FEAT_EVAL) || defined(PROTO) /* ! * Mark the global 'tagfunc' callback with 'copyID' so that it is not garbage * collected. */ int --- 202,208 ---- #if defined(FEAT_EVAL) || defined(PROTO) /* ! * Mark the global 'tagfunc' callback with "copyID" so that it is not garbage * collected. */ int *************** *** 1773,1779 **** int i; char_u *s; ! // Keep 'en' as the language if the file extension is '.txt' if (st->is_txt) STRCPY(st->help_lang, "en"); else --- 1773,1779 ---- int i; char_u *s; ! // Keep "en" as the language if the file extension is ".txt" if (st->is_txt) STRCPY(st->help_lang, "en"); else *************** *** 1883,1891 **** /* * 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 * 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. */ static void emacs_tags_new_filename(findtags_state_T *st) --- 1883,1891 ---- /* * 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 * 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. */ static void emacs_tags_new_filename(findtags_state_T *st) *************** *** 2131,2137 **** } /* ! * 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. --- 2131,2137 ---- } /* ! * 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. *************** *** 2254,2263 **** /* * 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. */ ! static int findtags_parse_line( findtags_state_T *st, tagptrs_T *tagpp, --- 2254,2269 ---- /* * Parse a tag line read from a tags file. ! * 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 tagmatch_status_T findtags_parse_line( findtags_state_T *st, tagptrs_T *tagpp, *************** *** 2424,2437 **** } /* ! * 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. */ ! static tagmatch_status_T findtags_match_tag( findtags_state_T *st, tagptrs_T *tagpp, --- 2430,2441 ---- } /* ! * 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 int findtags_match_tag( findtags_state_T *st, tagptrs_T *tagpp, *************** *** 2487,2497 **** margs->match_re = TRUE; } ! return match ? TAG_MATCH_SUCCESS : TAG_MATCH_FAIL; } /* ! * 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. --- 2491,2501 ---- margs->match_re = TRUE; } ! return match; } /* ! * 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. *************** *** 2756,2762 **** /* * Read and get all the tags from file st->tag_fname. ! * Sets 'st->stop_searching' to TRUE to stop searching for additional tags. */ static void findtags_get_all_tags( --- 2760,2766 ---- /* * Read and get all the tags from file st->tag_fname. ! * Sets "st->stop_searching" to TRUE to stop searching for additional tags. */ static void findtags_get_all_tags( *************** *** 2885,2898 **** 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_add_match(st, &tagp, margs, buf_ffname, &hash) == FAIL) --- 2889,2896 ---- return; } // If a match is found, add it to ht_match[] and ga_match[]. ! if (findtags_match_tag(st, &tagp, margs)) { if (findtags_add_match(st, &tagp, margs, buf_ffname, &hash) == FAIL) *************** *** 2902,2911 **** } /* ! * 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) --- 2900,2909 ---- } /* ! * 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) *************** *** 2977,2983 **** } /* ! * Copy the tags found by find_tags() to 'matchesp'. * Returns the number of matches copied. */ static int --- 2975,2981 ---- } /* ! * Copy the tags found by find_tags() to "matchesp". * Returns the number of matches copied. */ static int *** ../vim-9.0.0924/src/version.c 2022-11-22 22:03:34.415747693 +0000 --- src/version.c 2022-11-23 11:19:39.543898735 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 925, /**/ -- Two percent of zero is almost nothing. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///