aboutsummaryrefslogtreecommitdiff
path: root/src/include/string.h
diff options
context:
space:
mode:
authorLee Leahy <leroy.p.leahy@intel.com>2017-03-07 16:01:09 -0800
committerLee Leahy <leroy.p.leahy@intel.com>2017-03-13 17:20:43 +0100
commitb1260553be842dd82b0b022dd40a22527d3e3659 (patch)
tree80b4989272d2fa01282cfeba39b5931aa77847cc /src/include/string.h
parentb7e692e0162d51c10c55591822ff8a7053f70056 (diff)
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@intel.com> Reviewed-on: https://review.coreboot.org/18659 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/include/string.h')
-rw-r--r--src/include/string.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/string.h b/src/include/string.h
index a000e6cb62..7597323c47 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;
}