comparison src/tag.c @ 10666:ed6f03535745 v8.0.0223

patch 8.0.0223: Coverity warns for an uninitialized variable commit https://github.com/vim/vim/commit/fffbf308dd98d1129ba4914d921ab47dc6a6c9b1 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 23 20:47:12 2017 +0100 patch 8.0.0223: Coverity warns for an uninitialized variable Problem: Coverity gets confused by the flags passed to find_tags() and warnts for an uninitialized variable. Solution: Disallow using cscope and help tags at the same time.
author Christian Brabandt <cb@256bit.org>
date Mon, 23 Jan 2017 21:00:04 +0100
parents f0df81ef971a
children 0ecd07cd2e43
comparison
equal deleted inserted replaced
10665:ec5868458234 10666:ed6f03535745
1254 * TAG_HELP only search for help tags 1254 * TAG_HELP only search for help tags
1255 * TAG_NAMES only return name of tag 1255 * TAG_NAMES only return name of tag
1256 * TAG_REGEXP use "pat" as a regexp 1256 * TAG_REGEXP use "pat" as a regexp
1257 * TAG_NOIC don't always ignore case 1257 * TAG_NOIC don't always ignore case
1258 * TAG_KEEP_LANG keep language 1258 * TAG_KEEP_LANG keep language
1259 * TAG_CSCOPE use cscope results for tags
1259 */ 1260 */
1260 int 1261 int
1261 find_tags( 1262 find_tags(
1262 char_u *pat, /* pattern to search for */ 1263 char_u *pat, /* pattern to search for */
1263 int *num_matches, /* return: number of matches found */ 1264 int *num_matches, /* return: number of matches found */
1421 /* 1422 /*
1422 * Initialize a few variables 1423 * Initialize a few variables
1423 */ 1424 */
1424 if (help_only) /* want tags from help file */ 1425 if (help_only) /* want tags from help file */
1425 curbuf->b_help = TRUE; /* will be restored later */ 1426 curbuf->b_help = TRUE; /* will be restored later */
1427 #ifdef FEAT_CSCOPE
1428 else if (use_cscope)
1429 {
1430 /* Make sure we don't mix help and cscope, confuses Coverity. */
1431 help_only = FALSE;
1432 curbuf->b_help = FALSE;
1433 }
1434 #endif
1426 1435
1427 orgpat.len = (int)STRLEN(pat); 1436 orgpat.len = (int)STRLEN(pat);
1428 #ifdef FEAT_MULTI_LANG 1437 #ifdef FEAT_MULTI_LANG
1429 if (curbuf->b_help) 1438 if (curbuf->b_help)
1430 { 1439 {
2279 * detecting duplicates. 2288 * detecting duplicates.
2280 * The format is {tagname}@{lang}NUL{heuristic}NUL 2289 * The format is {tagname}@{lang}NUL{heuristic}NUL
2281 */ 2290 */
2282 *tagp.tagname_end = NUL; 2291 *tagp.tagname_end = NUL;
2283 len = (int)(tagp.tagname_end - tagp.tagname); 2292 len = (int)(tagp.tagname_end - tagp.tagname);
2284 mfp = (char_u *)alloc((int)sizeof(char_u) + len + 10 + ML_EXTRA + 1); 2293 mfp = (char_u *)alloc((int)sizeof(char_u)
2294 + len + 10 + ML_EXTRA + 1);
2285 if (mfp != NULL) 2295 if (mfp != NULL)
2286 { 2296 {
2287 int heuristic; 2297 int heuristic;
2288 2298
2289 p = mfp; 2299 p = mfp;