Re: [PATCH 3/4] grep: simplify color setup

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

 



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




[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