# wasi-libc: Deduplicate sources and headers with regards to upstream musl\. · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/05d8b565ad1a1d6c0c1e93dc47f1d828043fcafc)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 05d8b565ad1a1d6c0c1e93dc47f1d828043fcafc

Requested commit: 05d8b565ad1a1d6c0c1e93dc47f1d828043fcafc

Commit: 05d8b565ad1a1d6c0c1e93dc47f1d828043fcafc

Tree: db8e6ccad3d8e192617f57343886ed59e3954765

Author: Alex Rønne Petersen

Committer: Alex Rønne Petersen

## Message

```
wasi-libc: Deduplicate sources and headers with regards to upstream musl.

Unfortunately some duplicate files must remain in lib/libc/wasi/libc-top-half
because they include internal headers *in the same directory* which have edits
relative to upstream musl. Because C is an amazing language, there is no way to
make it so that e.g. upstream musl's src/stdio/fputc.c includes wasi-libc's
src/stdio/putc.h instead of the upstream putc.h. The preprocessor always
searches the current directory first for quote includes.

Anyway, this still takes us from 2.9M to 1.4M for the combination of
lib/libc/wasi and lib/libc/include/wasm-wasi-musl, so I still call it a win.

```

## Parents

- [31e7c95bd20801c6cb0cfbc47074333754f82ad5](https://git.cafe/gitcafe/zig/commit/31e7c95bd20801c6cb0cfbc47074333754f82ad5?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/05d8b565ad1a1d6c0c1e93dc47f1d828043fcafc?format=markdown)
