Skip to content

Commit

Permalink
fixup! sys/fmt: print(): use fflush(); stdio_write() vs. fwrite()
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Feb 7, 2023
1 parent 2fb98a9 commit ba8a886
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sys/fmt/fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,10 @@ uint32_t scn_u32_hex(const char *str, size_t n)
return res;
}

/* native gets special treatment as native's stdio code is ...
* special */
/* native gets special treatment as native's stdio code is ... special.
* And when not building for RIOT, there's no `stdio_write()`.
* In those cases, just defer to `printf()`.
*/
#if IS_USED(MODULE_STDIO_NATIVE) || !defined(RIOT_VERSION)
void print(const char *s, size_t n)
{
Expand All @@ -517,7 +519,7 @@ void print(const char *s, size_t n)
#else
void print(const char *s, size_t n)
{
/* flush the libc's output buffer so output is not intermangled. */
/* flush the libc's output buffer so output is not intermingled. */
fflush(stdout);

stdio_write(s, n);
Expand Down

0 comments on commit ba8a886

Please sign in to comment.