Re: [PATCH 1/1] general style: replaces memcmp() with starts_with()

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

 



On Mon, Mar 17, 2014 at 04:07:00PM -0700, Junio C Hamano wrote:

> >> > -		if (!memcmp(used_atom[at], "color:", 6))
> >> > +		if (starts_with(used_atom[at], "color:"))
> >> >  			need_color_reset_at_eol = !!strcmp(used_atom[at], color_reset);
> [...]
> What if used_atom[at] is not related to color at all?  We do not
> want to touch the variable.

Thanks, that is what I was missing. It is not "did we find a reset" but
"toggle on for a non-reset color, toggle off for a reset".

It could be written with skip_prefix as:

  if (skip_prefix(used_atom[at], "color:", &c))
          need_color_reset_at_eol = !!strcmp(c, "reset");

but I do not think it is particularly important to do so. Sorry for the
noise.

-Peff
--
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]