generator: Fix API of functions that return RBufferOut
(NB: The API / ABI doesn't actually change here - it's just made much
simpler to use).
The API for RBufferOut functions was unexpectedly hard to use in the
case where a zero-length buffer might be returned. For discussion on
this see:
https://www.redhat.com/archives/libguestfs/2009-November/thread.html#00115
This commit ensures that in the zero-length buffer case, the return
value is never NULL. Thus code is now able to just check if the return
value == NULL to indicate an error, which is simpler for all concerned.
The implementation of this is, however, more complex because we have
to be careful about this case inside both the daemon and the library
code, which is what this commit does.
This has passed a full round of tests.