diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-15 22:44:17 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-15 22:44:17 +0100 |
commit | 3d28b58c519c9fc3427587201423c74746cc219e (patch) | |
tree | 88d28470a3b7ac35a42521621745ace86598b89a /src/eval.c | |
parent | 2ea773b468a1143214c2f12b91ab5e1e7abb4a14 (diff) | |
download | vim-git-3d28b58c519c9fc3427587201423c74746cc219e.tar.gz |
patch 8.1.0756: copy() does not make a copy of a Blobv8.1.0756
Problem: copy() does not make a copy of a Blob.
Solution: Make a copy.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c index 049d15cee..af1021bdc 100644 --- a/src/eval.c +++ b/src/eval.c @@ -8198,7 +8198,6 @@ item_copy( case VAR_SPECIAL: case VAR_JOB: case VAR_CHANNEL: - case VAR_BLOB: copy_tv(from, to); break; case VAR_LIST: @@ -8217,6 +8216,21 @@ item_copy( if (to->vval.v_list == NULL) ret = FAIL; break; + case VAR_BLOB: + to->v_type = VAR_BLOB; + if (from->vval.v_blob == NULL) + to->vval.v_blob = NULL; + else if (rettv_blob_alloc(to) == FAIL) + ret = FAIL; + else + { + int len = from->vval.v_blob->bv_ga.ga_len; + + to->vval.v_blob->bv_ga.ga_data = + vim_memsave(from->vval.v_blob->bv_ga.ga_data, len); + to->vval.v_blob->bv_ga.ga_len = len; + } + break; case VAR_DICT: to->v_type = VAR_DICT; to->v_lock = 0; |