From: Jonathan Nieder Date: Thu, 11 Aug 2011 10:08:46 GMT Subject: Re: [PATCH 3/5] revert: Allow mixed pick and revert instructions Message-ID: <20110811100846.GA5012@elie.gateway.2wire.net> In-Reply-To: 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';