comparison src/search.c @ 28405:473cfd79bcd8 v8.2.4727

patch 8.2.4727: unused code Commit: https://github.com/vim/vim/commit/7765f5cf964c751cd780484220bb65773b1b0348 Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Sun Apr 10 11:26:53 2022 +0100 patch 8.2.4727: unused code Problem: Unused code. Solution: Remove code and add #ifdefs. (Dominique Pell?, closes https://github.com/vim/vim/issues/10136)
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 Apr 2022 12:30:05 +0200
parents 62cc3b60493b
children 813660733869
comparison
equal deleted inserted replaced
28404:95ce25a7224a 28405:473cfd79bcd8
1375 * offset, because it is meaningless and the 's' could be a 1375 * offset, because it is meaningless and the 's' could be a
1376 * substitute command. 1376 * substitute command.
1377 */ 1377 */
1378 if (*p == '+' || *p == '-' || VIM_ISDIGIT(*p)) 1378 if (*p == '+' || *p == '-' || VIM_ISDIGIT(*p))
1379 spats[0].off.line = TRUE; 1379 spats[0].off.line = TRUE;
1380 else if ((options & SEARCH_OPT) && 1380 else if ((options & SEARCH_OPT)
1381 (*p == 'e' || *p == 's' || *p == 'b')) 1381 && (*p == 'e' || *p == 's' || *p == 'b'))
1382 { 1382 {
1383 if (*p == 'e') // end 1383 if (*p == 'e') // end
1384 spats[0].off.end = SEARCH_END; 1384 spats[0].off.end = SEARCH_END;
1385 ++p; 1385 ++p;
1386 } 1386 }
1402 searchcmdlen += (int)(p - pat); 1402 searchcmdlen += (int)(p - pat);
1403 1403
1404 pat = p; // put pat after search command 1404 pat = p; // put pat after search command
1405 } 1405 }
1406 1406
1407 if ((options & SEARCH_ECHO) && messaging() && 1407 if ((options & SEARCH_ECHO) && messaging()
1408 !msg_silent && 1408 && !msg_silent
1409 (!cmd_silent || !shortmess(SHM_SEARCHCOUNT))) 1409 && (!cmd_silent || !shortmess(SHM_SEARCHCOUNT)))
1410 { 1410 {
1411 char_u *trunc; 1411 char_u *trunc;
1412 char_u off_buf[40]; 1412 char_u off_buf[40];
1413 size_t off_len = 0; 1413 size_t off_len = 0;
1414 1414
2448 } 2448 }
2449 2449
2450 /* 2450 /*
2451 * If FM_BLOCKSTOP given, stop at a '{' or '}' in column 0. 2451 * If FM_BLOCKSTOP given, stop at a '{' or '}' in column 0.
2452 */ 2452 */
2453 if (pos.col == 0 && (flags & FM_BLOCKSTOP) && 2453 if (pos.col == 0 && (flags & FM_BLOCKSTOP)
2454 (linep[0] == '{' || linep[0] == '}')) 2454 && (linep[0] == '{' || linep[0] == '}'))
2455 { 2455 {
2456 if (linep[0] == findc && count == 0) // match! 2456 if (linep[0] == findc && count == 0) // match!
2457 return &pos; 2457 return &pos;
2458 break; // out of scope 2458 break; // out of scope
2459 } 2459 }
2651 if (linep[pos.col - 2] == '\'') 2651 if (linep[pos.col - 2] == '\'')
2652 { 2652 {
2653 pos.col -= 2; 2653 pos.col -= 2;
2654 break; 2654 break;
2655 } 2655 }
2656 else if (linep[pos.col - 2] == '\\' && 2656 else if (linep[pos.col - 2] == '\\'
2657 pos.col > 2 && linep[pos.col - 3] == '\'') 2657 && pos.col > 2 && linep[pos.col - 3] == '\'')
2658 { 2658 {
2659 pos.col -= 3; 2659 pos.col -= 3;
2660 break; 2660 break;
2661 } 2661 }
2662 } 2662 }
2663 } 2663 }
2664 else if (linep[pos.col + 1]) // forward search 2664 else if (linep[pos.col + 1]) // forward search
2665 { 2665 {
2666 if (linep[pos.col + 1] == '\\' && 2666 if (linep[pos.col + 1] == '\\'
2667 linep[pos.col + 2] && linep[pos.col + 3] == '\'') 2667 && linep[pos.col + 2] && linep[pos.col + 3] == '\'')
2668 { 2668 {
2669 pos.col += 3; 2669 pos.col += 3;
2670 break; 2670 break;
2671 } 2671 }
2672 else if (linep[pos.col + 2] == '\'') 2672 else if (linep[pos.col + 2] == '\'')
3469 if (i == max_path_depth) 3469 if (i == max_path_depth)
3470 break; 3470 break;
3471 if (fullpathcmp(new_fname, files[i].name, TRUE, TRUE) 3471 if (fullpathcmp(new_fname, files[i].name, TRUE, TRUE)
3472 & FPC_SAME) 3472 & FPC_SAME)
3473 { 3473 {
3474 if (type != CHECK_PATH && 3474 if (type != CHECK_PATH
3475 action == ACTION_SHOW_ALL && files[i].matched) 3475 && action == ACTION_SHOW_ALL
3476 && files[i].matched)
3476 { 3477 {
3477 msg_putchar('\n'); // cursor below last one 3478 msg_putchar('\n'); // cursor below last one
3478 if (!got_int) // don't display if 'q' 3479 if (!got_int) // don't display if 'q'
3479 // typed at "--more--" 3480 // typed at "--more--"
3480 // message 3481 // message
4676 ptrs[i].score = SCORE_NONE; 4677 ptrs[i].score = SCORE_NONE;
4677 itemstr = NULL; 4678 itemstr = NULL;
4678 rettv.v_type = VAR_UNKNOWN; 4679 rettv.v_type = VAR_UNKNOWN;
4679 if (li->li_tv.v_type == VAR_STRING) // list of strings 4680 if (li->li_tv.v_type == VAR_STRING) // list of strings
4680 itemstr = li->li_tv.vval.v_string; 4681 itemstr = li->li_tv.vval.v_string;
4681 else if (li->li_tv.v_type == VAR_DICT && 4682 else if (li->li_tv.v_type == VAR_DICT
4682 (key != NULL || item_cb->cb_name != NULL)) 4683 && (key != NULL || item_cb->cb_name != NULL))
4683 { 4684 {
4684 // For a dict, either use the specified key to lookup the string or 4685 // For a dict, either use the specified key to lookup the string or
4685 // use the specified callback function to get the string. 4686 // use the specified callback function to get the string.
4686 if (key != NULL) 4687 if (key != NULL)
4687 itemstr = dict_get_string(li->li_tv.vval.v_dict, key, FALSE); 4688 itemstr = dict_get_string(li->li_tv.vval.v_dict, key, FALSE);
4784 4785
4785 for (i = 0; i < len; i++) 4786 for (i = 0; i < len; i++)
4786 { 4787 {
4787 if (ptrs[i].score == SCORE_NONE) 4788 if (ptrs[i].score == SCORE_NONE)
4788 break; 4789 break;
4789 if (ptrs[i].lmatchpos != NULL && 4790 if (ptrs[i].lmatchpos != NULL
4790 list_append_list(l, ptrs[i].lmatchpos) == FAIL) 4791 && list_append_list(l, ptrs[i].lmatchpos) == FAIL)
4791 goto done; 4792 goto done;
4792 } 4793 }
4793 4794
4794 // copy the matching scores 4795 // copy the matching scores
4795 li = list_find(fmatchlist, -1); 4796 li = list_find(fmatchlist, -1);
5048 (*matches)[i] = fuzmatch[i].str; 5049 (*matches)[i] = fuzmatch[i].str;
5049 vim_free(fuzmatch); 5050 vim_free(fuzmatch);
5050 5051
5051 return OK; 5052 return OK;
5052 } 5053 }
5053
5054 /*
5055 * Free a list of fuzzy string matches.
5056 */
5057 void
5058 fuzmatch_str_free(fuzmatch_str_T *fuzmatch, int count)
5059 {
5060 if (count <= 0 || fuzmatch == NULL)
5061 return;
5062 while (count--)
5063 vim_free(fuzmatch[count].str);
5064 vim_free(fuzmatch);
5065 }