Re: [PATCH v2] stash: pass pathspec as pointer
- From
Thomas Gummerer <t.gummerer@gmail.com>
- Date
- Mar 15, 2019, 22:33 UTC
- Message-ID
- <20190315223320.GH16414@hank.intra.tgummerer.com>
- In-Reply-To
- <nycvar.QRO.7.76.6.1903132311200.41@tvgsbejvaqbjf.bet>
On 03/13, Johannes Schindelin wrote:
Show 19 quoted lines
> Hi Thomas, > > On Tue, 12 Mar 2019, Thomas Gummerer wrote: > > > On 03/12, Johannes Schindelin wrote: > > > However, we would not have needed to move the initialization of > > > `rev.prune_data`, I don't think, because `init_revision()` zeros the > > > entire struct, including `prune_data`, which would have made > > > `clear_pathspec()` safe to call, too. > > > > 'clear_pathspec()' doesn't actually check whether the parameter passed > > to it is NULL or not before dereferencing it. > > In this case, it does not need to check for NULL, as `&rev.prune_data` > will always be non-NULL: `rev`'s `prune_data` field is of type `struct > patchspec`, i.e. *not* a pointer (in which case the type would be `struct > pathspec *`). See for yourself: > > https://github.com/git/git/blob/v2.21.0/revision.h#L91
Doh, you're right of course, I totally missed that. Thanks for the pointer, and sorry for the noise!