Patch 9.0.0172

3 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 8, 2022, 12:08:46 PM8/8/22
to vim...@googlegroups.com

Patch 9.0.0172
Problem: Trying to allocate zero bytes.
Solution: Do not allocate the proptype array when there are none.
(closes #10867)
Files: src/textprop.c, src/testdir/test_textprop.vim


*** ../vim-9.0.0171/src/textprop.c 2022-08-08 14:59:44.109986834 +0100
--- src/textprop.c 2022-08-08 16:26:36.848087691 +0100
***************
*** 736,742 ****
int low = 0;
int high;

! if (ht == NULL)
return NULL;

// Make the loopup faster by creating an array with pointers to
--- 736,742 ----
int low = 0;
int high;

! if (ht == NULL || ht->ht_used == 0)
return NULL;

// Make the loopup faster by creating an array with pointers to
*** ../vim-9.0.0171/src/testdir/test_textprop.vim 2022-08-08 14:59:44.109986834 +0100
--- src/testdir/test_textprop.vim 2022-08-08 17:06:22.779113989 +0100
***************
*** 71,76 ****
--- 71,88 ----
call assert_fails("call prop_type_add('one', {'bufnr': 98764})", "E158:")
endfunc

+ def Test_proptype_add_remove()
+ # add and remove a prop type so that the array is empty
+ prop_type_add('local', {bufnr: bufnr('%')})
+ prop_type_delete('local', {bufnr: bufnr('%')})
+ prop_type_add('global', {highlight: 'ErrorMsg'})
+ prop_add(1, 1, {length: 1, type: 'global'})
+ redraw
+
+ prop_clear(1)
+ prop_type_delete('global')
+ enddef
+
def Test_proptype_buf_list()
new
var bufnr = bufnr('')
*** ../vim-9.0.0171/src/version.c 2022-08-08 16:03:02.310984016 +0100
--- src/version.c 2022-08-08 17:03:23.018218911 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 172,
/**/

--
There is a fine line between courage and foolishness.
Unfortunately, it's not a fence.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages