lkml.org 
[lkml]   [2015]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] x86,boot: standardize strcmp()
Date
strcmp() is always expected to return 0 when args are
same, <0 when arg1 is lesser and >0 otherwise.
Previously strcmp("a","b") returned 1. Now it gives -1.

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
---
arch/x86/boot/string.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index 493f3fd..318b846 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -30,7 +30,7 @@ int strcmp(const char *str1, const char *str2)
int delta = 0;

while (*s1 || *s2) {
- delta = *s2 - *s1;
+ delta = *s1 - *s2;
if (delta)
return delta;
s1++;
--
1.8.1.msysgit.1


\
 
 \ /
  Last update: 2015-03-16 16:41    [W:0.168 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site