memstream: return the internal string in vlc_memstream_close()
It's NULL in case there's an error. We don't need an error code for that.
In many case the result is just returned the same way without touching the vlc_memstream
anymore.
We can keep the VLC_USED
and even add VLC_MALLOC
for these return values.
Merge request reports
Activity
changed milestone to %4.0
added Component::Core label
added MRStatus::Reviewable label
Reference !4585 (comment 417984)
And not using
VLC_USED
might lead for forgetting checking the error. So I might drop these patchesI'm not a fan either,
vlc_memstream
works like an error monad which resolves into an error and a buffer in the end. Mixing both means that error can be ignored without it being visible in the code.In this case the implementation cannot be used as the original open_memstream implementation (remove the
vlc_memstream_
prefix and replacevlc_memstream
by FILE on Linux and see what happens when you compile).IMO we should follow standards when they are convenient. The fact you had to use a custom structure to re-implement it means the design was probably not that good to start with. And we end up being tied to a design that's impracticle for us, and then blocking usage that would be cleaner that the original design and/or more adapted to our (portable) use.
added MRStatus::InReview label and removed MRStatus::Reviewable label
mentioned in merge request !4588 (merged)