On Fri, Jun 9, 2017 at 10:53 AM, Ævar Arnfjörð Bjarmason
<ava...@gmail.com> wrote:

> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -787,6 +787,7 @@ extern char *xstrdup(const char *str);
>  extern void *xmalloc(size_t size);
>  extern void *xmallocz(size_t size);
>  extern void *xmallocz_gently(size_t size);
> +#define freez(p) do { if (p) { free(p); (p) = NULL; } } while (0)

I think we already rely on free(NULL) working, see
http://public-inbox.org/git/alpine.DEB.2.20.1608301948310.129229@virtualbox/
for example, so this could just be:

#define freez(p) do { free(p); (p) = NULL; } while (0)

and yeah FREEZ() would be even better than freez().

Reply via email to