[libvirt] [PATCH] (qemuTeardownDiskCgroup): avoid dead code
Eric Blake
eblake at redhat.com
Mon May 17 21:00:23 UTC 2010
On 05/17/2010 02:52 PM, Jim Meyering wrote:
> It's a good thing the latter while loop condition
> could never be true -- otherwise it'd be an infloop.
>
> static int qemuTeardownDiskCgroup(virCgroupPtr cgroup,
> virDomainObjPtr vm,
> virDomainDiskDefPtr disk)
> {
> char *path = disk->src;
> int ret = -1;
>
> - while (path != NULL) {
> + do {
> virStorageFileMetadata meta;
> int rc;
>
> VIR_DEBUG("Process path %s for disk", path);
...
> path = meta.backingStore;
> } while (path != NULL);
Are we sure disk->src is guaranteed to be non-NULL on entry, or would
have been better to rewrite this as while{}/*nothing*/ instead of do{}while?
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100517/b41eba69/attachment-0001.sig>
More information about the libvir-list
mailing list