Re: [PATCH 1/2] tpm/tpm_ppi: Do not compare strcmp(a,b) == -1

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

 



Hi Joe, Jason
> fyi: using
> 	if (strcmp(foo, bar) < 0)
> is canonical.

Yeah of course you're both right - 
    if (strcmp(foo, bar) < 0) 
is the correct version.
Sorry about the rubbish patch.


> lib/string.c:strcmp returns only -1,0,1
> so that's what the arch versions should do too.
> However, arch implementations do vary...

Joe, You are right on this one as well.

I did not pay attention to where cscope did send me 
- it was arch/x86/boot/string.c which implements it as 

        while (*s1 || *s2) {
                delta = *s2 - *s1;
                if (delta)
                        return delta;
                s1++;
                s2++;
        }

Although I know that this is not used here, 
it differs from the version in lib. (Maybe worth changing?)


In anycase 
    if (strcmp(foo, bar) < 0)
is better than
    if (strcmp(foo, bar) == -1)
so I'll resend the patch.

Thanks for reviewing!

Peter

--
To unsubscribe from this list: send the line "unsubscribe stable" 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]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]