On Sat, Feb 20, 2021 at 02:09:45PM +0100, Tim Düsterhus wrote:
> Willy,
> 
> Am 20.02.21 um 14:03 schrieb Willy Tarreau:
> >   - I found 290 occurrences of "free(foo); foo=NULL;". I made a patch to
> >     change them to "destroy(&foo)" to encourage resetting pointers on free
> >     but I figured that a macro was better as it could ultimately also allow
> >     some easy compile-time checks. However we can't call a macro "destroy"
> >     as this conflicts with existing functions. I thought about ha_free()
> >     but then should we call ha_free(&ptr) or ha_free(ptr) ? I tend to
> >     prefer the former to know that it will modify ptr, but I'm pretty sure
> >     that more often than not the second form may be used by thinking about
> >     "free()". So I didn't merge anything and am interested in developers'
> >     opinions on this and even alternate proposals.
> 
> Use `ha_free(&ptr)`, because we already have `istfree(&ist)`.

Good point, I didn't remember :-)

Thanks!
Willy

Reply via email to