Christ van Willegen wrote:
> > > Op wo 23 jan. 2019 21:57 schreef Bram Moolenaar <b...@moolenaar.net: > > > > > > > > > > > Patch 8.1.0798 > > > > > > > > + if (len > 0) > > > > + to->vval.v_blob->bv_ga.ga_data = > > > > + > > vim_memsave(from->vval.v_blob->bv_ga.ga_data, > > > > len); > > > > + to->vval.v_blob->bv_ga.ga_len = len; > > > > > > > > > > Will this never fail? > > > > It should not. If the length is zero then the ga_data pointer should > > never be used. Write me a test that proves me wrong! :-) > > > > Actually, I meant: what happens if the vim_memsave() call fails. Does it > return NULL? Do other parts of the code handle this? That should happen. Like with List and Dict, a NULL pointer is handled like an empty container. However, it's hard to test this, thus there might be some mistakes. Hmm, perhaps it's better to set the length to zero to avoid these mistakes. In other places ga_grow() is used, that's safer. -- GALAHAD: No. Look, I can tackle this lot single-handed! GIRLS: Yes, yes, let him Tackle us single-handed! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.