mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +00:00
vim-patch:8.2.1560: using NULL pointers in some code
Problem: Using NULL pointers in some code. (James McCoy)
Solution: Avoid adding to a NULL pointer. Use byte as unsigned.
9c2b06637b
The changes to eval.c (skip_expr_concatenate) and vim9compile.c aren't
included since they're specific to vim9script support.
This commit is contained in:
@@ -1232,7 +1232,7 @@ setManualFoldWin(
|
|||||||
for (;; ) {
|
for (;; ) {
|
||||||
if (!foldFind(gap, lnum, &fp)) {
|
if (!foldFind(gap, lnum, &fp)) {
|
||||||
/* If there is a following fold, continue there next time. */
|
/* If there is a following fold, continue there next time. */
|
||||||
if (fp < (fold_T *)gap->ga_data + gap->ga_len)
|
if (fp != NULL && fp < (fold_T *)gap->ga_data + gap->ga_len)
|
||||||
next = fp->fd_top + off;
|
next = fp->fd_top + off;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2615,17 +2615,18 @@ static void foldSplit(buf_T *buf, garray_T *const gap,
|
|||||||
* any between top and bot, they have been removed by the caller. */
|
* any between top and bot, they have been removed by the caller. */
|
||||||
garray_T *const gap1 = &fp->fd_nested;
|
garray_T *const gap1 = &fp->fd_nested;
|
||||||
garray_T *const gap2 = &fp[1].fd_nested;
|
garray_T *const gap2 = &fp[1].fd_nested;
|
||||||
(void)(foldFind(gap1, bot + 1 - fp->fd_top, &fp2));
|
if (foldFind(gap1, bot + 1 - fp->fd_top, &fp2)) {
|
||||||
const int len = (int)((fold_T *)gap1->ga_data + gap1->ga_len - fp2);
|
const int len = (int)((fold_T *)gap1->ga_data + gap1->ga_len - fp2);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
ga_grow(gap2, len);
|
ga_grow(gap2, len);
|
||||||
for (int idx = 0; idx < len; idx++) {
|
for (int idx = 0; idx < len; idx++) {
|
||||||
((fold_T *)gap2->ga_data)[idx] = fp2[idx];
|
((fold_T *)gap2->ga_data)[idx] = fp2[idx];
|
||||||
((fold_T *)gap2->ga_data)[idx].fd_top
|
((fold_T *)gap2->ga_data)[idx].fd_top
|
||||||
-= fp[1].fd_top - fp->fd_top;
|
-= fp[1].fd_top - fp->fd_top;
|
||||||
|
}
|
||||||
|
gap2->ga_len = len;
|
||||||
|
gap1->ga_len -= len;
|
||||||
}
|
}
|
||||||
gap2->ga_len = len;
|
|
||||||
gap1->ga_len -= len;
|
|
||||||
}
|
}
|
||||||
fp->fd_len = top - fp->fd_top;
|
fp->fd_len = top - fp->fd_top;
|
||||||
fold_changed = true;
|
fold_changed = true;
|
||||||
|
@@ -5663,6 +5663,9 @@ check_suggestions (
|
|||||||
int len;
|
int len;
|
||||||
hlf_T attr;
|
hlf_T attr;
|
||||||
|
|
||||||
|
if (gap->ga_len == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
stp = &SUG(*gap, 0);
|
stp = &SUG(*gap, 0);
|
||||||
for (int i = gap->ga_len - 1; i >= 0; --i) {
|
for (int i = gap->ga_len - 1; i >= 0; --i) {
|
||||||
// Need to append what follows to check for "the the".
|
// Need to append what follows to check for "the the".
|
||||||
|
Reference in New Issue
Block a user