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)
commitf5a3da14837fe65eab1df41df33f2bafeddcd9ce
tree3dbd74ef7c72fe471fba77ae102efb7fd47ff9b5
parent5c2da21b2ae56adc16bbd5bf9740a04ca70f9f19
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.
fuse/guestmount.c
src/generator.ml