Skip to content

Commit

Permalink
[Review] libutee: provide an implementation of putchar()
Browse files Browse the repository at this point in the history
Address Etienne's comments.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
  • Loading branch information
jforissier committed Aug 18, 2017
1 parent 2433171 commit 13d7acd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/libutee/trace_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ int putchar(int c)

if (trace_get_level() >= TRACE_PRINTF_LEVEL)
trace_ext_puts(str);
return c;
/*
* From the putchar() man page:
* "fputc(), putc() and putchar() return the character written as an
* unsigned char cast to an int or EOF on error."
*/
return (int)(unsigned char)c;
}

#else
Expand All @@ -117,9 +122,9 @@ int puts(const char *str __unused)
return 0;
}

int putchar(int c __unused)
int putchar(int c)
{
return c;
return (int)(unsigned char)c;
}

#endif

0 comments on commit 13d7acd

Please sign in to comment.