diff src/misc2.c @ 25382:b80e4e9c4988 v8.2.3228

patch 8.2.3228: cannot use a simple block for the :command argument Commit: https://github.com/vim/vim/commit/5d7c2df536c17db4a9c61e0760bdcf78d0db7330 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jul 27 21:17:32 2021 +0200 patch 8.2.3228: cannot use a simple block for the :command argument Problem: Cannot use a simple block for the :command argument. (Maarten Tournoij) Solution: Recognize a simple {} block. (issue #8623)
author Bram Moolenaar <Bram@vim.org>
date Tue, 27 Jul 2021 21:30:08 +0200
parents ac88cd21ae88
children 02d1b2817585
line wrap: on
line diff
--- 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 *s
     }
     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.