Re: [RFC] Re: Convert 'git blame' to parse_options()

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

 




On Tue, 24 Jun 2008, Pierre Habouzit wrote:
> 
>   Actually this doesn't work because it may point into the strbuf that
> will be invalidated later. Our sole option here is to leak some memory I
> fear.

I think leaking memory is ok (it's obviously going to be bounded by the 
size of the arguments you pass into a program), but I also think you can 
just change the option strings in place.

Yeah, I know - it's impolite, and we even marked things "const char", but 
"const" in C is just a politeness thing, we can just choose to have a 
function with a big comment that changes the string anyway. We'll have to 
make sure that the few places that actually create argument strings by 
hand (ie not from the ones supplied by a real "execve()") not do them so 
that they need splitting (but no current ones would need to, obviously, 
since splitting the argumens isn't even supported yet).

Or, if people hate that, just leak a few malloc'ed areas. That's arguably 
the more straightforward way.

			Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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