Printing directly into an stdio stream and hooking up to the flush (the
write callback) avoids having to allocate+free a temporary buffer on
every printing call. The FILE uses a permanent buffer for storing the
text, and once it fills up or a newline is detected, it is flushed out.
It is fine to mix the new and the old APIs, since the old API flushes
the stream.
The buffer size of 3 kB is just a guess.
The man-page for fopencookie() recommends setting _FILE_OFFSET_BITS to
64. Even though this patch does not strictly need it (we don't implement
seek or take the address of fopencookie()), I think it's good to follow
anyway.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>