Re: [PATCH v6 1/4] last-modified: new subcommand to show when files were last modified

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

 



On Sat, Aug 2, 2025 at 1:31 PM Christian Couder
<christian.couder@xxxxxxxxx> wrote:

> Q: Do you have other examples than strbuf_release using "release"
> where the function behaves like a "clear" function?
>
> A:
>
> Yes – a handful of other helpers are spelled “*_release()”, yet they
> merely clear the inside of an on‑stack/object‑lifetime struct and
> leave the container itself reusable
>
> - Line reader: void line_buffer_release(struct line_buffer *buf);
>   Closes the underlying file descriptor and frees its internal scratch
> space; the struct line_buffer itself remains valid and can be
> re‑initialised with line_buffer_open() if desired.
>
> - Packet‑line writer: void packet_writer_release(struct packet_writer *writer);
>   Calls strbuf_release(&writer‑>scratch_buf) and clears a few flags;
> the struct packet_writer lives on so the caller may point it at
> another FILE * later.
>
> - FS‑monitor IPC channel: void fsmonitor_ipc__release(struct
> fsmonitor_ipc *ipc);
>   Shuts down the socket, frees small temp buffers, and zeroes the
> struct for re‑use inside the long‑running daemon.
>
> All of these match the behaviour of strbuf_release() rather than that
> of the many *_free() helpers which actually free() the struct itself.

Actually it looks like it hallucinated those examples. It's true that
strbuf_release() makes it possible to reuse the struct, but it's not
efficient as memory needs to be reallocated.

Sorry for the noise.





[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