In-place invert optimization

This commit is contained in:
Arun Prakash Jana 2021-07-14 21:04:02 +05:30
parent cef9bd289f
commit 61d8a29d84
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -1595,9 +1595,14 @@ static void invertselbuf(char *path)
len = mkpath(path, dentp->name, g_buf);
found = findinsel(findselpos, len);
if (found) {
marked[nmarked].startpos = found;
marked[nmarked].len = len;
++nmarked;
if (nmarked && (found
== (marked[nmarked - 1].startpos + marked[nmarked - 1].len)))
marked[nmarked - 1].len += len;
else {
marked[nmarked].startpos = found;
marked[nmarked].len = len;
++nmarked;
}
--nselected;
offset += len; /* buffer size adjustment */