[coreboot-gerrit] Patch set updated for coreboot: src/include: Move assignment out of if condition

Lee Leahy (leroy.p.leahy@intel.com) gerrit at coreboot.org
Wed Mar 8 20:06:28 CET 2017


Lee Leahy (leroy.p.leahy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18659

-gerrit

commit 75f6a6c7eb5d6cb1f6c5840a20085cf346e88b87
Author: Lee Leahy <leroy.p.leahy at intel.com>
Date:   Tue Mar 7 16:01:09 2017 -0800

    src/include: Move assignment out of if condition
    
    Fix the following error detected by checkpatch.pl:
    
    ERROR: do not use assignment in if condition
    
    TEST=Build and run on Galileo Gen2
    
    Change-Id: I911d528bd85afcd9f3837241494f13d1f9f283ab
    Signed-off-by: Lee Leahy <Leroy.P.Leahy at intel.com>
---
 src/include/string.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/include/string.h b/src/include/string.h
index a000e6c..7597323 100644
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -69,10 +69,13 @@ static inline char *strconcat(const char *s1, const char *s2)
 static inline char *strncpy(char *to, const char *from, int count)
 {
 	register char *ret = to;
+	register char data;
 
 	while (count > 0) {
 		count--;
-		if ((*to++ = *from++) == '\0')
+		data = *from++;
+		*to++  = data;
+		if (data == '\0')
 			break;
 	}
 



More information about the coreboot-gerrit mailing list