mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Decrease scope of some variables
There are couple of variables that are declared at function beginning but then used solely within a block (either for() loop or if() statement). And just before their use they are zeroed explicitly using memset(). Decrease their scope, use struct zero initializer and drop explicit memset(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Claudio Fontana <cfontana@suse.de>
This commit is contained in:
@@ -444,7 +444,6 @@ cmdDomblkinfoGet(const virDomainBlockInfo *info,
|
||||
static bool
|
||||
cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virDomainBlockInfo info;
|
||||
g_autoptr(virshDomain) dom = NULL;
|
||||
bool human = false;
|
||||
bool all = false;
|
||||
@@ -491,6 +490,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd)
|
||||
g_autofree char *cap = NULL;
|
||||
g_autofree char *alloc = NULL;
|
||||
g_autofree char *phy = NULL;
|
||||
virDomainBlockInfo info = { 0 };
|
||||
|
||||
ctxt->node = disks[i];
|
||||
protocol = virXPathString("string(./source/@protocol)", ctxt);
|
||||
@@ -513,10 +513,6 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* if we don't call virDomainGetBlockInfo() who clears 'info'
|
||||
* we have to do it manually */
|
||||
memset(&info, 0, sizeof(info));
|
||||
}
|
||||
|
||||
if (!cmdDomblkinfoGet(&info, &cap, &alloc, &phy, human))
|
||||
@@ -531,6 +527,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd)
|
||||
g_autofree char *cap = NULL;
|
||||
g_autofree char *alloc = NULL;
|
||||
g_autofree char *phy = NULL;
|
||||
virDomainBlockInfo info = { 0 };
|
||||
|
||||
if (virDomainGetBlockInfo(dom, device, &info, 0) < 0)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user