Re: [PATCH 3/5] revert: Allow mixed pick and revert instructions
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 11, 2011, 10:08 UTC
- Message-ID
- <20110811100846.GA5012@elie.gateway.2wire.net>
- In-Reply-To
- <CALkWK0mMVgnngU5JB4O+7crCjGCdRnVrbm4jjsgkFFUMeBS9_A@mail.gmail.com>
Ramkumar Ramachandra wrote:
> Good point. I'm tempted to check (q - p < 40); is there a better way > to do this by not hardcoding "40" perhaps?
Something like the following seems idiomatic.
if (q - p + 1 > sizeof(buf)) return error(...); memcpy(buf, p, q - p); buf[q - p] = '\0';