Skip to content

Commit 4a0a161

Browse files
committed
patch 8.1.1710: Coverity found dead code
Problem: Coverity found dead code. Solution: Remove merging of listener changes.
1 parent 403d090 commit 4a0a161

2 files changed

Lines changed: 12 additions & 43 deletions

File tree

src/change.c

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,16 @@ changed_internal(void)
155155
static long next_listener_id = 0;
156156

157157
/*
158-
* Check if the change at "lnum" / "col" is above or overlaps with an existing
159-
* changed. If above then flush changes and invoke listeners.
160-
* If "merge" is TRUE do the merge.
158+
* Check if the change at "lnum" is above or overlaps with an existing
159+
* change. If above then flush changes and invoke listeners.
161160
* Returns TRUE if the change was merged.
162161
*/
163162
static int
164163
check_recorded_changes(
165164
buf_T *buf,
166165
linenr_T lnum,
167-
colnr_T col,
168166
linenr_T lnume,
169-
long xtra,
170-
int merge)
167+
long xtra)
171168
{
172169
if (buf->b_recorded_changes != NULL && xtra != 0)
173170
{
@@ -182,42 +179,12 @@ check_recorded_changes(
182179
li->li_tv.vval.v_dict, (char_u *)"lnum");
183180
prev_lnume = (linenr_T)dict_get_number(
184181
li->li_tv.vval.v_dict, (char_u *)"end");
185-
if (prev_lnum >= lnum || prev_lnum > lnume
186-
|| (prev_lnume >= lnum && xtra != 0))
182+
if (prev_lnum >= lnum || prev_lnum > lnume || prev_lnume >= lnum)
187183
{
188-
if (li->li_next == NULL && lnum == prev_lnum
189-
&& xtra == 0
190-
&& col + 1 == (colnr_T)dict_get_number(
191-
li->li_tv.vval.v_dict, (char_u *)"col"))
192-
{
193-
if (merge)
194-
{
195-
dictitem_T *di;
196-
197-
// Same start point and nothing is following, entries
198-
// can be merged.
199-
di = dict_find(li->li_tv.vval.v_dict,
200-
(char_u *)"end", -1);
201-
if (di != NULL)
202-
{
203-
prev_lnum = tv_get_number(&di->di_tv);
204-
if (lnume > prev_lnum)
205-
di->di_tv.vval.v_number = lnume;
206-
}
207-
di = dict_find(li->li_tv.vval.v_dict,
208-
(char_u *)"added", -1);
209-
if (di != NULL)
210-
di->di_tv.vval.v_number += xtra;
211-
return TRUE;
212-
}
213-
}
214-
else
215-
{
216-
// the current change is going to make the line number in
217-
// the older change invalid, flush now
218-
invoke_listeners(curbuf);
219-
break;
220-
}
184+
// the current change is going to make the line number in
185+
// the older change invalid, flush now
186+
invoke_listeners(curbuf);
187+
break;
221188
}
222189
}
223190
}
@@ -242,7 +209,7 @@ may_record_change(
242209

243210
// If the new change is going to change the line numbers in already listed
244211
// changes, then flush.
245-
if (check_recorded_changes(curbuf, lnum, col, lnume, xtra, TRUE))
212+
if (check_recorded_changes(curbuf, lnum, lnume, xtra))
246213
return;
247214

248215
if (curbuf->b_recorded_changes == NULL)
@@ -362,7 +329,7 @@ f_listener_remove(typval_T *argvars, typval_T *rettv)
362329
void
363330
may_invoke_listeners(buf_T *buf, linenr_T lnum, linenr_T lnume, int added)
364331
{
365-
check_recorded_changes(buf, lnum, 0, lnume, added, FALSE);
332+
check_recorded_changes(buf, lnum, lnume, added);
366333
}
367334

368335
/*

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ static char *(features[]) =
777777

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1710,
780782
/**/
781783
1709,
782784
/**/

0 commit comments

Comments
 (0)