| 363 | } |
| 364 | |
| 365 | FILE* ckpt_console_stdout(void) |
| 366 | { |
| 367 | // Created once and never closed: picoc reinitialises per run, but the |
| 368 | // stream is stateless and shared. Unbuffered so each printf reaches the |
| 369 | // pane on the frame it happens, not whenever a 4 KB buffer fills. |
| 370 | static FILE* stream = nullptr; |
| 371 | if (stream == nullptr) { |
| 372 | stream = funopen(nullptr, nullptr, consoleStreamWrite, nullptr, nullptr); |
| 373 | if (stream != nullptr) { |
| 374 | setvbuf(stream, nullptr, _IONBF, 0); |
| 375 | } |
| 376 | } |
| 377 | // A failed funopen degrades to the real stdout: output goes nowhere |
| 378 | // visible (as before this change), but nothing crashes. |
| 379 | return stream != nullptr ? stream : stdout; |
| 380 | } |
| 381 | } |
nothing calls this directly
no outgoing calls
no test coverage detected