Using alloc_clear() instead alloc() in match_add() proved to be a very good fix: sometimes i could have a segfault on vim's start without it (today i was lucky to catch a core dump on an older patch and gdb showed that the reason was uninitialized m->pos array).
Also this allows removing line m->pos.cur = 0; four lines below: perhaps this will make the code cleaner? Cheers, Alexey. 2014-06-18 15:01 GMT+04:00 Bram Moolenaar <[email protected]>: > > Dominique wrote: > > [...] > > > > Compiling with gcc -O2, I also get this compilation warning > > > which also points to the same bug: > > > > > > screen.c:7471:3: warning: 'nmatched' may be used uninitialized in this > > > function [-Wmaybe-uninitialized] > > > > > > Bug is introduced in vim-7.4.330. > > > > > > Attached patch fixes it but but I don't understand this > > > code enough to tell whether it's correct, so please > > > review it. Patch also fixes a typo in :help matchaddpos(). > > > > > > Regards > > > Dominique > > > > > > I just see that my patch fixes another bug with Vim-7.4.333: > > > > Type: > > > > $ vim vim/src/screen.c +312 > > > > Then move cursor up and down with k j around > > the curly brace at line screen.c:312. > > > > Observe that the curly brace sometimes remains > > highlighted when moving above or below the curly brace. > > That's a bug. Curly brace should not be highlighted when > > moving above or below it. The proposed patch that fixes > > valgrind errors also happens to fix this bug with spurious > > highlight of parenthesis. > > Thanks for the fix. The patch is complicated and has only one small > test. Please look out for any further problems. It is a useful > addition, should make match highlighting much faster, worth taking some > risk. > > -- > Yah, well, we had to carve our electrons out of driftwood we'd > find. In the winter. Uphill. Both ways. > > /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net > \\\ > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ > \\\ > \\\ an exciting new programming language -- http://www.Zimbu.org > /// > \\\ 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]. > For more options, visit https://groups.google.com/d/optout. > -- -- 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]. For more options, visit https://groups.google.com/d/optout.
