[libvirt] [PATCH 1/6] buf: support peeking at string contents

Eric Blake eblake at redhat.com
Mon Jun 11 15:07:46 UTC 2012


On 06/11/2012 06:05 AM, Peter Krempa wrote:
> On 06/09/12 06:34, Eric Blake wrote:
>> Right now, the only way to get at the contents of a virBuffer is
>> to destroy it.  But there are cases in my upcoming patches where
>> peeking at the contents makes life easier.  I suppose this does
>> open up the potential for bad code to dereference a stale pointer,
>> by disregarding the docs that the return value is invalid on the
>> next virBuf operation, but such is life.
>>
>> * src/util/buf.h (virBufferCurrentContent): New declaration.
>> * src/util/buf.c (virBufferCurrentContent): Implement it.
>> * src/libvirt_private.syms (buf.h): Export it.
>> * tests/virbuftest.c (testBufAutoIndent): Test it.
>> ---
> 
> ACK. Might be useful sometimes. I looked for something like this once.

Thanks; pushed.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120611/6cfe93c3/attachment-0001.sig>


More information about the libvir-list mailing list