Skip to content

Commit

Permalink
Add #ifdef, comment, and update libc readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane committed Dec 4, 2024
1 parent 5468973 commit c1c3fc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions system/lib/libc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Some changes have been made to the version that was taken from upstream, includi
* Switch to using the wasi `fd_write` syscall instead of `writev`.
* Simplify stdout stream handling: do not support seeking, terminal handling, etc., as it just increases code size and Emscripten doesn't have those features anyhow.
* Setting `_POSIX_REALTIME_SIGNALS` and `_POSIX_SPAWN` macros to -1, to exclude unsupported functions.
* Handling trailing % in `strftime` and `wcsftime` format strings.

Copy log.c and log2.c from earlier version of musl which result in smaller
binary size since they do not rely data tables in log_data.c and log2_data.c.
Expand Down
6 changes: 6 additions & 0 deletions system/lib/libc/musl/src/time/strftime.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,13 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
s[l] = 0;
return l;
}
#ifdef __EMSCRIPTEN__
// Handle trailing % by outputting a % rather than returning 0. Ideally
// this 6 character change could be upstreamed into musl...
if (*f != '%' || !f[1]) {
#else
if (*f != '%') {
#endif
s[l++] = *f;
continue;
}
Expand Down

0 comments on commit c1c3fc5

Please sign in to comment.