[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [RFC PATCH 2/2] Routines to parse <numa> ... </numa>

On 10/13/2011 10:10 PM, Bharata B Rao wrote:
Using VIR_ALLOC_N + snprintf here is not desirable, when you
already have a nice  virBufferPtr object in the call that you
could use.  Just pass the virBufferPtr straight into this

Wanted to user virBufferPtr, but I realized that I need to remove
the last comma from the string and coudn't find an easy way to
do that. Hence resorted to this method. But I think I can still
achive this by not appending a comma to the next part of the agrument
(,mems). Let me see if I can do this cleanly in the next post.

Yeah, it might make sense to first add a helper function to util/buf.[ch] that allows one to truncate previously appended bytes, since sometimes it is easier logic to say always emit a trailing comma then trim than it is to say emit a leading comma if I'm not first. Nothing wrong with adding helper functions to make life easier, if virBuffer doesn't already meet your needs.

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

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]