Re: [PATCH 1/2] diff: add an API for deferred freeing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ævar,

On Thu, 11 Feb 2021, Ævar Arnfjörð Bjarmason wrote:

> On Wed, Feb 10 2021, Johannes Schindelin wrote:
>
> > On Fri, 5 Feb 2021, Ævar Arnfjörð Bjarmason wrote:
> >
> >> Add a diff_free() function to free anything we may have allocated in
> >> the "diff_options" struct, and the ability to make calling it a noop
> >> by setting "no_free" in "diff_options".
> >
> > Why do we need a `no_free` flag? Why not simply set the `free()`d (or
> > `fclose()`d) attributes to `NULL`?

Hmm. That was not even clear to me until I read this reply.

Doesn't this indicate that the closing is done at the wrong layer? If we
want to call a function N times and only at the last iteration should it
clean up our resources, doesn't that indicate that the clean-up should be
pulled out from that function?

I thought that's exactly what you did, but I must have glanced over
something obvious...

Ciao,
Dscho

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux