comparison src/tag.c @ 16176:4d7ee5609652 v8.1.1093

patch 8.1.1093: support for outdated tags format slows down tag parsing commit https://github.com/vim/vim/commit/96428dd4e961332e97d86013a321cedf5fafbed6 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 30 21:19:34 2019 +0100 patch 8.1.1093: support for outdated tags format slows down tag parsing Problem: Support for outdated tags format slows down tag parsing. Solution: Remove FEAT_TAG_OLDSTATIC.
author Bram Moolenaar <Bram@vim.org>
date Sat, 30 Mar 2019 21:30:04 +0100
parents 213b88f89597
children a8689ea2e869
comparison
equal deleted inserted replaced
16175:3994c90ff9b3 16176:4d7ee5609652
1962 /* Corrupted tag line. */ 1962 /* Corrupted tag line. */
1963 line_error = TRUE; 1963 line_error = TRUE;
1964 break; 1964 break;
1965 } 1965 }
1966 1966
1967 #ifdef FEAT_TAG_OLDSTATIC
1968 /*
1969 * Check for old style static tag: "file:tag file .."
1970 */
1971 tagp.fname = NULL;
1972 for (p = lbuf; p < tagp.tagname_end; ++p)
1973 {
1974 if (*p == ':')
1975 {
1976 if (tagp.fname == NULL)
1977 tagp.fname = tagp.tagname_end + 1;
1978 if (fnamencmp(lbuf, tagp.fname, p - lbuf) == 0
1979 && tagp.fname[p - lbuf] == TAB)
1980 {
1981 // found one
1982 tagp.tagname = p + 1;
1983 break;
1984 }
1985 }
1986 }
1987 #endif
1988
1989 /* 1967 /*
1990 * Skip this line if the length of the tag is different and 1968 * Skip this line if the length of the tag is different and
1991 * there is no regexp, or the tag is too short. 1969 * there is no regexp, or the tag is too short.
1992 */ 1970 */
1993 cmplen = (int)(tagp.tagname_end - tagp.tagname); 1971 cmplen = (int)(tagp.tagname_end - tagp.tagname);
2096 continue; 2074 continue;
2097 2075
2098 /* 2076 /*
2099 * Can be a matching tag, isolate the file name and command. 2077 * Can be a matching tag, isolate the file name and command.
2100 */ 2078 */
2101 #ifdef FEAT_TAG_OLDSTATIC 2079 tagp.fname = tagp.tagname_end + 1;
2102 if (tagp.fname == NULL)
2103 #endif
2104 tagp.fname = tagp.tagname_end + 1;
2105 tagp.fname_end = vim_strchr(tagp.fname, TAB); 2080 tagp.fname_end = vim_strchr(tagp.fname, TAB);
2106 tagp.command = tagp.fname_end + 1; 2081 tagp.command = tagp.fname_end + 1;
2107 if (tagp.fname_end == NULL) 2082 if (tagp.fname_end == NULL)
2108 i = FAIL; 2083 i = FAIL;
2109 else 2084 else
2199 buf_ffname); 2174 buf_ffname);
2200 #ifdef FEAT_EMACS_TAGS 2175 #ifdef FEAT_EMACS_TAGS
2201 is_static = FALSE; 2176 is_static = FALSE;
2202 if (!is_etag) /* emacs tags are never static */ 2177 if (!is_etag) /* emacs tags are never static */
2203 #endif 2178 #endif
2204 { 2179 is_static = test_for_static(&tagp);
2205 #ifdef FEAT_TAG_OLDSTATIC
2206 if (tagp.tagname != lbuf)
2207 is_static = TRUE; /* detected static tag before */
2208 else
2209 #endif
2210 is_static = test_for_static(&tagp);
2211 }
2212 2180
2213 /* decide in which of the sixteen tables to store this 2181 /* decide in which of the sixteen tables to store this
2214 * match */ 2182 * match */
2215 if (is_static) 2183 if (is_static)
2216 { 2184 {
2867 */ 2835 */
2868 static int 2836 static int
2869 test_for_static(tagptrs_T *tagp) 2837 test_for_static(tagptrs_T *tagp)
2870 { 2838 {
2871 char_u *p; 2839 char_u *p;
2872
2873 #ifdef FEAT_TAG_OLDSTATIC
2874 int len;
2875
2876 /*
2877 * Check for old style static tag: "file:tag file .."
2878 */
2879 len = (int)(tagp->fname_end - tagp->fname);
2880 p = tagp->tagname + len;
2881 if ( p < tagp->tagname_end
2882 && *p == ':'
2883 && fnamencmp(tagp->tagname, tagp->fname, len) == 0)
2884 {
2885 tagp->tagname = p + 1;
2886 return TRUE;
2887 }
2888 #endif
2889 2840
2890 /* 2841 /*
2891 * Check for new style static tag ":...<Tab>file:[<Tab>...]" 2842 * Check for new style static tag ":...<Tab>file:[<Tab>...]"
2892 */ 2843 */
2893 p = tagp->command; 2844 p = tagp->command;