Hirohito Higashi wrote:
> 2018-2-9(Fri) 20:30:22 UTC+9 Bram Moolenaar:
> > Patch 8.0.1481
> > Problem: Clearing a pointer takes two lines.
> > Solution: Add vim_clear() to free and clear the pointer.
> > Files: src/misc2.c, src/proto/misc2.pro, src/edit.c
> [...]
>
>
> In todo.txt
> > Use vim_clear() in more places, instead of vim_free() and assigning NULL.
>
> I am working on the above items now.
> Wait about 6 hours.
>
> Remarks:
> It includes the following changes.
> - Since cast is dangerous and troublesome, I changed vim_clear() from
> function to macro.
>
> #define VIM_CLEAR(p) \
> do { \
> vim_free(p); \
> p = NULL; \
> } while (0)
I want to avoid using a macro, because the argument may not be a simple
pointer.
Also, I intentionally only store NULL when it wasn't already set to NULL.
That should be faster.
Why would the cast be dangerous?
--
Shit makes the flowers grow and that's beautiful
/// 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.