diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-04-18 16:08:52 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-04-18 16:08:52 +0200 |
commit | e8209b91b9974da95899b51dba4058b411d04d5b (patch) | |
tree | df9aa765f924ce91cfc436f9ba4254f3a9b3d2a3 /src/eval.c | |
parent | 39211cba723a2cb58a97c7e08826713164b86efc (diff) | |
download | vim-git-e8209b91b9974da95899b51dba4058b411d04d5b.tar.gz |
patch 8.2.2783: duplicate code for setting byte in blob, blob test may failv8.2.2783
Problem: Duplicate code for setting byte in blob, blob test may fail.
Solution: Call blob_set_append(). Test sort failure with "N".
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/src/eval.c b/src/eval.c index f8e922f91..4dbbc4096 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1321,21 +1321,7 @@ set_var_lval( { val = (int)tv_get_number_chk(rettv, &error); if (!error) - { - garray_T *gap = &lp->ll_blob->bv_ga; - - // Allow for appending a byte. Setting a byte beyond - // the end is an error otherwise. - if (lp->ll_n1 < gap->ga_len - || (lp->ll_n1 == gap->ga_len - && ga_grow(&lp->ll_blob->bv_ga, 1) == OK)) - { - blob_set(lp->ll_blob, lp->ll_n1, val); - if (lp->ll_n1 == gap->ga_len) - ++gap->ga_len; - } - // error for invalid range was already given in get_lval() - } + blob_set_append(lp->ll_blob, lp->ll_n1, val); } } else if (op != NULL && *op != '=') |