mirror of
https://github.com/CTCaer/switch-l4t-atf.git
synced 2025-03-02 23:56:48 +00:00
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>
This commit is contained in:
parent
6dd74c5b65
commit
5ea2827734
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user