summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-27 21:17:32 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-27 21:17:32 +0200
commit5d7c2df536c17db4a9c61e0760bdcf78d0db7330 (patch)
tree74a24ee4dec7bed9866c328da2bf3ac00460ef77 /src/misc2.c
parent53ba05b09075f14227f9be831a22ed16f7cc26b2 (diff)
downloadvim-git-5d7c2df536c17db4a9c61e0760bdcf78d0db7330.tar.gz
patch 8.2.3228: cannot use a simple block for the :command argumentv8.2.3228
Problem: Cannot use a simple block for the :command argument. (Maarten Tournoij) Solution: Recognize a simple {} block. (issue #8623)
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/misc2.c b/src/misc2.c
index 8e99b01a5..bc984b219 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1488,7 +1488,6 @@ ga_grow_inner(garray_T *gap, int n)
return OK;
}
-#if defined(FEAT_EVAL) || defined(FEAT_SEARCHPATH) || defined(PROTO)
/*
* For a growing array that contains a list of strings: concatenate all the
* strings with a separating "sep".
@@ -1524,27 +1523,27 @@ ga_concat_strings(garray_T *gap, char *sep)
}
return s;
}
-#endif
-#if defined(FEAT_VIMINFO) || defined(FEAT_EVAL) || defined(PROTO)
/*
* Make a copy of string "p" and add it to "gap".
- * When out of memory nothing changes.
+ * When out of memory nothing changes and FAIL is returned.
*/
- void
+ int
ga_add_string(garray_T *gap, char_u *p)
{
char_u *cp = vim_strsave(p);
- if (cp != NULL)
+ if (cp == NULL)
+ return FAIL;
+
+ if (ga_grow(gap, 1) == FAIL)
{
- if (ga_grow(gap, 1) == OK)
- ((char_u **)(gap->ga_data))[gap->ga_len++] = cp;
- else
- vim_free(cp);
+ vim_free(cp);
+ return FAIL;
}
+ ((char_u **)(gap->ga_data))[gap->ga_len++] = cp;
+ return OK;
}
-#endif
/*
* Concatenate a string to a growarray which contains bytes.