summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2023-01-27 21:03:12 +0000
committerBram Moolenaar <Bram@vim.org>2023-01-27 21:03:12 +0000
commitfadc02a2a57755fa1342b1b44c2ceab3046125fc (patch)
tree8e013a61d40bcca51deff9aa21cda2c51b96f41f
parent8dbab1d8ceb82a0fb693a1b7fcb57a2dfb4de068 (diff)
downloadvim-git-fadc02a2a57755fa1342b1b44c2ceab3046125fc.tar.gz
patch 9.0.1251: checking returned value of ga_grow() is inconsistentv9.0.1251
Problem: Checking returned value of ga_grow() is inconsistent. Solution: Check for FAIL instaed of "not OK". (Yegappan Lakshmanan, closes #11897)
-rw-r--r--src/digraph.c2
-rw-r--r--src/evalfunc.c2
-rw-r--r--src/fold.c4
-rw-r--r--src/getchar.c2
-rw-r--r--src/map.c2
-rw-r--r--src/os_win32.c2
-rw-r--r--src/scriptfile.c2
-rw-r--r--src/spellfile.c2
-rw-r--r--src/syntax.c6
-rw-r--r--src/tag.c2
-rw-r--r--src/usercmd.c2
-rw-r--r--src/version.c2
12 files changed, 16 insertions, 14 deletions
diff --git a/src/digraph.c b/src/digraph.c
index ac51d50a7..fb45c1524 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -1682,7 +1682,7 @@ registerdigraph(int char1, int char2, int n)
}
// Add a new digraph to the table.
- if (ga_grow(&user_digraphs, 1) != OK)
+ if (ga_grow(&user_digraphs, 1) == FAIL)
return;
dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len;
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 7b34e3925..08f88471e 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3966,7 +3966,7 @@ execute_redir_str(char_u *value, int value_len)
len = (int)STRLEN(value); // Append the entire string
else
len = value_len; // Append only "value_len" characters
- if (ga_grow(&redir_execute_ga, len) != OK)
+ if (ga_grow(&redir_execute_ga, len) == FAIL)
return;
mch_memmove((char *)redir_execute_ga.ga_data
diff --git a/src/fold.c b/src/fold.c
index 589727d98..be20991c7 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -645,7 +645,7 @@ foldCreate(linenr_T start, linenr_T end)
i = (int)(fp - (fold_T *)gap->ga_data);
}
- if (ga_grow(gap, 1) != OK)
+ if (ga_grow(gap, 1) == FAIL)
return;
fp = (fold_T *)gap->ga_data + i;
@@ -2884,7 +2884,7 @@ foldInsert(garray_T *gap, int i)
{
fold_T *fp;
- if (ga_grow(gap, 1) != OK)
+ if (ga_grow(gap, 1) == FAIL)
return FAIL;
fp = (fold_T *)gap->ga_data + i;
if (gap->ga_len > 0 && i < gap->ga_len)
diff --git a/src/getchar.c b/src/getchar.c
index f4dce0222..2d30d4fb1 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -3890,7 +3890,7 @@ getcmdkeycmd(
got_int = FALSE;
while (c1 != NUL && !aborted)
{
- if (ga_grow(&line_ga, 32) != OK)
+ if (ga_grow(&line_ga, 32) == FAIL)
{
aborted = TRUE;
break;
diff --git a/src/map.c b/src/map.c
index 244636fdc..9be67cd74 100644
--- a/src/map.c
+++ b/src/map.c
@@ -2983,7 +2983,7 @@ langmap_set_entry(int from, int to)
b = i;
}
- if (ga_grow(&langmap_mapga, 1) != OK)
+ if (ga_grow(&langmap_mapga, 1) == FAIL)
return; // out of memory
// insert new entry at position "a"
diff --git a/src/os_win32.c b/src/os_win32.c
index e80533b01..884ef0d57 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -5725,7 +5725,7 @@ win32_build_env(dict_T *env, garray_T *gap, int is_terminal)
size_t lkey = wcslen(wkey);
size_t lval = wcslen(wval);
- if (ga_grow(gap, (int)(lkey + lval + 2)) != OK)
+ if (ga_grow(gap, (int)(lkey + lval + 2)) == FAIL)
continue;
for (n = 0; n < lkey; n++)
*((WCHAR*)gap->ga_data + gap->ga_len++) = wkey[n];
diff --git a/src/scriptfile.c b/src/scriptfile.c
index 630a11696..008c7b3d4 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -56,7 +56,7 @@ estack_push(etype_T type, char_u *name, long lnum)
// If memory allocation fails then we'll pop more than we push, eventually
// at the top level it will be OK again.
- if (ga_grow(&exestack, 1) != OK)
+ if (ga_grow(&exestack, 1) == FAIL)
return NULL;
entry = ((estack_T *)exestack.ga_data) + exestack.ga_len;
diff --git a/src/spellfile.c b/src/spellfile.c
index 1a7bd1f4c..710e4388f 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -3428,7 +3428,7 @@ add_fromto(
fromto_T *ftp;
char_u word[MAXWLEN];
- if (ga_grow(gap, 1) != OK)
+ if (ga_grow(gap, 1) == FAIL)
return;
ftp = ((fromto_T *)gap->ga_data) + gap->ga_len;
diff --git a/src/syntax.c b/src/syntax.c
index 614f52e2f..719bc9c79 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1438,7 +1438,7 @@ load_current_state(synstate_T *from)
validate_current_state();
keepend_level = -1;
if (from->sst_stacksize
- && ga_grow(&current_state, from->sst_stacksize) != FAIL)
+ && ga_grow(&current_state, from->sst_stacksize) == OK)
{
if (from->sst_stacksize > SST_FIX_STATES)
bp = SYN_STATE_P(&(from->sst_union.sst_ga));
@@ -4946,7 +4946,7 @@ syn_cmd_match(
set_nextcmd(eap, rest);
if (!ends_excmd2(eap->cmd, rest) || eap->skip)
rest = NULL;
- else if (ga_grow(&curwin->w_s->b_syn_patterns, 1) != FAIL
+ else if (ga_grow(&curwin->w_s->b_syn_patterns, 1) == OK
&& (syn_id = syn_check_group(arg,
(int)(group_name_end - arg))) != 0)
{
@@ -5186,7 +5186,7 @@ syn_cmd_region(
set_nextcmd(eap, rest);
if (!ends_excmd(*rest) || eap->skip)
rest = NULL;
- else if (ga_grow(&(curwin->w_s->b_syn_patterns), pat_count) != FAIL
+ else if (ga_grow(&(curwin->w_s->b_syn_patterns), pat_count) == OK
&& (syn_id = syn_check_group(arg,
(int)(group_name_end - arg))) != 0)
{
diff --git a/src/tag.c b/src/tag.c
index 66d6100d8..93768bc51 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -2739,7 +2739,7 @@ findtags_add_match(
if (HASHITEM_EMPTY(hi))
{
if (hash_add_item(&st->ht_match[mtt], hi, mfp, *hash) == FAIL
- || ga_grow(&st->ga_match[mtt], 1) != OK)
+ || ga_grow(&st->ga_match[mtt], 1) == FAIL)
{
// Out of memory! Just forget about the rest.
st->stop_searching = TRUE;
diff --git a/src/usercmd.c b/src/usercmd.c
index 9dcc20e7f..44fa578f6 100644
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -1058,7 +1058,7 @@ uc_add_command(
// Extend the array unless we're replacing an existing command
if (cmp != 0)
{
- if (ga_grow(gap, 1) != OK)
+ if (ga_grow(gap, 1) == FAIL)
goto fail;
if ((p = vim_strnsave(name, name_len)) == NULL)
goto fail;
diff --git a/src/version.c b/src/version.c
index 0c31039c8..64da4b300 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1251,
+/**/
1250,
/**/
1249,