generator: Fix API of functions that return RBufferOut
authorRichard Jones <rjones@redhat.com>
Wed, 18 Nov 2009 10:37:10 +0000 (10:37 +0000)
committerRichard Jones <rjones@redhat.com>
Wed, 18 Nov 2009 10:37:10 +0000 (10:37 +0000)
(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.


No differences found