Hi!
[ Given the three variants, maybe this was sent by accident? Anyway. ]
It would be good to know the motivation behind this. I'm guessing you are
On Fri, 2013-08-30 at 15:29:24 -0700, Shawn Landden wrote:
> This way a program reading from dpkg-query through a pipe will get the
> output in a single read()
finding some severe performance problem when dealing with the output?
But I'd not merge something in this specific form, because it complicates
the code unnecessarily, and it's not using the available interfaces (like
ohshit[e], m_malloc, m_realloc, varbuf, etc) which avoid problems found
here such as memory leaks, unperformant string handling (strcat), etc.
In any case I guess what you actually wanted might be something like
the attached patch, which switches stdout to be fully buffered in case
it's not a tty. If that'd help I guess I could consider adding code like
that to all commands, although conversely the problem then is that
programs reading from a pipe will not be able to process lines as they
come, and will stall on full buffers instead which might also slow
down the pipeline.
Thanks,
Guillem