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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220808160833.718531C0F2E%40moolenaar.net.