mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
maint: avoid static zero init in tools
C guarantees that static variables are zero-initialized. Some older compilers (and also gcc -fno-zero-initialized-in-bss) create larger binaries if you explicitly zero-initialize a static variable. * tools/virsh-console.c (got_signal): Drop unused variable. * tools/virsh-domain.c: Fix initialization. * tools/virsh.c: Likewise. * tools/virt-host-validate-common.c (virHostMsgWantEscape): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
39871fce1a
commit
0585332430
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virsh-console.c: A dumb serial console client
|
* virsh-console.c: A dumb serial console client
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008, 2010-2013 Red Hat, Inc.
|
* Copyright (C) 2007-2008, 2010-2014 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -81,11 +81,9 @@ struct virConsole {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int got_signal = 0;
|
|
||||||
static void
|
static void
|
||||||
virConsoleHandleSignal(int sig ATTRIBUTE_UNUSED)
|
virConsoleHandleSignal(int sig ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
got_signal = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -336,7 +334,6 @@ vshRunConsole(vshControl *ctl,
|
|||||||
/* Trap all common signals so that we can safely restore the original
|
/* Trap all common signals so that we can safely restore the original
|
||||||
* terminal settings on STDIN before the process exits - people don't like
|
* terminal settings on STDIN before the process exits - people don't like
|
||||||
* being left with a messed up terminal ! */
|
* being left with a messed up terminal ! */
|
||||||
got_signal = 0;
|
|
||||||
sigaction(SIGQUIT, &sighandler, &old_sigquit);
|
sigaction(SIGQUIT, &sighandler, &old_sigquit);
|
||||||
sigaction(SIGTERM, &sighandler, &old_sigterm);
|
sigaction(SIGTERM, &sighandler, &old_sigterm);
|
||||||
sigaction(SIGINT, &sighandler, &old_sigint);
|
sigaction(SIGINT, &sighandler, &old_sigint);
|
||||||
|
@ -1582,7 +1582,7 @@ vshPrintJobProgress(const char *label, unsigned long long remaining,
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static volatile sig_atomic_t intCaught = 0;
|
static volatile sig_atomic_t intCaught;
|
||||||
|
|
||||||
static void vshCatchInt(int sig ATTRIBUTE_UNUSED,
|
static void vshCatchInt(int sig ATTRIBUTE_UNUSED,
|
||||||
siginfo_t *siginfo ATTRIBUTE_UNUSED,
|
siginfo_t *siginfo ATTRIBUTE_UNUSED,
|
||||||
|
@ -316,7 +316,7 @@ vshReportError(vshControl *ctl)
|
|||||||
/*
|
/*
|
||||||
* Detection of disconnections and automatic reconnection support
|
* Detection of disconnections and automatic reconnection support
|
||||||
*/
|
*/
|
||||||
static int disconnected = 0; /* we may have been disconnected */
|
static int disconnected; /* we may have been disconnected */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vshCatchDisconnect:
|
* vshCatchDisconnect:
|
||||||
@ -2985,7 +2985,7 @@ static char *
|
|||||||
vshReadlineOptionsGenerator(const char *text, int state)
|
vshReadlineOptionsGenerator(const char *text, int state)
|
||||||
{
|
{
|
||||||
static int list_index, len;
|
static int list_index, len;
|
||||||
static const vshCmdDef *cmd = NULL;
|
static const vshCmdDef *cmd;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
if (!state) {
|
if (!state) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virt-host-validate-common.c: Sanity check helper APIs
|
* virt-host-validate-common.c: Sanity check helper APIs
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Red Hat, Inc.
|
* Copyright (C) 2012, 2014 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -66,7 +66,7 @@ void virHostMsgCheck(const char *prefix,
|
|||||||
static bool virHostMsgWantEscape(void)
|
static bool virHostMsgWantEscape(void)
|
||||||
{
|
{
|
||||||
static bool detectTty = true;
|
static bool detectTty = true;
|
||||||
static bool wantEscape = false;
|
static bool wantEscape;
|
||||||
if (detectTty) {
|
if (detectTty) {
|
||||||
if (isatty(STDOUT_FILENO))
|
if (isatty(STDOUT_FILENO))
|
||||||
wantEscape = true;
|
wantEscape = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user