On Sat, 21 Nov 2020 at 21:23, Jeff King <peff@xxxxxxxx> wrote: > > On Sat, Nov 21, 2020 at 07:31:09PM +0100, Martin Ågren wrote: >> > Cc-ing Peff, who initially introduced this helper. After having inlined > > the function into the for loop, it seemed better to just copy the whole > > array. Happy to hear arguments against. > > No, this is way better than the existing code. I introduced it to get > away from strcpy(), but this is better still. But... > > > Come to think of it, I suppose we could copy the whole struct and not > > just the color array. Hmmm... > > Yes, this seems even better. If our goal is just to start our new > grep_opt the same as grep_defaults, then a single-line struct copy > (whether through assignment or memcpy) is even clearer and more > maintainable. Ok, thanks for the encouraging words. I couldn't keep myself from thinking that we're doing this for some weird ... performance reason? Thanks for taking me out of that thought. I'll hold off for a while in case there's more feedback, then look into replacing this patch with a more aggressive copy of the whole struct. Martin