Mercurial > vim
comparison src/blob.c @ 25495:7144d2ffc86b v8.2.3284
patch 8.2.3284: no error for insert() or remove() changing a locked blob
Commit: https://github.com/vim/vim/commit/80d7395dcfe96158428da6bb3d28a6eee1244e28
Author: Sean Dewar <seandewar@users.noreply.github.com>
Date: Wed Aug 4 19:25:54 2021 +0200
patch 8.2.3284: no error for insert() or remove() changing a locked blob
Problem: No error for insert() or remove() changing a locked blob.
Solution: Check a blob is not locked before changing it. (Sean Dewar,
closes #8696)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 04 Aug 2021 19:30:04 +0200 |
parents | e2be9f3c5907 |
children | 8d55e978f95b |
comparison
equal
deleted
inserted
replaced
25494:bdb60211e4d3 | 25495:7144d2ffc86b |
---|---|
410 | 410 |
411 /* | 411 /* |
412 * "remove({blob})" function | 412 * "remove({blob})" function |
413 */ | 413 */ |
414 void | 414 void |
415 blob_remove(typval_T *argvars, typval_T *rettv) | 415 blob_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg) |
416 { | 416 { |
417 blob_T *b = argvars[0].vval.v_blob; | |
417 int error = FALSE; | 418 int error = FALSE; |
418 long idx; | 419 long idx; |
419 long end; | 420 long end; |
420 | 421 |
422 if (b != NULL && value_check_lock(b->bv_lock, arg_errmsg, TRUE)) | |
423 return; | |
424 | |
421 idx = (long)tv_get_number_chk(&argvars[1], &error); | 425 idx = (long)tv_get_number_chk(&argvars[1], &error); |
422 if (!error) | 426 if (!error) |
423 { | 427 { |
424 blob_T *b = argvars[0].vval.v_blob; | |
425 int len = blob_len(b); | 428 int len = blob_len(b); |
426 char_u *p; | 429 char_u *p; |
427 | 430 |
428 if (idx < 0) | 431 if (idx < 0) |
429 // count from the end | 432 // count from the end |