Re: [PATCH 1/2] [GSOC] ref-filter: add %(raw) atom

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

 



Phillip Wood <phillip.wood123@xxxxxxxxx> 于2021年5月30日周日 下午9:05写道:
>
> >   static int memcasecmp(const void *vs1, const void *vs2, size_t n)
> >   {
> > -       size_t i;
> > -       const char *s1 = (const char *)vs1;
> > -       const char *s2 = (const char *)vs2;
> > -
> > -       for (i = 0; i < n; i++) {
> > -               unsigned char u1 = s1[i];
> > -               unsigned char u2 = s2[i];
> > -               int U1 = toupper (u1);
> > -               int U2 = toupper (u2);
> > -               int diff = (UCHAR_MAX <= INT_MAX ? U1 - U2
> > -                       : U1 < U2 ? -1 : U2 < U1);
> > +       const char *s1 = (const void *)vs1;
> > +       const char *s2 = (const void *)vs2;
>
> I think the new version looks fine apart from these casts. vs1 declared
> as 'const void *' in the function signature so this cast does not do
> anything. You could cast using (const char *) instead if you wanted but
> that is not required as you can assign a 'const void *' to 'const
> whatever *' without a cast.
>

Yes, forced conversion in "const char *s1 = (const char *)vs1;" is somewhat
redundant.

> Best Wishes
>
> Phillip
>

Thanks.
--
ZheNing Hu




[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