diff options
author | davidcunado-arm <david.cunado@arm.com> | 2018-03-22 06:17:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-22 06:17:37 +0000 |
commit | fbdadd015dd89574cdc25e7edb3a589244dd4d73 (patch) | |
tree | cd78624db096bd6a7771ec17c095c6f446b87a08 /lib | |
parent | ff48086b32b84dfcbdfb803180fda65a4fa08386 (diff) | |
parent | 5ea2827734be3e8c1f620de47a9e01f41ca99e2f (diff) | |
download | platform_external_arm-trusted-firmware-fbdadd015dd89574cdc25e7edb3a589244dd4d73.tar.gz platform_external_arm-trusted-firmware-fbdadd015dd89574cdc25e7edb3a589244dd4d73.tar.bz2 platform_external_arm-trusted-firmware-fbdadd015dd89574cdc25e7edb3a589244dd4d73.zip |
Merge pull request #1311 from jonathanwright-ARM/jw/MISRA-EOF-usage
stdlib: remove comparison with EOF macro to comply with MISRA
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; } |