[libvirt] [PATCHv1 04/13] Separate virStorageFeatureFormat
Peter Krempa
pkrempa at redhat.com
Mon Apr 13 05:30:48 UTC 2015
On Fri, Apr 10, 2015 at 14:58:56 +0200, Ján Tomko wrote:
> For reuse in snapshot_conf.
> ---
> src/conf/storage_conf.c | 23 +----------------------
> src/conf/storage_feature_conf.c | 25 +++++++++++++++++++++++++
> src/conf/storage_feature_conf.h | 3 +++
> 3 files changed, 29 insertions(+), 22 deletions(-)
>
...
> diff --git a/src/conf/storage_feature_conf.c b/src/conf/storage_feature_conf.c
> index 77e6406..2a4b3df 100644
> --- a/src/conf/storage_feature_conf.c
> +++ b/src/conf/storage_feature_conf.c
> @@ -60,3 +60,28 @@ int virStorageFeaturesParse(xmlXPathContextPtr ctxt,
> VIR_FREE(feat_xpath);
> return ret;
> }
> +
> +void virStorageFeaturesFormat(virBufferPtr buf,
> + virBitmapPtr features)
<coding_style_bike_shed>
there's only one line between functions and the return type is not on a
new line.
</coding_style_bike_shed>
> +{
> + size_t i;
> +
> + if (!features)
> + return;
> +
> + if (virBitmapIsAllClear(features)) {
> + virBufferAddLit(buf, "<features/>\n");
> + return;
I like this control flow change.
> + }
> + virBufferAddLit(buf, "<features>\n");
> + virBufferAdjustIndent(buf, 2);
> +
> + for (i = 0; i < VIR_STORAGE_FILE_FEATURE_LAST; i++) {
> + if (virBitmapIsBitSet(features, i))
> + virBufferAsprintf(buf, "<%s/>\n",
> + virStorageFileFeatureTypeToString(i));
> + }
> +
> + virBufferAdjustIndent(buf, -2);
> + virBufferAddLit(buf, "</features>\n");
> +}
ACK,
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150413/d151ecea/attachment-0001.sig>
More information about the libvir-list
mailing list