diff mbox

[2/8] string: fix strncmp function

Message ID 1386767259-15693-3-git-send-email-p.wilczek@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Piotr Wilczek Dec. 11, 2013, 1:07 p.m. UTC
Fix function to return the number of characters that differ in
the compared strings.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 string.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/string.c b/string.c
index d13e22b..ced25c8 100644
--- a/string.c
+++ b/string.c
@@ -24,7 +24,7 @@  int strncmp(const char *stra, const char *strb, int len)
 	const char *b = strb;
 
 	while ((a - stra) < len)
-		diff += *(a++) - *(b++);
+		diff += !!(*(a++) - *(b++));
 
 	return diff;
 }