In short, virXXXPtr type is going away. With bing bang. And to
help us rewrite the code with a sed script, it's better if each
variable is declared on its own line.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/bhyve/bhyve_command.c | 5 ++++-
src/bhyve/bhyve_driver.c | 3 ++-
src/conf/domain_addr.c | 3 ++-
src/conf/domain_conf.c | 3 ++-
src/conf/numa_conf.c | 3 ++-
src/conf/nwfilter_params.c | 3 ++-
src/conf/virnetworkobj.c | 3 ++-
src/hypervisor/domain_driver.c | 3 ++-
src/hypervisor/virhostdev.c | 3 ++-
src/libxl/libxl_driver.c | 9 ++++++---
src/libxl/xen_common.c | 12 ++++++++----
src/libxl/xen_xl.c | 24 +++++++++++++++--------
src/libxl/xen_xm.c | 3 ++-
src/lxc/lxc_controller.c | 3 ++-
src/lxc/lxc_driver.c | 12 ++++++++----
src/network/bridge_driver.c | 9 +++++++--
src/nwfilter/nwfilter_ebiptables_driver.c | 6 ++++--
src/openvz/openvz_driver.c | 3 ++-
src/qemu/qemu_agent.c | 3 ++-
src/qemu/qemu_domain.c | 3 ++-
src/qemu/qemu_driver.c | 15 +++++++++-----
src/qemu/qemu_monitor_json.c | 14 +++++++++----
src/rpc/virnetserverclient.c | 3 ++-
src/security/security_stack.c | 3 ++-
src/test/test_driver.c | 3 ++-
src/util/virconf.c | 11 ++++++++---
src/util/virnetdevbandwidth.c | 3 ++-
src/util/virnetdevbandwidth.h | 3 ++-
src/vz/vz_driver.c | 3 ++-
src/vz/vz_sdk.c | 9 ++++++---
tests/virnetdaemontest.c | 12 ++++++++----
tests/virpcitest.c | 9 ++++++---
32 files changed, 139 insertions(+), 65 deletions(-)
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index c4c64788b9..e3c2921dea 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -917,7 +917,10 @@ virBhyveProcessBuildGrubbhyveCmd(virDomainDefPtr def,
const char *devmap_file,
char **devicesmap_out)
{
- virDomainDiskDefPtr hdd, cd, userdef, diskdef;
+ virDomainDiskDefPtr hdd;
+ virDomainDiskDefPtr cd;
+ virDomainDiskDefPtr userdef;
+ virDomainDiskDefPtr diskdef;
virCommandPtr cmd;
unsigned int best_idx = UINT_MAX;
size_t i;
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 8363259d4c..158fee4445 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -681,7 +681,8 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn,
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
bhyveConnPtr privconn = conn->privateData;
virDomainDefPtr def = NULL;
- virCommandPtr cmd = NULL, loadcmd = NULL;
+ virCommandPtr cmd = NULL;
+ virCommandPtr loadcmd = NULL;
char *ret = NULL;
virCheckFlags(0, NULL);
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index fa08f5381d..8b927689f8 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -2082,7 +2082,8 @@ int
virDomainUSBAddressSetAddHub(virDomainUSBAddressSetPtr addrs,
virDomainHubDefPtr hub)
{
- virDomainUSBAddressHubPtr targetHub = NULL, newHub = NULL;
+ virDomainUSBAddressHubPtr targetHub = NULL;
+ virDomainUSBAddressHubPtr newHub = NULL;
int ret = -1;
int targetPort;
g_autofree char *portStr = NULL;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 08e09362ee..47756ff0be 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17621,7 +17621,8 @@ virDomainChrDefPtr
virDomainChrRemove(virDomainDefPtr vmdef,
virDomainChrDefPtr chr)
{
- virDomainChrDefPtr ret = NULL, **arrPtr = NULL;
+ virDomainChrDefPtr ret = NULL;
+ virDomainChrDefPtr **arrPtr = NULL;
size_t i, *cntPtr = NULL;
if (virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType,
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 338d779e90..64b93fd7d1 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -780,7 +780,8 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNumaPtr def,
}
for (i = 0; i < sibling; i++) {
- virDomainNumaDistancePtr ldist, rdist;
+ virDomainNumaDistancePtr ldist;
+ virDomainNumaDistancePtr rdist;
unsigned int sibling_id, sibling_value;
/* siblings are in order of parsing or explicitly numbered */
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 1be492759a..5fa5d4fedb 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -402,7 +402,8 @@
virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
GHashTable *hash)
{
size_t i, j;
- virNWFilterVarValuePtr varValue, tmp;
+ virNWFilterVarValuePtr varValue;
+ virNWFilterVarValuePtr tmp;
const char *value;
varValue = virHashLookup(hash, cie->varNames[0]);
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 1e167c7874..6ff6c63218 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -1254,7 +1254,8 @@ virNetworkObjUpdate(virNetworkObjPtr obj,
unsigned int flags) /* virNetworkUpdateFlags */
{
int ret = -1;
- virNetworkDefPtr livedef = NULL, configdef = NULL;
+ virNetworkDefPtr livedef = NULL;
+ virNetworkDefPtr configdef = NULL;
/* normalize config data, and check for common invalid requests. */
if (virNetworkObjConfigChangeSetup(obj, xmlopt, flags) < 0)
diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c
index c08b7d46c5..ef5803ec2a 100644
--- a/src/hypervisor/domain_driver.c
+++ b/src/hypervisor/domain_driver.c
@@ -128,7 +128,8 @@ virDomainDriverMergeBlkioDevice(virBlkioDevicePtr *dest_array,
const char *type)
{
size_t i, j;
- virBlkioDevicePtr dest, src;
+ virBlkioDevicePtr dest;
+ virBlkioDevicePtr src;
for (i = 0; i < src_size; i++) {
bool found = false;
diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index 01c56f51bc..a3ec63138e 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -832,7 +832,8 @@ virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mgr,
/* Step 6: Set driver and domain information */
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
- virPCIDevicePtr pci, actual;
+ virPCIDevicePtr pci;
+ virPCIDevicePtr actual;
/* We need to look up the actual device and set the information
* there because 'pci' only contain address information and will
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index c93dbeeabf..e3d769b5d9 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3961,9 +3961,12 @@ libxlDomainDetachDeviceLive(libxlDriverPrivatePtr driver,
static int
libxlDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
{
- virDomainDiskDefPtr disk, detach;
- virDomainHostdevDefPtr hostdev, det_hostdev;
- virDomainControllerDefPtr cont, det_cont;
+ virDomainDiskDefPtr disk;
+ virDomainDiskDefPtr detach;
+ virDomainHostdevDefPtr hostdev;
+ virDomainHostdevDefPtr det_hostdev;
+ virDomainControllerDefPtr cont;
+ virDomainControllerDefPtr det_cont;
virDomainNetDefPtr net;
int idx;
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index c56815d7fc..baa6edf61c 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -1611,7 +1611,8 @@ static int
xenFormatSerial(virConfValuePtr list, virDomainChrDefPtr serial)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- virConfValuePtr val, tmp;
+ virConfValuePtr val;
+ virConfValuePtr tmp;
int ret;
if (serial) {
@@ -1666,7 +1667,8 @@ xenFormatNet(virConnectPtr conn,
const char *vif_typename)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- virConfValuePtr val, tmp;
+ virConfValuePtr val;
+ virConfValuePtr tmp;
char macaddr[VIR_MAC_STRING_BUFLEN];
virBufferAsprintf(&buf, "mac=%s", virMacAddrFormat(&net->mac,
macaddr));
@@ -1820,7 +1822,8 @@ xenFormatPCI(virConfPtr conf, virDomainDefPtr def)
for (i = 0; i < def->nhostdevs; i++) {
if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
def->hostdevs[i]->source.subsys.type ==
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
- virConfValuePtr val, tmp;
+ virConfValuePtr val;
+ virConfValuePtr tmp;
char *buf;
const char *permissive_str = NULL;
@@ -2294,7 +2297,8 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
return -1;
}
} else {
- virConfValuePtr vfb, disp;
+ virConfValuePtr vfb;
+ virConfValuePtr disp;
char *vfbstr = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 29c145851e..a043f298b4 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -1395,7 +1395,8 @@ static int
xenFormatXLVnode(virConfValuePtr list,
virBufferPtr buf)
{
- virConfValuePtr numaPnode, tmp;
+ virConfValuePtr numaPnode;
+ virConfValuePtr tmp;
numaPnode = g_new0(virConfValue, 1);
@@ -1423,7 +1424,8 @@ xenFormatXLVnuma(virConfValuePtr list,
int ret = -1;
size_t i;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- virConfValuePtr numaVnode, tmp;
+ virConfValuePtr numaVnode;
+ virConfValuePtr tmp;
virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(numa, node);
size_t nodeSize = virDomainNumaGetNodeMemorySize(numa, node) / 1024;
g_autofree char *nodeVcpus = NULL;
@@ -1638,7 +1640,8 @@ static int
xenFormatXLDisk(virConfValuePtr list, virDomainDiskDefPtr disk)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- virConfValuePtr val, tmp;
+ virConfValuePtr val;
+ virConfValuePtr tmp;
int format = virDomainDiskGetFormat(disk);
const char *driver = virDomainDiskGetDriver(disk);
g_autofree char *target = NULL;
@@ -1858,7 +1861,8 @@ xenFormatXLInputDevs(virConfPtr conf, virDomainDefPtr def)
{
size_t i;
const char *devtype;
- virConfValuePtr usbdevices = NULL, lastdev;
+ virConfValuePtr usbdevices = NULL;
+ virConfValuePtr lastdev;
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
usbdevices = g_new0(virConfValue, 1);
@@ -1941,7 +1945,8 @@ xenFormatXLUSBController(virConfPtr conf,
for (i = 0; i < def->ncontrollers; i++) {
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) {
- virConfValuePtr val, tmp;
+ virConfValuePtr val;
+ virConfValuePtr tmp;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
if (def->controllers[i]->model != -1) {
@@ -2019,7 +2024,8 @@ xenFormatXLUSB(virConfPtr conf,
for (i = 0; i < def->nhostdevs; i++) {
if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
def->hostdevs[i]->source.subsys.type ==
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
- virConfValuePtr val, tmp;
+ virConfValuePtr val;
+ virConfValuePtr tmp;
char *buf;
buf = g_strdup_printf("hostbus=%x,hostaddr=%x",
@@ -2055,7 +2061,8 @@ xenFormatXLChannel(virConfValuePtr list, virDomainChrDefPtr
channel)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
int sourceType = channel->source->type;
- virConfValuePtr val, tmp;
+ virConfValuePtr val;
+ virConfValuePtr tmp;
/* connection */
virBufferAddLit(&buf, "connection=");
@@ -2145,7 +2152,8 @@ xenFormatXLDomainNamespaceData(virConfPtr conf, virDomainDefPtr
def)
args->list = NULL;
for (i = 0; i < nsdata->num_args; i++) {
- virConfValuePtr val, tmp;
+ virConfValuePtr val;
+ virConfValuePtr tmp;
val = g_new0(virConfValue, 1);
diff --git a/src/libxl/xen_xm.c b/src/libxl/xen_xm.c
index cc24317a76..a2c1682fcf 100644
--- a/src/libxl/xen_xm.c
+++ b/src/libxl/xen_xm.c
@@ -275,7 +275,8 @@ xenFormatXMDisk(virConfValuePtr list,
virDomainDiskDefPtr disk)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- virConfValuePtr val, tmp;
+ virConfValuePtr val;
+ virConfValuePtr tmp;
const char *src = virDomainDiskGetSource(disk);
int format = virDomainDiskGetFormat(disk);
const char *driver = virDomainDiskGetDriver(disk);
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index f633a24b16..9b7cd6408d 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -735,7 +735,8 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
static int virLXCControllerSetupCpuAffinity(virLXCControllerPtr ctrl)
{
int hostcpus, maxcpu = CPU_SETSIZE;
- virBitmapPtr cpumap, cpumapToSet;
+ virBitmapPtr cpumap;
+ virBitmapPtr cpumapToSet;
VIR_DEBUG("Setting CPU affinity");
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 51a1d01ec9..8e0ec82e0b 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3129,9 +3129,11 @@ lxcDomainDetachDeviceConfig(virDomainDefPtr vmdef,
virDomainDeviceDefPtr dev)
{
int ret = -1;
- virDomainDiskDefPtr disk, det_disk;
+ virDomainDiskDefPtr disk;
+ virDomainDiskDefPtr det_disk;
virDomainNetDefPtr net;
- virDomainHostdevDefPtr hostdev, det_hostdev;
+ virDomainHostdevDefPtr hostdev;
+ virDomainHostdevDefPtr det_hostdev;
int idx;
switch (dev->type) {
@@ -4294,7 +4296,8 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom,
virLXCDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm = NULL;
virDomainDefPtr vmdef = NULL;
- virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
+ virDomainDeviceDefPtr dev = NULL;
+ virDomainDeviceDefPtr dev_copy = NULL;
int ret = -1;
virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
@@ -4468,7 +4471,8 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom,
virCapsPtr caps = NULL;
virDomainObjPtr vm = NULL;
virDomainDefPtr vmdef = NULL;
- virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
+ virDomainDeviceDefPtr dev = NULL;
+ virDomainDeviceDefPtr dev_copy = NULL;
int ret = -1;
virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 32872d7ec1..3c7a49b115 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1065,7 +1065,10 @@ networkDnsmasqConfContents(virNetworkObjPtr obj,
size_t i;
virNetworkDNSDefPtr dns = &def->dns;
bool wantDNS = dns->enable != VIR_TRISTATE_BOOL_NO;
- virNetworkIPDefPtr tmpipdef, ipdef, ipv4def, ipv6def;
+ virNetworkIPDefPtr tmpipdef;
+ virNetworkIPDefPtr ipdef;
+ virNetworkIPDefPtr ipv4def;
+ virNetworkIPDefPtr ipv6def;
bool ipv6SLAAC;
*configstr = NULL;
@@ -1682,7 +1685,9 @@ networkRefreshDhcpDaemon(virNetworkDriverStatePtr driver,
virNetworkDefPtr def = virNetworkObjGetDef(obj);
size_t i;
pid_t dnsmasqPid;
- virNetworkIPDefPtr ipdef, ipv4def, ipv6def;
+ virNetworkIPDefPtr ipdef;
+ virNetworkIPDefPtr ipv4def;
+ virNetworkIPDefPtr ipv6def;
g_autoptr(dnsmasqContext) dctx = NULL;
/* if no IP addresses specified, nothing to do */
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c
b/src/nwfilter/nwfilter_ebiptables_driver.c
index 813ab604ae..f4afbf9ba2 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -3199,7 +3199,8 @@ iptablesRuleInstCommand(virFirewallPtr fw,
const char *ifname,
virNWFilterRuleInstPtr rule)
{
- virNWFilterVarCombIterPtr vciter, tmp;
+ virNWFilterVarCombIterPtr vciter;
+ virNWFilterVarCombIterPtr tmp;
int ret = -1;
/* rule->vars holds all the variables names that this rule will access.
@@ -3234,7 +3235,8 @@ ebtablesRuleInstCommand(virFirewallPtr fw,
const char *ifname,
virNWFilterRuleInstPtr rule)
{
- virNWFilterVarCombIterPtr vciter, tmp;
+ virNWFilterVarCombIterPtr vciter;
+ virNWFilterVarCombIterPtr tmp;
int ret = -1;
/* rule->vars holds all the variables names that this rule will access.
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 96535a8216..e898af85ab 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1817,7 +1817,8 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
virDomainDeviceDefPtr dev,
bool persist)
{
- virDomainFSDefPtr fs, cur;
+ virDomainFSDefPtr fs;
+ virDomainFSDefPtr cur;
int pos;
if (dev->type == VIR_DOMAIN_DEVICE_FS) {
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 8b880d0d15..01ba2c78c1 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -1255,7 +1255,8 @@ int qemuAgentFSFreeze(qemuAgentPtr agent, const char **mountpoints,
unsigned int nmountpoints)
{
int ret = -1;
- virJSONValuePtr cmd, arg = NULL;
+ virJSONValuePtr cmd;
+ virJSONValuePtr arg = NULL;
virJSONValuePtr reply = NULL;
if (mountpoints && nmountpoints) {
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index df332ad870..ed2a1481d4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6172,7 +6172,8 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
if ((flags & VIR_DOMAIN_XML_MIGRATABLE)) {
size_t i;
int toremove = 0;
- virDomainControllerDefPtr usb = NULL, pci = NULL;
+ virDomainControllerDefPtr usb = NULL;
+ virDomainControllerDefPtr pci = NULL;
/* If only the default USB controller is present, we can remove it
* and make the XML compatible with older versions of libvirt which
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c7323e1fa5..b7c89a826a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7431,12 +7431,16 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
unsigned int parse_flags,
virDomainXMLOptionPtr xmlopt)
{
- virDomainDiskDefPtr disk, det_disk;
+ virDomainDiskDefPtr disk;
+ virDomainDiskDefPtr det_disk;
virDomainNetDefPtr net;
virDomainSoundDefPtr sound;
- virDomainHostdevDefPtr hostdev, det_hostdev;
- virDomainLeaseDefPtr lease, det_lease;
- virDomainControllerDefPtr cont, det_cont;
+ virDomainHostdevDefPtr hostdev;
+ virDomainHostdevDefPtr det_hostdev;
+ virDomainLeaseDefPtr lease;
+ virDomainLeaseDefPtr det_lease;
+ virDomainControllerDefPtr cont;
+ virDomainControllerDefPtr det_cont;
virDomainChrDefPtr chr;
virDomainFSDefPtr fs;
virDomainMemoryDefPtr mem;
@@ -10240,7 +10244,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
virDomainDefPtr def;
virDomainDefPtr persistentDef;
int ret = -1;
- virDomainNetDefPtr net = NULL, persistentNet = NULL;
+ virDomainNetDefPtr net = NULL;
+ virDomainNetDefPtr persistentNet = NULL;
g_autoptr(virNetDevBandwidth) bandwidth = NULL;
g_autoptr(virNetDevBandwidth) newBandwidth = NULL;
g_autoptr(virQEMUDriverConfig) cfg = NULL;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index f706ef65fc..ad62e24cfc 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4006,7 +4006,8 @@ static int
qemuMonitorJSONQueryFdsetsParse(virJSONValuePtr msg,
qemuMonitorFdsetsPtr *fdsets)
{
- virJSONValuePtr returnArray, entry;
+ virJSONValuePtr returnArray;
+ virJSONValuePtr entry;
size_t i;
g_autoptr(qemuMonitorFdsets) sets = g_new0(qemuMonitorFdsets, 1);
int ninfo;
@@ -4213,7 +4214,10 @@ qemuMonitorJSONQueryRxFilterParse(virJSONValuePtr msg,
{
int ret = -1;
const char *tmp;
- virJSONValuePtr returnArray, entry, table, element;
+ virJSONValuePtr returnArray;
+ virJSONValuePtr entry;
+ virJSONValuePtr table;
+ virJSONValuePtr element;
size_t nTable;
size_t i;
virNetDevRxFilterPtr fil = virNetDevRxFilterNew();
@@ -5015,7 +5019,8 @@ int qemuMonitorJSONScreendump(qemuMonitorPtr mon,
const char *file)
{
int ret = -1;
- virJSONValuePtr cmd, reply = NULL;
+ virJSONValuePtr cmd;
+ virJSONValuePtr reply = NULL;
cmd = qemuMonitorJSONMakeCommand("screendump",
"s:filename", file,
@@ -5386,7 +5391,8 @@ int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon,
bool skipauth)
{
int ret = -1;
- virJSONValuePtr cmd, reply = NULL;
+ virJSONValuePtr cmd;
+ virJSONValuePtr reply = NULL;
cmd = qemuMonitorJSONMakeCommand("add_client",
"s:protocol", protocol,
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 2bb3443287..6b9c1bbc64 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -263,7 +263,8 @@ int virNetServerClientAddFilter(virNetServerClientPtr client,
void virNetServerClientRemoveFilter(virNetServerClientPtr client,
int filterID)
{
- virNetServerClientFilterPtr tmp, prev;
+ virNetServerClientFilterPtr tmp;
+ virNetServerClientFilterPtr prev;
virObjectLock(client);
diff --git a/src/security/security_stack.c b/src/security/security_stack.c
index 3bfcb1e2f7..2fd7d2e825 100644
--- a/src/security/security_stack.c
+++ b/src/security/security_stack.c
@@ -90,7 +90,8 @@ static int
virSecurityStackClose(virSecurityManagerPtr mgr)
{
virSecurityStackDataPtr priv = virSecurityManagerGetPrivateData(mgr);
- virSecurityStackItemPtr next, item = priv->itemsHead;
+ virSecurityStackItemPtr item = priv->itemsHead;
+ virSecurityStackItemPtr next;
while (item) {
next = item->next;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2c1b4cb525..01b3e7bc82 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -7338,7 +7338,8 @@ testNodeDeviceMockCreateVport(testDriverPtr driver,
{
virNodeDeviceDefPtr def = NULL;
virNodeDevCapsDefPtr caps;
- virNodeDeviceObjPtr obj = NULL, objcopy = NULL;
+ virNodeDeviceObjPtr obj = NULL;
+ virNodeDeviceObjPtr objcopy = NULL;
virNodeDeviceDefPtr objdef;
virObjectEventPtr event = NULL;
g_autofree char *xml = NULL;
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 16107bce96..25a3bad50d 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -207,7 +207,8 @@ virConfCreate(const char *filename, unsigned int flags)
static virConfEntryPtr
virConfAddEntry(virConfPtr conf, char *name, virConfValuePtr value, char *comm)
{
- virConfEntryPtr ret, prev;
+ virConfEntryPtr ret;
+ virConfEntryPtr prev;
if (conf == NULL)
return NULL;
@@ -441,7 +442,10 @@ virConfParseString(virConfParserCtxtPtr ctxt)
static virConfValuePtr
virConfParseValue(virConfParserCtxtPtr ctxt)
{
- virConfValuePtr ret, lst = NULL, tmp, prev;
+ virConfValuePtr ret;
+ virConfValuePtr lst = NULL;
+ virConfValuePtr tmp;
+ virConfValuePtr prev;
virConfType type = VIR_CONF_NONE;
char *str = NULL;
long long l = 0;
@@ -1332,7 +1336,8 @@ virConfSetValue(virConfPtr conf,
const char *setting,
virConfValuePtr value)
{
- virConfEntryPtr cur, prev = NULL;
+ virConfEntryPtr cur;
+ virConfEntryPtr prev = NULL;
if (value && value->type == VIR_CONF_STRING && value->str ==
NULL) {
virConfFreeValue(value);
diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index 77a97176b0..f39635b35f 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -193,7 +193,8 @@ virNetDevBandwidthSet(const char *ifname,
bool swapped)
{
int ret = -1;
- virNetDevBandwidthRatePtr rx = NULL, tx = NULL; /* From domain POV */
+ virNetDevBandwidthRatePtr rx = NULL; /* From domain POV */
+ virNetDevBandwidthRatePtr tx = NULL; /* From domain POV */
virCommandPtr cmd = NULL;
char *average = NULL;
char *peak = NULL;
diff --git a/src/util/virnetdevbandwidth.h b/src/util/virnetdevbandwidth.h
index fff83222a9..91de9323ba 100644
--- a/src/util/virnetdevbandwidth.h
+++ b/src/util/virnetdevbandwidth.h
@@ -33,7 +33,8 @@ struct _virNetDevBandwidthRate {
typedef struct _virNetDevBandwidth virNetDevBandwidth;
typedef virNetDevBandwidth *virNetDevBandwidthPtr;
struct _virNetDevBandwidth {
- virNetDevBandwidthRatePtr in, out;
+ virNetDevBandwidthRatePtr in;
+ virNetDevBandwidthRatePtr out;
};
void virNetDevBandwidthFree(virNetDevBandwidthPtr def);
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 520ef871e9..f3ad22c270 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -408,7 +408,8 @@ vzConnectOpen(virConnectPtr conn,
static int
vzConnectClose(virConnectPtr conn)
{
- vzConnPtr curr, *prev = &vz_conn_list;
+ vzConnPtr curr;
+ vzConnPtr *prev = &vz_conn_list;
vzConnPtr privconn = conn->privateData;
if (!privconn)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index d8548e5a3c..ea21181c25 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -889,7 +889,8 @@ prlsdkParseNetAddress(char *addr)
char *maskstr = NULL;
int nbits;
virSocketAddr mask;
- virNetDevIPAddrPtr ip = NULL, ret = NULL;
+ virNetDevIPAddrPtr ip = NULL;
+ virNetDevIPAddrPtr ret = NULL;
if (!(maskstr = strchr(addr, '/')))
goto cleanup;
@@ -3141,12 +3142,14 @@ static int prlsdkConfigureGateways(PRL_HANDLE sdknet,
virDomainNetDefPtr net)
{
int ret = -1;
size_t i;
- virNetDevIPRoutePtr route4 = NULL, route6 = NULL;
+ virNetDevIPRoutePtr route4 = NULL;
+ virNetDevIPRoutePtr route6 = NULL;
char *gw4 = NULL, *gw6 = NULL;
PRL_RESULT pret;
for (i = 0; i < net->guestIP.nroutes; i++) {
- virSocketAddrPtr addrdst, gateway;
+ virSocketAddrPtr addrdst;
+ virSocketAddrPtr gateway;
virSocketAddr zero;
addrdst = virNetDevIPRouteGetAddress(net->guestIP.routes[i]);
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index fb40fe9b80..c77c21611f 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -84,9 +84,12 @@ static virNetServerPtr
testCreateServer(const char *server_name, const char *host, int family)
{
virNetServerPtr srv = NULL;
- virNetServerServicePtr svc1 = NULL, svc2 = NULL;
- virNetServerClientPtr cln1 = NULL, cln2 = NULL;
- virNetSocketPtr sk1 = NULL, sk2 = NULL;
+ virNetServerServicePtr svc1 = NULL;
+ virNetServerServicePtr svc2 = NULL;
+ virNetServerClientPtr cln1 = NULL;
+ virNetServerClientPtr cln2 = NULL;
+ virNetSocketPtr sk1 = NULL;
+ virNetSocketPtr sk2 = NULL;
int fdclient[2];
if (socketpair(PF_UNIX, SOCK_STREAM, 0, fdclient) < 0) {
@@ -269,7 +272,8 @@ static int testExecRestart(const void *opaque)
const struct testExecRestartData *data = opaque;
char *infile = NULL, *outfile = NULL;
char *injsonstr = NULL, *outjsonstr = NULL;
- virJSONValuePtr injson = NULL, outjson = NULL;
+ virJSONValuePtr injson = NULL;
+ virJSONValuePtr outjson = NULL;
int fdclient[2] = { -1, -1 }, fdserver[2] = { -1, -1 };
if (socketpair(PF_UNIX, SOCK_STREAM, 0, fdclient) < 0) {
diff --git a/tests/virpcitest.c b/tests/virpcitest.c
index 6a4bd5518d..b6ca686c5c 100644
--- a/tests/virpcitest.c
+++ b/tests/virpcitest.c
@@ -93,7 +93,8 @@ testVirPCIDeviceDetach(const void *opaque G_GNUC_UNUSED)
int ret = -1;
virPCIDevicePtr dev[] = {NULL, NULL, NULL};
size_t i, nDev = G_N_ELEMENTS(dev);
- virPCIDeviceListPtr activeDevs = NULL, inactiveDevs = NULL;
+ virPCIDeviceListPtr activeDevs = NULL;
+ virPCIDeviceListPtr inactiveDevs = NULL;
int count;
if (!(activeDevs = virPCIDeviceListNew()) ||
@@ -136,7 +137,8 @@ testVirPCIDeviceReset(const void *opaque G_GNUC_UNUSED)
int ret = -1;
virPCIDevicePtr dev[] = {NULL, NULL, NULL};
size_t i, nDev = G_N_ELEMENTS(dev);
- virPCIDeviceListPtr activeDevs = NULL, inactiveDevs = NULL;
+ virPCIDeviceListPtr activeDevs = NULL;
+ virPCIDeviceListPtr inactiveDevs = NULL;
int count;
if (!(activeDevs = virPCIDeviceListNew()) ||
@@ -173,7 +175,8 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUSED)
int ret = -1;
virPCIDevicePtr dev[] = {NULL, NULL, NULL};
size_t i, nDev = G_N_ELEMENTS(dev);
- virPCIDeviceListPtr activeDevs = NULL, inactiveDevs = NULL;
+ virPCIDeviceListPtr activeDevs = NULL;
+ virPCIDeviceListPtr inactiveDevs = NULL;
int count;
if (!(activeDevs = virPCIDeviceListNew()) ||
--
2.26.2