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.
* src/libxl/libxl_driver.c: Fix initialization.
* src/lxc/lxc_controller.c: Likewise.
* src/openvz/openvz_util.c (openvzKBPerPages): Likewise.
* src/phyp/phyp_driver.c: Likewise.
* src/remote/remote_driver.c: Likewise.
* src/test/test_driver.c: Likewise.
* src/uml/uml_driver.c: Likewise.
* src/vbox/vbox_XPCOMCGlue.c: Likewise.
* src/vbox/vbox_tmpl.c: Likewise.
* src/xen/xen_driver.c: Likewise.
* src/xen/xen_hypervisor.c: Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/libxl/libxl_driver.c | 2 +-
src/lxc/lxc_controller.c | 2 +-
src/openvz/openvz_util.c | 4 ++--
src/phyp/phyp_driver.c | 8 +++++---
src/remote/remote_driver.c | 2 +-
src/test/test_driver.c | 2 +-
src/uml/uml_driver.c | 2 +-
src/vbox/vbox_XPCOMCGlue.c | 4 ++--
src/vbox/vbox_tmpl.c | 2 +-
src/xen/xen_driver.c | 4 ++--
src/xen/xen_hypervisor.c | 4 ++--
11 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index eeebb4f..d2c077c 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -76,7 +76,7 @@ VIR_LOG_INIT("libxl.libxl_driver");
#define XEN_SCHED_CREDIT_NPARAM 2
-static libxlDriverPrivatePtr libxl_driver = NULL;
+static libxlDriverPrivatePtr libxl_driver;
/* Function declarations */
static int
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 1861dd6..1e4b9bc 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -819,7 +819,7 @@ static int lxcControllerClearCapabilities(void)
return 0;
}
-static bool wantReboot = false;
+static bool wantReboot;
static virMutex lock = VIR_MUTEX_INITIALIZER;
diff --git a/src/openvz/openvz_util.c b/src/openvz/openvz_util.c
index 4214335..8032f6a 100644
--- a/src/openvz/openvz_util.c
+++ b/src/openvz/openvz_util.c
@@ -1,7 +1,7 @@
/*
* openvz_util.c: core driver methods for managing OpenVZ VEs
*
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (C) 2013-2014 Red Hat, Inc.
* Copyright (C) 2012 Guido Günther
*
* This library is free software; you can redistribute it and/or
@@ -39,7 +39,7 @@
long
openvzKBPerPages(void)
{
- static long kb_per_pages = 0;
+ static long kb_per_pages;
if (kb_per_pages == 0) {
kb_per_pages = sysconf(_SC_PAGESIZE);
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index a56f25d..09617c8 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -68,9 +68,11 @@ VIR_LOG_INIT("phyp.phyp_driver");
* URI: phyp://user@[hmc|ivm]/managed_system
* */
-static unsigned const int HMC = 0;
-static unsigned const int PHYP_IFACENAME_SIZE = 24;
-static unsigned const int PHYP_MAC_SIZE = 12;
+enum {
+ HMC = 0,
+ PHYP_IFACENAME_SIZE = 24,
+ PHYP_MAC_SIZE = 12,
+};
static int
waitsocket(int socket_fd, LIBSSH2_SESSION * session)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 067f2d0..1ec1e15 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -77,7 +77,7 @@ VIR_LOG_INIT("remote.remote_driver");
deserializeTypedParameters(__FUNCTION__, ret_params_val, ret_params_len, \
limit, params, nparams)
-static bool inside_daemon = false;
+static bool inside_daemon;
struct private_data {
virMutex lock;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index f435d03..2afd6fe 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -471,7 +471,7 @@ static const char *defaultNodeXML =
"</device>";
static const unsigned long long defaultPoolCap = (100 * 1024 * 1024 * 1024ull);
-static const unsigned long long defaultPoolAlloc = 0;
+static const unsigned long long defaultPoolAlloc;
static int testStoragePoolObjSetDefaults(virStoragePoolObjPtr pool);
static int testNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 4f5f6e1..2baf2fa 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -147,7 +147,7 @@ static int umlMonitorCommand(const struct uml_driver *driver,
const char *cmd,
char **reply);
-static struct uml_driver *uml_driver = NULL;
+static struct uml_driver *uml_driver;
static int
umlVMFilterRebuild(virDomainObjListIterator iter, void *data)
diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index d0c4a15..aaa7c60 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -68,9 +68,9 @@ VIR_LOG_INIT("vbox.vbox_XPCOMCGlue");
* Global Variables *
*******************************************************************************/
/** The dlopen handle for VBoxXPCOMC. */
-static void *hVBoxXPCOMC = NULL;
+static void *hVBoxXPCOMC;
/** Pointer to the VBoxXPCOMC function table. */
-static PCVBOXXPCOM pVBoxFuncs_v2_2 = NULL;
+static PCVBOXXPCOM pVBoxFuncs_v2_2;
/** Pointer to VBoxGetXPCOMCFunctions for the loaded VBoxXPCOMC so/dylib/dll. */
PFNVBOXGETXPCOMCFUNCTIONS g_pfnGetFunctions = NULL;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index db98c90..24c8a50 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -235,7 +235,7 @@ if (strUtf16) {\
* them that way
*/
-static vboxGlobalData *g_pVBoxGlobalData = NULL;
+static vboxGlobalData *g_pVBoxGlobalData;
#endif /* !(VBOX_API_VERSION == 2002000) */
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index d042050..5f7c98f 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -91,8 +91,8 @@ xenUnifiedDomainGetVcpusInternal(virDomainPtr dom,
int maplen);
-static bool is_privileged = false;
-static virSysinfoDefPtr hostsysinfo = NULL;
+static bool is_privileged;
+static virSysinfoDefPtr hostsysinfo;
static virDomainDefPtr xenGetDomainDefForID(virConnectPtr conn, int id)
{
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index d3d4aea..4be8891 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -126,7 +126,7 @@ typedef privcmd_hypercall_t hypercall_t;
# define SYS_IFACE_MIN_VERS_NUMA 4
#endif
-static int xen_ioctl_hypercall_cmd = 0;
+static int xen_ioctl_hypercall_cmd;
static struct xenHypervisorVersions hv_versions = {
.hv = 0,
.hypervisor = 2,
@@ -134,7 +134,7 @@ static struct xenHypervisorVersions hv_versions = {
.dom_interface = -1,
};
-static int kb_per_pages = 0;
+static int kb_per_pages;
/* Regular expressions used by xenHypervisorGetCapabilities, and
* compiled once by xenHypervisorInit. Note that these are POSIX.2
--
1.9.3