Mercurial > vim
diff src/misc2.c @ 7664:1fded31d9e04 v7.4.1131
commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 18 23:29:01 2016 +0100
patch 7.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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 18 Jan 2016 23:30:05 +0100 |
parents | 80bc36419c21 |
children | 37c929c4a073 |
line wrap: on
line diff
--- 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.