[libvirt] [PATCHv2 01/13] virbuf: fix const-correctness

Eric Blake eblake at redhat.com
Thu Oct 20 22:11:42 UTC 2011


On 10/17/2011 07:43 PM, Hai Dong Li wrote:
>>
> Okay, forget the context line.
> What I wanted to say is that the function virBufferAdd in the buf.c
> still has the const before the virBufferPtr while the declaration of
> this function in buf.h has const removed, after applying this patch.

Ah, yes, and I fixed that before pushing.

On 10/19/2011 04:01 AM, Peter Krempa wrote:
 > On 09/29/2011 06:22 PM, Eric Blake wrote:
 >> Although the compiler wasn't complaining (since it was the pointer,
 >> rather than what was being pointed to, that was actually const), it
 >> looks quite suspicious to call a function with an argument labeled
 >> const when the nature of the pointer (virBufferPtr) is hidden behind
 >> a typedef. Dropping const makes the function declarations easier
 >> to read.
 >>
 >> * src/util/buf.h: Drop const from all functions that modify buffer
 >> argument.
 >> * src/util/buf.c (virBufferSetError, virBufferAdd)
 >> (virBufferContentAndReset, virBufferFreeAndReset)
 >> (virBufferAsprintf, virBufferVasprintf, virBufferEscapeString)
 >> (virBufferEscapeSexpr): Fix fallout.
 >> ---
 >>
 > ACK, but be careful while rebasing to current head.
 > Some new functions were added recently to buf.[ch] and you'll
 > get a nasty conflict on buf.h. (Dont forget to merge virBufferEscape)

Yep, I've actually had that conflict resolved locally for a couple days.

Pushed now.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list