Junio C Hamano <gits...@pobox.com> wrote:
> Eric Wong <e...@80x24.org> writes:
> > I don't see the point of a macro wrapper, forcing the user to
> > type out the '&' should drive home the point that the pointer
> > gets set to NULL.  I also find capitalization tiring-to-read
> > because all characters are the same height.
> 
> Sounds sensible.
> 
> So make Jonathan's freez_impl a public API and rename it to
> free_and_null(), perhaps?

Perhaps...  I think it needs to take "void *" to avoid warnings:

        static inline void free_and_null(void *ptrptr)
        {
                void **tmp = ptrptr;

                free(*tmp);
                *tmp = NULL;
        }

...At least I needed to do that for "mog_free_and_null" in
cmogstored:

        https://bogomips.org/cmogstored.git/plain/alloc.c?h=v1.6.0

But heck, maybe that's covering up for something else I got
wrong in cmogstored *shrug*    I don't know all of C.

Reply via email to