Re: [git-for-windows] Git for Windows v2.24.0-rc0, was Re: [ANNOUNCE] Git v2.24.0-rc0

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

 



On Fri, Oct 25, 2019 at 10:18:30AM +0200, Johannes Schindelin wrote:

> > This cast made me wonder why it was OK to write to system_wide. The
> > answer is that system_path() hands ownership of the memory to us, since
> > 59362e560d (system_path(): always return free'able memory to the caller,
> > 2014-11-24). So I think the better solution than the cast is to drop the
> > "const" from its declaration to better indicate our ownership within the
> > function.
> 
> Makes sense, I changed it to `static char *system_wide;`.

Thanks, perfect.

> > I also wondered how we know that system_wide is a large enough buffer,
> > but I guess normalizing always makes things smaller. It would be nice if
> > normalize_path_copy() said so in its docstring, but that is certainly
> > not new to your patch. :)
> 
> Well, `normalize_path_copy()`'s documentation says:
> 
> 	It is okay if dst == src, but they should not overlap otherwise.
> 
> But yes, that does not state explicitly that the resulting string won't
> be longer than the original one. It is currently true, though the
> documentation hints at the possibility that a future version might
> follow symbolic links (in which case it would no longer be true). But
> then, that would technically not be normalization anymore, but
> canonicalization.

Yeah, and I think we already have functions that do that (and return an
allocated buffer). I have a few cleanups around some callers of
normalize_path_copy(), so I'll roll in the documentation change I
suggested.

-Peff



[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