Re: [PATCH] virBuffer: add way to trim back extra text

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

 



On 05/21/2012 02:26 AM, Daniel Veillard wrote:
> On Fri, May 18, 2012 at 04:42:36PM -0600, Eric Blake wrote:
>> I'm tired of writing:
>>
>> bool sep = false;
>> while (...) {
>>     if (sep)
>>        virBufferAddChar(buf, ',');
>>     sep = true;
>>     virBufferAdd(buf, str);
>> }
>>
>> This makes it easier, allowing one to write:
>>
>> while (...)
>>     virBufferAsprintf(buf, "%s,", str);
>> virBufferTrim(buf, ",", -1);
>>
>> to trim any remaining comma.
>>

> 
>   ACK, interesting addition :-) Code looks fine,

Thanks; pushed.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]