summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-18 23:29:01 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-18 23:29:01 +0100
commitb20e334859334be35de4b295023a2b49bdabbfa9 (patch)
treeadc41d9170de34857be2de9628d10174d1501766 /src/misc2.c
parent61ff4dd6a4d47bd32383fe28087be2b37dec53f4 (diff)
downloadvim-git-b20e334859334be35de4b295023a2b49bdabbfa9.tar.gz
patch 7.4.1131v7.4.1131
Problem: New lines in the viminfo file are dropped. Solution: Copy lines starting with "|". Fix that when using :rviminfo in a function global variables were restored as function-local variables.
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/misc2.c b/src/misc2.c
index 4e9e47357..014c66a9b 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -2140,6 +2140,26 @@ ga_concat_strings(gap, sep)
return s;
}
+#if defined(FEAT_VIMINFO) || defined(PROTO)
+/*
+ * Make a copy of string "p" and add it to "gap".
+ * When out of memory nothing changes.
+ */
+ void
+ga_add_string(garray_T *gap, char_u *p)
+{
+ char_u *cp = vim_strsave(p);
+
+ if (cp != NULL)
+ {
+ if (ga_grow(gap, 1) == OK)
+ ((char_u **)(gap->ga_data))[gap->ga_len++] = cp;
+ else
+ vim_free(cp);
+ }
+}
+#endif
+
/*
* Concatenate a string to a growarray which contains characters.
* When "s" is NULL does not do anything.