[lkml]   [2013]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/2] tpm/tpm_ppi: Do not compare strcmp(a,b) == -1
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;

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!


 \ /
  Last update: 2013-10-30 21:21    [W:0.058 / U:1.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site