On Sat, Jun 10, 2023 at 09:00:54AM +0200, Claudio Jeker wrote: > Instead of building an API for ibufs to handle dynamic strings use > open_memstream(3) which does the same via stdio. > > Now open_memstream() requires a bit more plumbing (one needs to close the > FILE stream and free the buffer) but on the plus side you can use all > stdio functions like fprintf() to fill this string. > While doing this also add error handling and check if the generated string > was created successfully before calling log_info().
This is a lot better than the mess that was there before. One thing I'm not entirely sure about is whether fflush() can fail. I think it can't since previous writes should already have led to reallocations, so another ferror() after fflush() would probably be overdoing it. ok tb