DevSolar / pdclib

The Public Domain C Library
https://pdclib.rootdirectory.de
Creative Commons Zero v1.0 Universal
228 stars 41 forks source link

Fixed vfprintf buffer not flushing #19

Closed nothotscott closed 3 years ago

nothotscott commented 3 years ago

I'm fairly new to this, but I believe the buffer in vfprintf should finish flushing like in puts.c

DevSolar commented 3 years ago

Characters are written only in _PDCLIB_print() (which does handle flushing), or in the "print verbatim" part, which also checks for flushing. Unless I am mistaken, which of course is always a possibility...?

nothotscott commented 3 years ago

I am unaware of _PDCLIB_print handling flushing. Perhaps my implementation is wrong. I implement PDCLib in my operating system, VisualOS, and flushing the buffer at the end of the vfprintf like how puts does it fixed steams not being fully flushed.

DevSolar commented 3 years ago

I will take a closer look at this once time allows.

_PDCLIB_print() goes through the locally defined macro PUT() which in turn goes through putc() for streams. Inellegant and on my long list for improvement, but it should handle flushing correctly.

You don't happen to have a patch for the test suite triggering the issue?

nothotscott commented 3 years ago

I fixed my implementation error. Do you have a discord so we can continue the discussion before I close this pull request. You can add me at NoThot#4314

DevSolar commented 3 years ago

Your pull request now includes your whole build dierctory...

Again: Most useful would be a test case to show how exactly this buffer issue can be triggered. That would allow me to 1) verify there is an issue; 2) verify your patch actually solves it; 3) get an idea on whether this same issue might appear in other functions as well.

DevSolar commented 3 years ago

Closed because...?

JayFoxRox commented 3 years ago

Closed because...?

GitHub auto-closes when there's no diff left, which probably happened while pushing the broken history. At least I assume that's what happened.

After closing a PR, GitHub also stops tracking git history, and re-opening (even if possible) can have very bizarre side-effects / bogus history (unless they fixed it sometime, which I strongly doubt).