mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-03 12:55:45 +00:00
tools: Fix vshControl declaration and initialization
Both virsh and virt-admin have vshControl typed variables and also pointers to these variables. In both cases these are declared on a single line. Do the following: 1) break declaration into two lines, 2) use struct zero initializer for vshControl and virshControl/vshAdmControl structs, 3) drop explicit memset(.., 0, ...) ; Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Claudio Fontana <cfontana@suse.de>
This commit is contained in:
parent
a8262cb331
commit
33b7948983
@ -831,12 +831,11 @@ static const vshClientHooks hooks = {
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
vshControl _ctl, *ctl = &_ctl;
|
vshControl _ctl = { 0 };
|
||||||
virshControl virshCtl;
|
vshControl *ctl = &_ctl;
|
||||||
|
virshControl virshCtl = { 0 };
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
memset(ctl, 0, sizeof(vshControl));
|
|
||||||
memset(&virshCtl, 0, sizeof(virshControl));
|
|
||||||
ctl->name = "virsh"; /* hardcoded name of the binary */
|
ctl->name = "virsh"; /* hardcoded name of the binary */
|
||||||
ctl->env_prefix = "VIRSH";
|
ctl->env_prefix = "VIRSH";
|
||||||
ctl->log_fd = -1; /* Initialize log file descriptor */
|
ctl->log_fd = -1; /* Initialize log file descriptor */
|
||||||
|
@ -1554,12 +1554,11 @@ static const vshClientHooks hooks = {
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
vshControl _ctl, *ctl = &_ctl;
|
vshControl _ctl = { 0 };
|
||||||
vshAdmControl virtAdminCtl;
|
vshControl *ctl = &_ctl;
|
||||||
|
vshAdmControl virtAdminCtl = { 0 };
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
memset(ctl, 0, sizeof(vshControl));
|
|
||||||
memset(&virtAdminCtl, 0, sizeof(vshAdmControl));
|
|
||||||
ctl->name = "virt-admin"; /* hardcoded name of the binary */
|
ctl->name = "virt-admin"; /* hardcoded name of the binary */
|
||||||
ctl->env_prefix = "VIRT_ADMIN";
|
ctl->env_prefix = "VIRT_ADMIN";
|
||||||
ctl->log_fd = -1; /* Initialize log file descriptor */
|
ctl->log_fd = -1; /* Initialize log file descriptor */
|
||||||
|
Loading…
Reference in New Issue
Block a user