mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 16:28:17 +00:00
Merge pull request #985 from fwalch/clang-analyzer-dead-assignments
Clang analyzer: fix dead stores / reduce scope
This commit is contained in:
@@ -1361,24 +1361,19 @@ static int half_shape(int c)
|
|||||||
int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1,
|
int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1,
|
||||||
int next_c)
|
int next_c)
|
||||||
{
|
{
|
||||||
int curr_c;
|
|
||||||
int shape_c;
|
|
||||||
int curr_laa;
|
|
||||||
int prev_laa;
|
|
||||||
|
|
||||||
/* Deal only with Arabic character, pass back all others */
|
/* Deal only with Arabic character, pass back all others */
|
||||||
if (!A_is_ok(c)) {
|
if (!A_is_ok(c)) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* half-shape current and previous character */
|
/* half-shape current and previous character */
|
||||||
shape_c = half_shape(prev_c);
|
int shape_c = half_shape(prev_c);
|
||||||
|
|
||||||
/* Save away current character */
|
/* Save away current character */
|
||||||
curr_c = c;
|
int curr_c = c;
|
||||||
|
|
||||||
curr_laa = A_firstc_laa(c, *c1p);
|
int curr_laa = A_firstc_laa(c, *c1p);
|
||||||
prev_laa = A_firstc_laa(prev_c, prev_c1);
|
int prev_laa = A_firstc_laa(prev_c, prev_c1);
|
||||||
|
|
||||||
if (curr_laa) {
|
if (curr_laa) {
|
||||||
if (A_is_valid(prev_c) && !A_is_f(shape_c) && !A_is_s(shape_c) &&
|
if (A_is_valid(prev_c) && !A_is_f(shape_c) && !A_is_s(shape_c) &&
|
||||||
|
@@ -159,7 +159,7 @@ char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
|
|||||||
s = xstpcpy(s, strings[i]);
|
s = xstpcpy(s, strings[i]);
|
||||||
s = xstpcpy(s, sep);
|
s = xstpcpy(s, sep);
|
||||||
}
|
}
|
||||||
s = xstpcpy(s, strings[nelem - 1]);
|
strcpy(s, strings[nelem - 1]);
|
||||||
|
|
||||||
return (char_u *) ret;
|
return (char_u *) ret;
|
||||||
}
|
}
|
||||||
|
@@ -7726,22 +7726,6 @@ void showruler(int always)
|
|||||||
|
|
||||||
static void win_redr_ruler(win_T *wp, int always)
|
static void win_redr_ruler(win_T *wp, int always)
|
||||||
{
|
{
|
||||||
#define RULER_BUF_LEN 70
|
|
||||||
char_u buffer[RULER_BUF_LEN];
|
|
||||||
int row;
|
|
||||||
int fillchar;
|
|
||||||
int attr;
|
|
||||||
int empty_line = FALSE;
|
|
||||||
colnr_T virtcol;
|
|
||||||
int i;
|
|
||||||
size_t len;
|
|
||||||
int o;
|
|
||||||
int this_ru_col;
|
|
||||||
int off = 0;
|
|
||||||
int width = Columns;
|
|
||||||
# define WITH_OFF(x) x
|
|
||||||
# define WITH_WIDTH(x) x
|
|
||||||
|
|
||||||
/* If 'ruler' off or redrawing disabled, don't do anything */
|
/* If 'ruler' off or redrawing disabled, don't do anything */
|
||||||
if (!p_ru)
|
if (!p_ru)
|
||||||
return;
|
return;
|
||||||
@@ -7777,6 +7761,7 @@ static void win_redr_ruler(win_T *wp, int always)
|
|||||||
/*
|
/*
|
||||||
* Check if not in Insert mode and the line is empty (will show "0-1").
|
* Check if not in Insert mode and the line is empty (will show "0-1").
|
||||||
*/
|
*/
|
||||||
|
int empty_line = FALSE;
|
||||||
if (!(State & INSERT)
|
if (!(State & INSERT)
|
||||||
&& *ml_get_buf(wp->w_buffer, wp->w_cursor.lnum, FALSE) == NUL)
|
&& *ml_get_buf(wp->w_buffer, wp->w_cursor.lnum, FALSE) == NUL)
|
||||||
empty_line = TRUE;
|
empty_line = TRUE;
|
||||||
@@ -7796,6 +7781,13 @@ static void win_redr_ruler(win_T *wp, int always)
|
|||||||
|| wp->w_topfill != wp->w_ru_topfill
|
|| wp->w_topfill != wp->w_ru_topfill
|
||||||
|| empty_line != wp->w_ru_empty) {
|
|| empty_line != wp->w_ru_empty) {
|
||||||
cursor_off();
|
cursor_off();
|
||||||
|
|
||||||
|
int width;
|
||||||
|
int row;
|
||||||
|
int fillchar;
|
||||||
|
int attr;
|
||||||
|
int off;
|
||||||
|
|
||||||
if (wp->w_status_height) {
|
if (wp->w_status_height) {
|
||||||
row = wp->w_winrow + wp->w_height;
|
row = wp->w_winrow + wp->w_height;
|
||||||
fillchar = fillchar_status(&attr, wp == curwin);
|
fillchar = fillchar_status(&attr, wp == curwin);
|
||||||
@@ -7810,13 +7802,16 @@ static void win_redr_ruler(win_T *wp, int always)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* In list mode virtcol needs to be recomputed */
|
/* In list mode virtcol needs to be recomputed */
|
||||||
virtcol = wp->w_virtcol;
|
colnr_T virtcol = wp->w_virtcol;
|
||||||
if (wp->w_p_list && lcs_tab1 == NUL) {
|
if (wp->w_p_list && lcs_tab1 == NUL) {
|
||||||
wp->w_p_list = FALSE;
|
wp->w_p_list = FALSE;
|
||||||
getvvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
|
getvvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
|
||||||
wp->w_p_list = TRUE;
|
wp->w_p_list = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define RULER_BUF_LEN 70
|
||||||
|
char_u buffer[RULER_BUF_LEN];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some sprintfs return the length, some return a pointer.
|
* Some sprintfs return the length, some return a pointer.
|
||||||
* To avoid portability problems we use strlen() here.
|
* To avoid portability problems we use strlen() here.
|
||||||
@@ -7824,7 +7819,7 @@ static void win_redr_ruler(win_T *wp, int always)
|
|||||||
vim_snprintf((char *)buffer, RULER_BUF_LEN, "%" PRId64 ",",
|
vim_snprintf((char *)buffer, RULER_BUF_LEN, "%" PRId64 ",",
|
||||||
(wp->w_buffer->b_ml.ml_flags & ML_EMPTY) ? (int64_t)0L
|
(wp->w_buffer->b_ml.ml_flags & ML_EMPTY) ? (int64_t)0L
|
||||||
: (int64_t)wp->w_cursor.lnum);
|
: (int64_t)wp->w_cursor.lnum);
|
||||||
len = STRLEN(buffer);
|
size_t len = STRLEN(buffer);
|
||||||
col_print(buffer + len, RULER_BUF_LEN - len,
|
col_print(buffer + len, RULER_BUF_LEN - len,
|
||||||
empty_line ? 0 : (int)wp->w_cursor.col + 1,
|
empty_line ? 0 : (int)wp->w_cursor.col + 1,
|
||||||
(int)virtcol + 1);
|
(int)virtcol + 1);
|
||||||
@@ -7834,20 +7829,20 @@ static void win_redr_ruler(win_T *wp, int always)
|
|||||||
* On the last line, don't print in the last column (scrolls the
|
* On the last line, don't print in the last column (scrolls the
|
||||||
* screen up on some terminals).
|
* screen up on some terminals).
|
||||||
*/
|
*/
|
||||||
i = (int)STRLEN(buffer);
|
int i = (int)STRLEN(buffer);
|
||||||
get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1);
|
get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1);
|
||||||
o = i + vim_strsize(buffer + i + 1);
|
int o = i + vim_strsize(buffer + i + 1);
|
||||||
if (wp->w_status_height == 0) /* can't use last char of screen */
|
if (wp->w_status_height == 0) /* can't use last char of screen */
|
||||||
++o;
|
++o;
|
||||||
this_ru_col = ru_col - (Columns - width);
|
int this_ru_col = ru_col - (Columns - width);
|
||||||
if (this_ru_col < 0)
|
if (this_ru_col < 0)
|
||||||
this_ru_col = 0;
|
this_ru_col = 0;
|
||||||
/* Never use more than half the window/screen width, leave the other
|
/* Never use more than half the window/screen width, leave the other
|
||||||
* half for the filename. */
|
* half for the filename. */
|
||||||
if (this_ru_col < (WITH_WIDTH(width) + 1) / 2)
|
if (this_ru_col < (width + 1) / 2)
|
||||||
this_ru_col = (WITH_WIDTH(width) + 1) / 2;
|
this_ru_col = (width + 1) / 2;
|
||||||
if (this_ru_col + o < WITH_WIDTH(width)) {
|
if (this_ru_col + o < width) {
|
||||||
while (this_ru_col + o < WITH_WIDTH(width)) {
|
while (this_ru_col + o < width) {
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
i += (*mb_char2bytes)(fillchar, buffer + i);
|
i += (*mb_char2bytes)(fillchar, buffer + i);
|
||||||
else
|
else
|
||||||
@@ -7861,19 +7856,19 @@ static void win_redr_ruler(win_T *wp, int always)
|
|||||||
o = 0;
|
o = 0;
|
||||||
for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i)) {
|
for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i)) {
|
||||||
o += (*mb_ptr2cells)(buffer + i);
|
o += (*mb_ptr2cells)(buffer + i);
|
||||||
if (this_ru_col + o > WITH_WIDTH(width)) {
|
if (this_ru_col + o > width) {
|
||||||
buffer[i] = NUL;
|
buffer[i] = NUL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this_ru_col + (int)STRLEN(buffer) > WITH_WIDTH(width))
|
} else if (this_ru_col + (int)STRLEN(buffer) > width)
|
||||||
buffer[WITH_WIDTH(width) - this_ru_col] = NUL;
|
buffer[width - this_ru_col] = NUL;
|
||||||
|
|
||||||
screen_puts(buffer, row, this_ru_col + WITH_OFF(off), attr);
|
screen_puts(buffer, row, this_ru_col + off, attr);
|
||||||
i = redraw_cmdline;
|
i = redraw_cmdline;
|
||||||
screen_fill(row, row + 1,
|
screen_fill(row, row + 1,
|
||||||
this_ru_col + WITH_OFF(off) + (int)STRLEN(buffer),
|
this_ru_col + off + (int)STRLEN(buffer),
|
||||||
(int)(WITH_OFF(off) + WITH_WIDTH(width)),
|
(int)(off + width),
|
||||||
fillchar, fillchar, attr);
|
fillchar, fillchar, attr);
|
||||||
/* don't redraw the cmdline because of showing the ruler */
|
/* don't redraw the cmdline because of showing the ruler */
|
||||||
redraw_cmdline = i;
|
redraw_cmdline = i;
|
||||||
|
@@ -3762,16 +3762,8 @@ current_search (
|
|||||||
int forward /* move forward or backwards */
|
int forward /* move forward or backwards */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
pos_T start_pos; /* position before the pattern */
|
|
||||||
pos_T orig_pos; /* position of the cursor at beginning */
|
|
||||||
pos_T pos; /* position after the pattern */
|
|
||||||
int i;
|
|
||||||
int dir;
|
|
||||||
int result; /* result of various function calls */
|
|
||||||
bool old_p_ws = p_ws;
|
bool old_p_ws = p_ws;
|
||||||
int flags = 0;
|
|
||||||
pos_T save_VIsual = VIsual;
|
pos_T save_VIsual = VIsual;
|
||||||
int one_char;
|
|
||||||
|
|
||||||
/* wrapping should not occur */
|
/* wrapping should not occur */
|
||||||
p_ws = false;
|
p_ws = false;
|
||||||
@@ -3780,11 +3772,11 @@ current_search (
|
|||||||
if (VIsual_active && *p_sel == 'e' && lt(VIsual, curwin->w_cursor))
|
if (VIsual_active && *p_sel == 'e' && lt(VIsual, curwin->w_cursor))
|
||||||
dec_cursor();
|
dec_cursor();
|
||||||
|
|
||||||
if (VIsual_active) {
|
pos_T orig_pos; /* position of the cursor at beginning */
|
||||||
orig_pos = curwin->w_cursor;
|
pos_T pos; /* position after the pattern */
|
||||||
|
|
||||||
pos = curwin->w_cursor;
|
if (VIsual_active) {
|
||||||
start_pos = VIsual;
|
orig_pos = pos = curwin->w_cursor;
|
||||||
|
|
||||||
/* make sure, searching further will extend the match */
|
/* make sure, searching further will extend the match */
|
||||||
if (VIsual_active) {
|
if (VIsual_active) {
|
||||||
@@ -3794,10 +3786,10 @@ current_search (
|
|||||||
decl(&pos);
|
decl(&pos);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
orig_pos = pos = start_pos = curwin->w_cursor;
|
orig_pos = pos = curwin->w_cursor;
|
||||||
|
|
||||||
/* Is the pattern is zero-width? */
|
/* Is the pattern is zero-width? */
|
||||||
one_char = is_one_char(spats[last_idx].pat);
|
int one_char = is_one_char(spats[last_idx].pat);
|
||||||
if (one_char == -1) {
|
if (one_char == -1) {
|
||||||
p_ws = old_p_ws;
|
p_ws = old_p_ws;
|
||||||
return FAIL; /* pattern not found */
|
return FAIL; /* pattern not found */
|
||||||
@@ -3808,17 +3800,14 @@ current_search (
|
|||||||
* so that a match at the current cursor position will be correctly
|
* so that a match at the current cursor position will be correctly
|
||||||
* captured.
|
* captured.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (forward)
|
int dir = forward ? i : !i;
|
||||||
dir = i;
|
int flags = 0;
|
||||||
else
|
|
||||||
dir = !i;
|
|
||||||
|
|
||||||
flags = 0;
|
|
||||||
if (!dir && !one_char)
|
if (!dir && !one_char)
|
||||||
flags = SEARCH_END;
|
flags = SEARCH_END;
|
||||||
|
|
||||||
result = searchit(curwin, curbuf, &pos, (dir ? FORWARD : BACKWARD),
|
int result = searchit(curwin, curbuf, &pos, (dir ? FORWARD : BACKWARD),
|
||||||
spats[last_idx].pat, (long) (i ? count : 1),
|
spats[last_idx].pat, (long) (i ? count : 1),
|
||||||
SEARCH_KEEP | flags, RE_SEARCH, 0, NULL);
|
SEARCH_KEEP | flags, RE_SEARCH, 0, NULL);
|
||||||
|
|
||||||
@@ -3845,13 +3834,13 @@ current_search (
|
|||||||
p_ws = old_p_ws;
|
p_ws = old_p_ws;
|
||||||
}
|
}
|
||||||
|
|
||||||
start_pos = pos;
|
int flags = forward ? SEARCH_END : 0;
|
||||||
flags = forward ? SEARCH_END : 0;
|
pos_T start_pos = pos;
|
||||||
|
|
||||||
/* move to match, except for zero-width matches, in which case, we are
|
/* move to match, except for zero-width matches, in which case, we are
|
||||||
* already on the next match */
|
* already on the next match */
|
||||||
if (!one_char)
|
if (!one_char)
|
||||||
result = searchit(curwin, curbuf, &pos, (forward ? FORWARD : BACKWARD),
|
searchit(curwin, curbuf, &pos, (forward ? FORWARD : BACKWARD),
|
||||||
spats[last_idx].pat, 0L, flags | SEARCH_KEEP, RE_SEARCH, 0, NULL);
|
spats[last_idx].pat, 0L, flags | SEARCH_KEEP, RE_SEARCH, 0, NULL);
|
||||||
|
|
||||||
if (!VIsual_active)
|
if (!VIsual_active)
|
||||||
|
@@ -1261,28 +1261,12 @@ spell_check (
|
|||||||
// For a match mip->mi_result is updated.
|
// For a match mip->mi_result is updated.
|
||||||
static void find_word(matchinf_T *mip, int mode)
|
static void find_word(matchinf_T *mip, int mode)
|
||||||
{
|
{
|
||||||
idx_T arridx = 0;
|
|
||||||
int endlen[MAXWLEN]; // length at possible word endings
|
|
||||||
idx_T endidx[MAXWLEN]; // possible word endings
|
|
||||||
int endidxcnt = 0;
|
|
||||||
int len;
|
|
||||||
int wlen = 0;
|
int wlen = 0;
|
||||||
int flen;
|
int flen;
|
||||||
int c;
|
|
||||||
char_u *ptr;
|
char_u *ptr;
|
||||||
idx_T lo;
|
|
||||||
idx_T hi;
|
|
||||||
idx_T m;
|
|
||||||
char_u *s;
|
|
||||||
char_u *p;
|
|
||||||
int res = SP_BAD;
|
|
||||||
slang_T *slang = mip->mi_lp->lp_slang;
|
slang_T *slang = mip->mi_lp->lp_slang;
|
||||||
unsigned flags;
|
|
||||||
char_u *byts;
|
char_u *byts;
|
||||||
idx_T *idxs;
|
idx_T *idxs;
|
||||||
bool word_ends;
|
|
||||||
bool prefix_found;
|
|
||||||
int nobreak_result;
|
|
||||||
|
|
||||||
if (mode == FIND_KEEPWORD || mode == FIND_KEEPCOMPOUND) {
|
if (mode == FIND_KEEPWORD || mode == FIND_KEEPCOMPOUND) {
|
||||||
// Check for word with matching case in keep-case tree.
|
// Check for word with matching case in keep-case tree.
|
||||||
@@ -1316,6 +1300,13 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
if (byts == NULL)
|
if (byts == NULL)
|
||||||
return; // array is empty
|
return; // array is empty
|
||||||
|
|
||||||
|
idx_T arridx = 0;
|
||||||
|
int endlen[MAXWLEN]; // length at possible word endings
|
||||||
|
idx_T endidx[MAXWLEN]; // possible word endings
|
||||||
|
int endidxcnt = 0;
|
||||||
|
int len;
|
||||||
|
int c;
|
||||||
|
|
||||||
// Repeat advancing in the tree until:
|
// Repeat advancing in the tree until:
|
||||||
// - there is a byte that doesn't match,
|
// - there is a byte that doesn't match,
|
||||||
// - we reach the end of the tree,
|
// - we reach the end of the tree,
|
||||||
@@ -1356,10 +1347,10 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
c = ptr[wlen];
|
c = ptr[wlen];
|
||||||
if (c == TAB) // <Tab> is handled like <Space>
|
if (c == TAB) // <Tab> is handled like <Space>
|
||||||
c = ' ';
|
c = ' ';
|
||||||
lo = arridx;
|
idx_T lo = arridx;
|
||||||
hi = arridx + len - 1;
|
idx_T hi = arridx + len - 1;
|
||||||
while (lo < hi) {
|
while (lo < hi) {
|
||||||
m = (lo + hi) / 2;
|
idx_T m = (lo + hi) / 2;
|
||||||
if (byts[m] > c)
|
if (byts[m] > c)
|
||||||
hi = m - 1;
|
hi = m - 1;
|
||||||
else if (byts[m] < c)
|
else if (byts[m] < c)
|
||||||
@@ -1393,6 +1384,9 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char_u *p;
|
||||||
|
bool word_ends;
|
||||||
|
|
||||||
// Verify that one of the possible endings is valid. Try the longest
|
// Verify that one of the possible endings is valid. Try the longest
|
||||||
// first.
|
// first.
|
||||||
while (endidxcnt > 0) {
|
while (endidxcnt > 0) {
|
||||||
@@ -1410,7 +1404,7 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
word_ends = true;
|
word_ends = true;
|
||||||
// The prefix flag is before compound flags. Once a valid prefix flag
|
// The prefix flag is before compound flags. Once a valid prefix flag
|
||||||
// has been found we try compound flags.
|
// has been found we try compound flags.
|
||||||
prefix_found = false;
|
bool prefix_found = false;
|
||||||
|
|
||||||
if (mode != FIND_KEEPWORD && has_mbyte) {
|
if (mode != FIND_KEEPWORD && has_mbyte) {
|
||||||
// Compute byte length in original word, length may change
|
// Compute byte length in original word, length may change
|
||||||
@@ -1418,7 +1412,7 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
// case-folded word is equal to the keep-case word.
|
// case-folded word is equal to the keep-case word.
|
||||||
p = mip->mi_word;
|
p = mip->mi_word;
|
||||||
if (STRNCMP(ptr, p, wlen) != 0) {
|
if (STRNCMP(ptr, p, wlen) != 0) {
|
||||||
for (s = ptr; s < ptr + wlen; mb_ptr_adv(s))
|
for (char_u *s = ptr; s < ptr + wlen; mb_ptr_adv(s))
|
||||||
mb_ptr_adv(p);
|
mb_ptr_adv(p);
|
||||||
wlen = (int)(p - mip->mi_word);
|
wlen = (int)(p - mip->mi_word);
|
||||||
}
|
}
|
||||||
@@ -1428,10 +1422,9 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
// prefix ID.
|
// prefix ID.
|
||||||
// Repeat this if there are more flags/region alternatives until there
|
// Repeat this if there are more flags/region alternatives until there
|
||||||
// is a match.
|
// is a match.
|
||||||
res = SP_BAD;
|
|
||||||
for (len = byts[arridx - 1]; len > 0 && byts[arridx] == 0;
|
for (len = byts[arridx - 1]; len > 0 && byts[arridx] == 0;
|
||||||
--len, ++arridx) {
|
--len, ++arridx) {
|
||||||
flags = idxs[arridx];
|
uint32_t flags = idxs[arridx];
|
||||||
|
|
||||||
// For the fold-case tree check that the case of the checked word
|
// For the fold-case tree check that the case of the checked word
|
||||||
// matches with what the word in the tree requires.
|
// matches with what the word in the tree requires.
|
||||||
@@ -1527,7 +1520,7 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
mip->mi_compoff) != 0) {
|
mip->mi_compoff) != 0) {
|
||||||
// case folding may have changed the length
|
// case folding may have changed the length
|
||||||
p = mip->mi_word;
|
p = mip->mi_word;
|
||||||
for (s = ptr; s < ptr + mip->mi_compoff; mb_ptr_adv(s))
|
for (char_u *s = ptr; s < ptr + mip->mi_compoff; mb_ptr_adv(s))
|
||||||
mb_ptr_adv(p);
|
mb_ptr_adv(p);
|
||||||
} else
|
} else
|
||||||
p = mip->mi_word + mip->mi_compoff;
|
p = mip->mi_word + mip->mi_compoff;
|
||||||
@@ -1577,7 +1570,7 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
else if (flags & WF_NEEDCOMP)
|
else if (flags & WF_NEEDCOMP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nobreak_result = SP_OK;
|
int nobreak_result = SP_OK;
|
||||||
|
|
||||||
if (!word_ends) {
|
if (!word_ends) {
|
||||||
int save_result = mip->mi_result;
|
int save_result = mip->mi_result;
|
||||||
@@ -1601,7 +1594,7 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
// the case-folded word is equal to the keep-case word.
|
// the case-folded word is equal to the keep-case word.
|
||||||
p = mip->mi_fword;
|
p = mip->mi_fword;
|
||||||
if (STRNCMP(ptr, p, wlen) != 0) {
|
if (STRNCMP(ptr, p, wlen) != 0) {
|
||||||
for (s = ptr; s < ptr + wlen; mb_ptr_adv(s))
|
for (char_u *s = ptr; s < ptr + wlen; mb_ptr_adv(s))
|
||||||
mb_ptr_adv(p);
|
mb_ptr_adv(p);
|
||||||
mip->mi_compoff = (int)(p - mip->mi_fword);
|
mip->mi_compoff = (int)(p - mip->mi_fword);
|
||||||
}
|
}
|
||||||
@@ -1661,6 +1654,7 @@ static void find_word(matchinf_T *mip, int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int res = SP_BAD;
|
||||||
if (flags & WF_BANNED)
|
if (flags & WF_BANNED)
|
||||||
res = SP_BANNED;
|
res = SP_BANNED;
|
||||||
else if (flags & WF_REGION) {
|
else if (flags & WF_REGION) {
|
||||||
@@ -3767,7 +3761,6 @@ char_u *did_set_spelllang(win_T *wp)
|
|||||||
&& !ASCII_ISALPHA(p[3])) {
|
&& !ASCII_ISALPHA(p[3])) {
|
||||||
STRLCPY(region_cp, p + 1, 3);
|
STRLCPY(region_cp, p + 1, 3);
|
||||||
memmove(p, p + 3, len - (p - lang) - 2);
|
memmove(p, p + 3, len - (p - lang) - 2);
|
||||||
len -= 3;
|
|
||||||
region = region_cp;
|
region = region_cp;
|
||||||
} else
|
} else
|
||||||
dont_use_region = true;
|
dont_use_region = true;
|
||||||
@@ -3780,8 +3773,7 @@ char_u *did_set_spelllang(win_T *wp)
|
|||||||
filename = false;
|
filename = false;
|
||||||
if (len > 3 && lang[len - 3] == '_') {
|
if (len > 3 && lang[len - 3] == '_') {
|
||||||
region = lang + len - 2;
|
region = lang + len - 2;
|
||||||
len -= 3;
|
lang[len - 3] = NUL;
|
||||||
lang[len] = NUL;
|
|
||||||
} else
|
} else
|
||||||
dont_use_region = true;
|
dont_use_region = true;
|
||||||
|
|
||||||
|
@@ -5684,22 +5684,19 @@ static int syn_compare_syntime(const void *v1, const void *v2)
|
|||||||
*/
|
*/
|
||||||
static void syntime_report(void)
|
static void syntime_report(void)
|
||||||
{
|
{
|
||||||
synpat_T *spp;
|
|
||||||
proftime_T tm;
|
|
||||||
int len;
|
|
||||||
int total_count = 0;
|
|
||||||
garray_T ga;
|
|
||||||
time_entry_T *p;
|
|
||||||
|
|
||||||
if (!syntax_present(curwin)) {
|
if (!syntax_present(curwin)) {
|
||||||
MSG(_(msg_no_items));
|
MSG(_(msg_no_items));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
garray_T ga;
|
||||||
ga_init(&ga, sizeof(time_entry_T), 50);
|
ga_init(&ga, sizeof(time_entry_T), 50);
|
||||||
|
|
||||||
proftime_T total_total = profile_zero();
|
proftime_T total_total = profile_zero();
|
||||||
|
int total_count = 0;
|
||||||
|
time_entry_T *p;
|
||||||
for (int idx = 0; idx < curwin->w_s->b_syn_patterns.ga_len; ++idx) {
|
for (int idx = 0; idx < curwin->w_s->b_syn_patterns.ga_len; ++idx) {
|
||||||
spp = &(SYN_ITEMS(curwin->w_s)[idx]);
|
synpat_T *spp = &(SYN_ITEMS(curwin->w_s)[idx]);
|
||||||
if (spp->sp_time.count > 0) {
|
if (spp->sp_time.count > 0) {
|
||||||
p = GA_APPEND_VIA_PTR(time_entry_T, &ga);
|
p = GA_APPEND_VIA_PTR(time_entry_T, &ga);
|
||||||
p->total = spp->sp_time.total;
|
p->total = spp->sp_time.total;
|
||||||
@@ -5708,7 +5705,7 @@ static void syntime_report(void)
|
|||||||
p->match = spp->sp_time.match;
|
p->match = spp->sp_time.match;
|
||||||
total_count += spp->sp_time.count;
|
total_count += spp->sp_time.count;
|
||||||
p->slowest = spp->sp_time.slowest;
|
p->slowest = spp->sp_time.slowest;
|
||||||
tm = profile_divide(spp->sp_time.total, spp->sp_time.count);
|
proftime_T tm = profile_divide(spp->sp_time.total, spp->sp_time.count);
|
||||||
p->average = tm;
|
p->average = tm;
|
||||||
p->id = spp->sp_syn.id;
|
p->id = spp->sp_syn.id;
|
||||||
p->pattern = spp->sp_pattern;
|
p->pattern = spp->sp_pattern;
|
||||||
@@ -5723,7 +5720,6 @@ static void syntime_report(void)
|
|||||||
" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));
|
" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));
|
||||||
MSG_PUTS("\n");
|
MSG_PUTS("\n");
|
||||||
for (int idx = 0; idx < ga.ga_len && !got_int; ++idx) {
|
for (int idx = 0; idx < ga.ga_len && !got_int; ++idx) {
|
||||||
spp = &(SYN_ITEMS(curwin->w_s)[idx]);
|
|
||||||
p = ((time_entry_T *)ga.ga_data) + idx;
|
p = ((time_entry_T *)ga.ga_data) + idx;
|
||||||
|
|
||||||
MSG_PUTS(profile_msg(p->total));
|
MSG_PUTS(profile_msg(p->total));
|
||||||
@@ -5745,6 +5741,7 @@ static void syntime_report(void)
|
|||||||
MSG_PUTS(" ");
|
MSG_PUTS(" ");
|
||||||
|
|
||||||
msg_advance(69);
|
msg_advance(69);
|
||||||
|
int len;
|
||||||
if (Columns < 80)
|
if (Columns < 80)
|
||||||
len = 20; /* will wrap anyway */
|
len = 20; /* will wrap anyway */
|
||||||
else
|
else
|
||||||
|
@@ -1445,7 +1445,6 @@ win_equal_rec (
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) {
|
for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) {
|
||||||
n = m = 0;
|
|
||||||
wincount = 1;
|
wincount = 1;
|
||||||
if (fr->fr_next == NULL)
|
if (fr->fr_next == NULL)
|
||||||
/* last frame gets all that remains (avoid roundoff error) */
|
/* last frame gets all that remains (avoid roundoff error) */
|
||||||
@@ -1566,7 +1565,6 @@ win_equal_rec (
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) {
|
for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) {
|
||||||
n = m = 0;
|
|
||||||
wincount = 1;
|
wincount = 1;
|
||||||
if (fr->fr_next == NULL)
|
if (fr->fr_next == NULL)
|
||||||
/* last frame gets all that remains (avoid roundoff error) */
|
/* last frame gets all that remains (avoid roundoff error) */
|
||||||
|
Reference in New Issue
Block a user