Eric Blake cdb87b1c4b virBuffer: add way to trim back extra text
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.

* src/util/buf.h (virBufferTrim): Declare.
* src/util/buf.c (virBufferTrim): New function.
* tests/virbuftest.c (testBufTrim): Test it.
2012-05-21 16:01:43 -06:00
..
2012-05-16 10:23:06 -06:00
2012-04-02 09:33:54 -06:00
2012-04-27 17:25:35 -04:00
2011-12-01 13:49:20 -07:00
2011-04-29 10:21:20 -06:00
2011-06-30 18:04:02 +01:00
2009-10-07 12:18:13 +02:00
2009-10-07 12:18:13 +02:00
2012-05-16 10:23:06 -06:00
2011-06-24 08:01:10 -06:00
2012-05-17 11:12:40 -06:00
2010-05-12 08:41:10 +02:00
2011-12-01 13:49:20 -07:00
2010-05-12 08:41:10 +02:00
2011-07-11 09:21:37 -06:00
2012-04-05 22:07:41 -06:00
2009-07-16 15:06:42 +02:00
2010-05-12 08:41:10 +02:00
2010-05-12 08:41:10 +02:00
2011-12-01 14:12:59 -07:00
2011-12-01 14:12:59 -07:00
2010-05-12 08:41:10 +02:00
2012-04-05 22:07:41 -06:00