Skip to content

Commit e8209b9

Browse files
committed
patch 8.2.2783: duplicate code for setting byte in blob, blob test may fail
Problem: Duplicate code for setting byte in blob, blob test may fail. Solution: Call blob_set_append(). Test sort failure with "N".
1 parent 39211cb commit e8209b9

3 files changed

Lines changed: 4 additions & 16 deletions

File tree

src/eval.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,21 +1321,7 @@ set_var_lval(
13211321
{
13221322
val = (int)tv_get_number_chk(rettv, &error);
13231323
if (!error)
1324-
{
1325-
garray_T *gap = &lp->ll_blob->bv_ga;
1326-
1327-
// Allow for appending a byte. Setting a byte beyond
1328-
// the end is an error otherwise.
1329-
if (lp->ll_n1 < gap->ga_len
1330-
|| (lp->ll_n1 == gap->ga_len
1331-
&& ga_grow(&lp->ll_blob->bv_ga, 1) == OK))
1332-
{
1333-
blob_set(lp->ll_blob, lp->ll_n1, val);
1334-
if (lp->ll_n1 == gap->ga_len)
1335-
++gap->ga_len;
1336-
}
1337-
// error for invalid range was already given in get_lval()
1338-
}
1324+
blob_set_append(lp->ll_blob, lp->ll_n1, val);
13391325
}
13401326
}
13411327
else if (op != NULL && *op != '=')

src/testdir/test_blob.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ func Test_blob_sort()
630630
if has('float')
631631
call CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:')
632632
endif
633-
call CheckLegacyAndVim9Failure(['call sort(["abc", 0z11], "f")'], 'E892:')
633+
call CheckLegacyAndVim9Failure(['call sort([11, 0z11], "N")'], 'E974:')
634634
endfunc
635635

636636
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2783,
753755
/**/
754756
2782,
755757
/**/

0 commit comments

Comments
 (0)