diff options
author | Jonathan Wright <jonathan.wright@arm.com> | 2018-03-06 16:23:28 +0000 |
---|---|---|
committer | Jonathan Wright <jonathan.wright@arm.com> | 2018-03-15 13:32:54 +0000 |
commit | 5ea2827734be3e8c1f620de47a9e01f41ca99e2f (patch) | |
tree | 3d724bb51dd9f4f0837d7898f13c545e87800acd /lib | |
parent | 6dd74c5b653f2d1e3c928e25af98b273c6cca044 (diff) | |
download | platform_external_arm-trusted-firmware-5ea2827734be3e8c1f620de47a9e01f41ca99e2f.tar.gz platform_external_arm-trusted-firmware-5ea2827734be3e8c1f620de47a9e01f41ca99e2f.tar.bz2 platform_external_arm-trusted-firmware-5ea2827734be3e8c1f620de47a9e01f41ca99e2f.zip |
stdlib: remove comparison with EOF macro to comply with MISRA
Ensures compliance with MISRA C-2012 Rule 22.7
Change-Id: Ifbe0926a24ba0dca18174e1aa87313a63bba50fb
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stdlib/puts.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/stdlib/puts.c b/lib/stdlib/puts.c index 693a6bff3..284cf8c52 100644 --- a/lib/stdlib/puts.c +++ b/lib/stdlib/puts.c @@ -9,23 +9,17 @@ int puts(const char *s) { int count = 0; - while(*s) - { - if (putchar(*s++) != EOF) { - count++; - } else { - count = EOF; - break; - } + while(*s) { + if (putchar(*s++) == EOF) + return EOF; + count++; } /* According to the puts(3) manpage, the function should write a * trailing newline. */ - if ((count != EOF) && (putchar('\n') != EOF)) - count++; - else - count = EOF; + if (putchar('\n') == EOF) + return EOF; - return count; + return count + 1; } |