Re: [PATCH 04/14] combine-diff: use pointer for parent paths

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

 



Jeff King <peff@xxxxxxxx> writes:

> Commit d76ce4f734 (log,diff-tree: add --combined-all-paths option,
> 2019-02-07) added a "path" field to each combine_diff_parent struct.
> It's defined as a strbuf, but this is overkill. We never manipulate the
> buffer beyond inserting a single string into it.
>
> And in fact there's a small bug: we zero the parent structs, including
> the path strbufs. For the 0th parent, we strbuf_init() the strbuf before
> adding to it. But for subsequent parents, we never do the init. This is
> technically violating the strbuf API, though the code there is resilient
> enough to handle this zero'd state.
>
> This patch switches us to just store an allocated string pointer.
> Zeroing it is enough to properly initialize it there (modulo the usual
> assumption we make that a NULL pointer is all-zeroes).

Yay!  Every time I see an array of strbufs, my skin tingles.  Thanks
for cleaning this up.




[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