Consistent style for usage of sizeof operator

The code is splattered with a mix of

  sizeof foo
  sizeof (foo)
  sizeof(foo)

Standardize on sizeof(foo) and add a syntax check rule to
enforce it

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2012-03-29 10:52:04 +01:00
parent 57351139a7
commit ec8cae93db
56 changed files with 213 additions and 203 deletions

8
cfg.mk
View File

@ -422,6 +422,12 @@ sc_correct_id_types:
halt="use pid_t for pid, uid_t for uid, gid_t for gid" \
$(_sc_search_regexp)
# Forbid sizeof foo or sizeof (foo), require sizeof(foo)
sc_size_of_brackets:
@prohibit='sizeof\s' \
halt='use sizeof(foo), not sizeof (foo) or sizeof foo' \
$(_sc_search_regexp)
# Ensure that no C source file, docs, or rng schema uses TABs for
# indentation. Also match *.h.in files, to get libvirt.h.in. Exclude
# files in gnulib, since they're imported.
@ -807,3 +813,5 @@ exclude_file_name_regexp--sc_trailing_blank = \.(fig|gif|ico|png)$$
exclude_file_name_regexp--sc_unmarked_diagnostics = \
^(docs/apibuild.py|tests/virt-aa-helper-test)$$
exclude_file_name_regexp--sc_size_of_brackets = cfg.mk

View File

@ -1441,7 +1441,7 @@ int main(int argc, char **argv) {
if ((statuswrite = daemonForkIntoBackground(argv[0])) < 0) {
VIR_ERROR(_("Failed to fork as daemon: %s"),
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
goto cleanup;
}
}

View File

@ -132,7 +132,7 @@ static int remoteRelayDomainEventLifecycle(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain lifecycle event %d %d", event, detail);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.event = event;
data.detail = detail;
@ -157,7 +157,7 @@ static int remoteRelayDomainEventReboot(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain reboot event %s %d", dom->name, dom->id);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
remoteDispatchDomainEventSend(client, remoteProgram,
@ -182,7 +182,7 @@ static int remoteRelayDomainEventRTCChange(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain rtc change event %s %d %lld", dom->name, dom->id, offset);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.offset = offset;
@ -208,7 +208,7 @@ static int remoteRelayDomainEventWatchdog(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain watchdog event %s %d %d", dom->name, dom->id, action);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.action = action;
@ -236,7 +236,7 @@ static int remoteRelayDomainEventIOError(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain io error %s %d %s %s %d", dom->name, dom->id, srcPath, devAlias, action);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
data.srcPath = strdup(srcPath);
if (data.srcPath == NULL)
goto mem_error;
@ -277,7 +277,7 @@ static int remoteRelayDomainEventIOErrorReason(virConnectPtr conn ATTRIBUTE_UNUS
dom->name, dom->id, srcPath, devAlias, action, reason);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
data.srcPath = strdup(srcPath);
if (data.srcPath == NULL)
goto mem_error;
@ -333,7 +333,7 @@ static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED,
}
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
data.phase = phase;
data.local.family = local->family;
data.remote.family = remote->family;
@ -409,7 +409,7 @@ static int remoteRelayDomainEventBlockJob(virConnectPtr conn ATTRIBUTE_UNUSED,
dom->name, dom->id, path, type, status);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
data.path = strdup(path);
if (data.path == NULL)
goto mem_error;
@ -443,7 +443,7 @@ static int remoteRelayDomainEventControlError(virConnectPtr conn ATTRIBUTE_UNUSE
VIR_DEBUG("Relaying domain control error %s %d", dom->name, dom->id);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
remoteDispatchDomainEventSend(client, remoteProgram,
@ -473,7 +473,7 @@ static int remoteRelayDomainEventDiskChange(virConnectPtr conn ATTRIBUTE_UNUSED,
dom->name, dom->id, oldSrcPath, newSrcPath, devAlias, reason);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
if (oldSrcPath &&
((VIR_ALLOC(oldSrcPath_p) < 0) ||
!(*oldSrcPath_p = strdup(oldSrcPath))))
@ -521,7 +521,7 @@ static int remoteRelayDomainEventTrayChange(virConnectPtr conn ATTRIBUTE_UNUSED,
dom->name, dom->id, devAlias, reason);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
if (!(data.devAlias = strdup(devAlias))) {
virReportOOMError();
@ -550,7 +550,7 @@ static int remoteRelayDomainEventPMWakeup(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain %s %d system pmwakeup", dom->name, dom->id);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
remoteDispatchDomainEventSend(client, remoteProgram,
@ -572,7 +572,7 @@ static int remoteRelayDomainEventPMSuspend(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_DEBUG("Relaying domain %s %d system pmsuspend", dom->name, dom->id);
/* build return data */
memset(&data, 0, sizeof data);
memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
remoteDispatchDomainEventSend(client, remoteProgram,
@ -1357,7 +1357,7 @@ remoteDispatchNodeGetSecurityModel(virNetServerPtr server ATTRIBUTE_UNUSED,
goto cleanup;
}
memset(&secmodel, 0, sizeof secmodel);
memset(&secmodel, 0, sizeof(secmodel));
if (virNodeGetSecurityModel(priv->conn, &secmodel) < 0)
goto cleanup;
@ -2710,7 +2710,7 @@ remoteDispatchAuthPolkit(virNetServerPtr server,
if (!(pkaction = polkit_action_new())) {
char ebuf[1024];
VIR_ERROR(_("Failed to create polkit action %s"),
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
polkit_caller_unref(pkcaller);
goto authfail;
}
@ -2721,7 +2721,7 @@ remoteDispatchAuthPolkit(virNetServerPtr server,
char ebuf[1024];
VIR_ERROR(_("Failed to create polkit context %s"),
(pkerr ? polkit_error_get_error_message(pkerr)
: virStrerror(errno, ebuf, sizeof ebuf)));
: virStrerror(errno, ebuf, sizeof(ebuf))));
if (pkerr)
polkit_error_free(pkerr);
polkit_caller_unref(pkcaller);

View File

@ -393,7 +393,7 @@ int main(int argc, char **argv)
int callback12ret = -1;
struct sigaction action_stop;
memset(&action_stop, 0, sizeof action_stop);
memset(&action_stop, 0, sizeof(action_stop));
action_stop.sa_handler = stop;

View File

@ -1360,7 +1360,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
int32_t numaInfo_numNodes = 0;
char *ptr = NULL;
memset(nodeinfo, 0, sizeof (*nodeinfo));
memset(nodeinfo, 0, sizeof(*nodeinfo));
if (esxVI_EnsureSession(priv->primary) < 0) {
return -1;
@ -2286,7 +2286,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
esxVI_Long *value = NULL;
#endif
memset(info, 0, sizeof (*info));
memset(info, 0, sizeof(*info));
if (esxVI_EnsureSession(priv->primary) < 0) {
return -1;
@ -2763,7 +2763,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
/* Flags checked by virDomainDefFormat */
memset(&data, 0, sizeof (data));
memset(&data, 0, sizeof(data));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@ -2870,7 +2870,7 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
virCheckFlags(0, NULL);
memset(&data, 0, sizeof (data));
memset(&data, 0, sizeof(data));
if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
@ -2913,7 +2913,7 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
virCheckFlags(0, NULL);
memset(&data, 0, sizeof (data));
memset(&data, 0, sizeof(data));
if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG,
@ -3137,7 +3137,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
char *taskInfoErrorMessage = NULL;
virDomainPtr domain = NULL;
memset(&data, 0, sizeof (data));
memset(&data, 0, sizeof(data));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@ -4344,7 +4344,7 @@ esxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virCheckFlags(0, NULL);
memset(&def, 0, sizeof (def));
memset(&def, 0, sizeof(def));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;

View File

@ -407,7 +407,7 @@ esxStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info)
esxVI_DynamicProperty *dynamicProperty = NULL;
esxVI_Boolean accessible = esxVI_Boolean_Undefined;
memset(info, 0, sizeof (*info));
memset(info, 0, sizeof(*info));
if (esxVI_EnsureSession(priv->primary) < 0) {
return -1;
@ -479,7 +479,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
virCheckFlags(0, NULL);
memset(&def, 0, sizeof (def));
memset(&def, 0, sizeof(def));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@ -977,7 +977,7 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc,
virCheckFlags(0, NULL);
memset(&poolDef, 0, sizeof (poolDef));
memset(&poolDef, 0, sizeof(poolDef));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@ -1205,7 +1205,7 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc,
virCheckFlags(0, NULL);
memset(&poolDef, 0, sizeof (poolDef));
memset(&poolDef, 0, sizeof(poolDef));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
@ -1483,7 +1483,7 @@ esxStorageVolumeGetInfo(virStorageVolPtr volume, virStorageVolInfoPtr info)
esxVI_FileInfo *fileInfo = NULL;
esxVI_VmDiskFileInfo *vmDiskFileInfo = NULL;
memset(info, 0, sizeof (*info));
memset(info, 0, sizeof(*info));
if (esxVI_EnsureSession(priv->primary) < 0) {
return -1;
@ -1538,8 +1538,8 @@ esxStorageVolumeGetXMLDesc(virStorageVolPtr volume, unsigned int flags)
virCheckFlags(0, NULL);
memset(&pool, 0, sizeof (pool));
memset(&def, 0, sizeof (def));
memset(&pool, 0, sizeof(pool));
memset(&def, 0, sizeof(def));
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;

View File

@ -339,7 +339,7 @@ esxUtil_ResolveHostname(const char *hostname,
struct addrinfo *result = NULL;
int errcode;
memset(&hints, 0, sizeof (hints));
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = AF_INET;

View File

@ -4089,7 +4089,7 @@ esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo *parsedHostCpuIdInfo,
const char *name[4] = { "eax", "ebx", "ecx", "edx" };
int r, i, o;
memset(parsedHostCpuIdInfo, 0, sizeof (*parsedHostCpuIdInfo));
memset(parsedHostCpuIdInfo, 0, sizeof(*parsedHostCpuIdInfo));
parsedHostCpuIdInfo->level = hostCpuIdInfo->level->value;

View File

@ -43,7 +43,7 @@
int \
esxVI_##__type##_Alloc(esxVI_##__type **ptrptr) \
{ \
if (esxVI_Alloc((void **)ptrptr, sizeof (esxVI_##__type)) < 0) { \
if (esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##__type)) < 0) { \
return -1; \
} \
\

View File

@ -286,7 +286,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
Win32_Processor *processor = NULL;
char *tmp;
memset(info, 0, sizeof (*info));
memset(info, 0, sizeof(*info));
virBufferAddLit(&query, WIN32_COMPUTERSYSTEM_WQL_SELECT);
@ -341,7 +341,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
/* Fill struct */
if (virStrncpy(info->model, processorList->data->Name,
sizeof (info->model) - 1, sizeof (info->model)) == NULL) {
sizeof(info->model) - 1, sizeof(info->model)) == NULL) {
HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
_("CPU model %s too long for destination"),
processorList->data->Name);
@ -679,7 +679,7 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
Msvm_ProcessorSettingData *processorSettingData = NULL;
Msvm_MemorySettingData *memorySettingData = NULL;
memset(info, 0, sizeof (*info));
memset(info, 0, sizeof(*info));
virUUIDFormat(domain->uuid, uuid_string);

View File

@ -83,7 +83,7 @@
# define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
# define ARRAY_CARDINALITY(Array) (sizeof(Array) / sizeof(*(Array)))
/* C99 uses __func__. __FUNCTION__ is legacy. */
# ifndef __GNUC__
@ -205,7 +205,7 @@
* Use this when passing possibly-NULL strings to printf-a-likes.
*/
# define NULLSTR(s) \
((void)verify_true(sizeof *(s) == sizeof (char)), \
((void)verify_true(sizeof(*(s)) == sizeof(char)), \
(s) ? (s) : "(null)")
/**

View File

@ -45,6 +45,8 @@
#include "virrandom.h"
#include "viruri.h"
#include <ctype.h>
#ifndef WITH_DRIVER_MODULES
# ifdef WITH_TEST
# include "test/test_driver.h"
@ -7165,7 +7167,7 @@ virDomainBlockStats(virDomainPtr dom, const char *disk,
virDispatchError(NULL);
return -1;
}
if (!disk || !stats || size > sizeof stats2) {
if (!disk || !stats || size > sizeof(stats2)) {
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
@ -7305,7 +7307,7 @@ virDomainInterfaceStats (virDomainPtr dom, const char *path,
virDispatchError(NULL);
return -1;
}
if (!path || !stats || size > sizeof stats2) {
if (!path || !stats || size > sizeof(stats2)) {
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
@ -18625,13 +18627,13 @@ error:
*
* getting total stats: set start_cpu as -1, ncpus 1
* virDomainGetCPUStats(dom, NULL, 0, -1, 1, 0) => nparams
* params = calloc(nparams, sizeof (virTypedParameter))
* params = calloc(nparams, sizeof(virTypedParameter))
* virDomainGetCPUStats(dom, params, nparams, -1, 1, 0) => total stats.
*
* getting per-cpu stats:
* virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0) => ncpus
* virDomainGetCPUStats(dom, NULL, 0, 0, 1, 0) => nparams
* params = calloc(ncpus * nparams, sizeof (virTypedParameter))
* params = calloc(ncpus * nparams, sizeof(virTypedParameter))
* virDomainGetCPUStats(dom, params, nparams, 0, ncpus, 0) => per-cpu stats
*
* Returns -1 on failure, or the number of statistics that were

View File

@ -895,22 +895,22 @@ libxlStartup(int privileged) {
if (virFileMakePath(libxl_driver->logDir) < 0) {
VIR_ERROR(_("Failed to create log dir '%s': %s"),
libxl_driver->logDir, virStrerror(errno, ebuf, sizeof ebuf));
libxl_driver->logDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(libxl_driver->stateDir) < 0) {
VIR_ERROR(_("Failed to create state dir '%s': %s"),
libxl_driver->stateDir, virStrerror(errno, ebuf, sizeof ebuf));
libxl_driver->stateDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(libxl_driver->libDir) < 0) {
VIR_ERROR(_("Failed to create lib dir '%s': %s"),
libxl_driver->libDir, virStrerror(errno, ebuf, sizeof ebuf));
libxl_driver->libDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(libxl_driver->saveDir) < 0) {
VIR_ERROR(_("Failed to create save dir '%s': %s"),
libxl_driver->saveDir, virStrerror(errno, ebuf, sizeof ebuf));
libxl_driver->saveDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}

View File

@ -1517,7 +1517,7 @@ int lxcContainerAvailable(int features)
if (cpid < 0) {
char ebuf[1024] ATTRIBUTE_UNUSED;
VIR_DEBUG("clone call returned %s, container support is not enabled",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
return -1;
} else if (virPidWait(cpid, NULL) < 0) {
return -1;

View File

@ -1897,7 +1897,7 @@ static int lxcVmStart(virConnectPtr conn,
if (safewrite(logfd, timestamp, strlen(timestamp)) < 0 ||
safewrite(logfd, START_POSTFIX, strlen(START_POSTFIX)) < 0) {
VIR_WARN("Unable to write timestamp to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(timestamp);
@ -1905,7 +1905,7 @@ static int lxcVmStart(virConnectPtr conn,
virCommandWriteArgLog(cmd, logfd);
if ((pos = lseek(logfd, 0, SEEK_END)) < 0)
VIR_WARN("Unable to seek to end of logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;

View File

@ -1623,7 +1623,7 @@ static int udevDeviceMonitorStartup(int privileged)
if (errno != ENOENT && (privileged || errno != EACCES)) {
char ebuf[256];
VIR_ERROR(_("Failed to initialize libpciaccess: %s"),
virStrerror(pciret, ebuf, sizeof ebuf));
virStrerror(pciret, ebuf, sizeof(ebuf)));
ret = -1;
goto out;
}

View File

@ -803,9 +803,9 @@ nodeCapsInitNUMA(virCapsPtr caps)
return 0;
int mask_n_bytes = max_n_cpus / 8;
if (VIR_ALLOC_N(mask, mask_n_bytes / sizeof *mask) < 0)
if (VIR_ALLOC_N(mask, mask_n_bytes / sizeof(*mask)) < 0)
goto cleanup;
if (VIR_ALLOC_N(allonesmask, mask_n_bytes / sizeof *mask) < 0)
if (VIR_ALLOC_N(allonesmask, mask_n_bytes / sizeof(*mask)) < 0)
goto cleanup;
memset(allonesmask, 0xff, mask_n_bytes);

View File

@ -866,7 +866,7 @@ qemuAgentCommand(qemuAgentPtr mon,
*reply = NULL;
memset(&msg, 0, sizeof msg);
memset(&msg, 0, sizeof(msg));
if (!(cmdstr = virJSONValueToString(cmd))) {
virReportOOMError();

View File

@ -550,32 +550,32 @@ qemudStartup(int privileged) {
if (virFileMakePath(qemu_driver->stateDir) < 0) {
VIR_ERROR(_("Failed to create state dir '%s': %s"),
qemu_driver->stateDir, virStrerror(errno, ebuf, sizeof ebuf));
qemu_driver->stateDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->libDir) < 0) {
VIR_ERROR(_("Failed to create lib dir '%s': %s"),
qemu_driver->libDir, virStrerror(errno, ebuf, sizeof ebuf));
qemu_driver->libDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->cacheDir) < 0) {
VIR_ERROR(_("Failed to create cache dir '%s': %s"),
qemu_driver->cacheDir, virStrerror(errno, ebuf, sizeof ebuf));
qemu_driver->cacheDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->saveDir) < 0) {
VIR_ERROR(_("Failed to create save dir '%s': %s"),
qemu_driver->saveDir, virStrerror(errno, ebuf, sizeof ebuf));
qemu_driver->saveDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->snapshotDir) < 0) {
VIR_ERROR(_("Failed to create save dir '%s': %s"),
qemu_driver->snapshotDir, virStrerror(errno, ebuf, sizeof ebuf));
qemu_driver->snapshotDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
if (virFileMakePath(qemu_driver->autoDumpPath) < 0) {
VIR_ERROR(_("Failed to create dump dir '%s': %s"),
qemu_driver->autoDumpPath, virStrerror(errno, ebuf, sizeof ebuf));
qemu_driver->autoDumpPath, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
@ -4591,7 +4591,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
virDomainActualNetDefFree(net->data.network.actual);
memset(net, 0, sizeof *net);
memset(net, 0, sizeof(*net));
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
net->script = NULL;
@ -4602,7 +4602,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
* case, the best we can do is NULL everything out.
*/
virDomainActualNetDefFree(net->data.network.actual);
memset(net, 0, sizeof *net);
memset(net, 0, sizeof(*net));
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
net->script = NULL;
@ -4613,7 +4613,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
VIR_FREE(net->data.direct.linkdev);
VIR_FREE(net->data.direct.virtPortProfile);
memset(net, 0, sizeof *net);
memset(net, 0, sizeof(*net));
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
net->script = NULL;
@ -4624,7 +4624,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
char *brname = net->data.bridge.brname;
char *ipaddr = net->data.bridge.ipaddr;
memset(net, 0, sizeof *net);
memset(net, 0, sizeof(*net));
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
net->script = script;

View File

@ -2241,11 +2241,11 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver,
if (auth->expires) {
time_t lifetime = auth->validTo - now;
if (lifetime <= 0)
snprintf(expire_time, sizeof (expire_time), "now");
snprintf(expire_time, sizeof(expire_time), "now");
else
snprintf(expire_time, sizeof (expire_time), "%lu", (long unsigned)auth->validTo);
snprintf(expire_time, sizeof(expire_time), "%lu", (long unsigned)auth->validTo);
} else {
snprintf(expire_time, sizeof (expire_time), "never");
snprintf(expire_time, sizeof(expire_time), "never");
}
ret = qemuMonitorExpirePassword(priv->mon, type, expire_time);

View File

@ -1522,7 +1522,7 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
VIR_DEBUG("Generated uri_out=%s", *uri_out);
/* QEMU will be started with -incoming tcp:0.0.0.0:port */
snprintf(migrateFrom, sizeof (migrateFrom), "tcp:0.0.0.0:%d", this_port);
snprintf(migrateFrom, sizeof(migrateFrom), "tcp:0.0.0.0:%d", this_port);
ret = qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen,
cookieout, cookieoutlen, dname, dom_xml,

View File

@ -214,7 +214,7 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
*reply = NULL;
memset(&msg, 0, sizeof msg);
memset(&msg, 0, sizeof(msg));
exe = virJSONValueObjectGet(cmd, "execute");
if (exe) {

View File

@ -226,7 +226,7 @@ qemuMonitorTextCommandWithHandler(qemuMonitorPtr mon,
*reply = NULL;
memset(&msg, 0, sizeof msg);
memset(&msg, 0, sizeof(msg));
if (virAsprintf(&msg.txBuffer, "%s\r", cmd) < 0) {
virReportOOMError();

View File

@ -1598,7 +1598,7 @@ closelog:
if (VIR_CLOSE(logfd) < 0) {
char ebuf[1024];
VIR_WARN("Unable to close logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(buf);
@ -3523,7 +3523,7 @@ int qemuProcessStart(virConnectPtr conn,
if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
safewrite(logfile, START_POSTFIX, strlen(START_POSTFIX)) < 0) {
VIR_WARN("Unable to write timestamp to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(timestamp);
@ -3535,7 +3535,7 @@ int qemuProcessStart(virConnectPtr conn,
if ((pos = lseek(logfile, 0, SEEK_END)) < 0)
VIR_WARN("Unable to seek to end of logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
VIR_DEBUG("Clear emulator capabilities: %d",
driver->clearEmulatorCapabilities);
@ -3796,7 +3796,7 @@ qemuProcessKill(struct qemud_driver *driver,
char ebuf[1024];
VIR_WARN("Failed to terminate process %d with SIG%s: %s",
vm->pid, signame,
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
goto cleanup;
}
ret = 0;
@ -3873,7 +3873,7 @@ void qemuProcessStop(struct qemud_driver *driver,
/* To not break the normal domain shutdown process, skip the
* timestamp log writing if failed on opening log file. */
VIR_WARN("Unable to open logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
} else {
if ((timestamp = virTimeStringNow()) == NULL) {
virReportOOMError();
@ -3882,7 +3882,7 @@ void qemuProcessStop(struct qemud_driver *driver,
safewrite(logfile, SHUTDOWN_POSTFIX,
strlen(SHUTDOWN_POSTFIX)) < 0) {
VIR_WARN("Unable to write timestamp to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(timestamp);
@ -3890,7 +3890,7 @@ void qemuProcessStop(struct qemud_driver *driver,
if (VIR_CLOSE(logfile) < 0)
VIR_WARN("Unable to close logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
}
/* This method is routinely used in clean up paths. Disable error
@ -4169,7 +4169,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
safewrite(logfile, ATTACH_POSTFIX, strlen(ATTACH_POSTFIX)) < 0) {
VIR_WARN("Unable to write timestamp to logfile: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(timestamp);

View File

@ -719,7 +719,7 @@ doRemoteOpen (virConnectPtr conn,
remote_get_uri_ret uriret;
VIR_DEBUG("Trying to query remote URI");
memset (&uriret, 0, sizeof uriret);
memset (&uriret, 0, sizeof(uriret));
if (call (conn, priv, 0,
REMOTE_PROC_GET_URI,
(xdrproc_t) xdr_void, (char *) NULL,
@ -974,7 +974,7 @@ remoteType (virConnectPtr conn)
goto done;
}
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_GET_TYPE,
(xdrproc_t) xdr_void, (char *) NULL,
(xdrproc_t) xdr_remote_get_type_ret, (char *) &ret) == -1)
@ -995,7 +995,7 @@ static int remoteIsSecure(virConnectPtr conn)
remote_is_secure_ret ret;
remoteDriverLock(priv);
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_IS_SECURE,
(xdrproc_t) xdr_void, (char *) NULL,
(xdrproc_t) xdr_remote_is_secure_ret, (char *) &ret) == -1)
@ -1024,7 +1024,7 @@ static int remoteIsEncrypted(virConnectPtr conn)
remote_is_secure_ret ret;
remoteDriverLock(priv);
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_IS_SECURE,
(xdrproc_t) xdr_void, (char *) NULL,
(xdrproc_t) xdr_remote_is_secure_ret, (char *) &ret) == -1)
@ -1066,7 +1066,7 @@ remoteNodeGetCPUStats (virConnectPtr conn,
args.cpuNum = cpuNum;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_CPU_STATS,
(xdrproc_t) xdr_remote_node_get_cpu_stats_args,
(char *) &args,
@ -1132,7 +1132,7 @@ remoteNodeGetMemoryStats (virConnectPtr conn,
args.cellNum = cellNum;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_MEMORY_STATS,
(xdrproc_t) xdr_remote_node_get_memory_stats_args, (char *) &args,
(xdrproc_t) xdr_remote_node_get_memory_stats_ret, (char *) &ret) == -1)
@ -1202,7 +1202,7 @@ remoteNodeGetCellsFreeMemory(virConnectPtr conn,
args.startCell = startCell;
args.maxcells = maxCells;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY,
(xdrproc_t) xdr_remote_node_get_cells_free_memory_args, (char *)&args,
(xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *)&ret) == -1)
@ -1239,7 +1239,7 @@ remoteListDomains (virConnectPtr conn, int *ids, int maxids)
}
args.maxids = maxids;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_LIST_DOMAINS,
(xdrproc_t) xdr_remote_list_domains_args, (char *) &args,
(xdrproc_t) xdr_remote_list_domains_ret, (char *) &ret) == -1)
@ -1481,7 +1481,7 @@ remoteDomainBlockStatsFlags(virDomainPtr domain,
args.path = (char *) path;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS,
(xdrproc_t) xdr_remote_domain_block_stats_flags_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_block_stats_flags_ret, (char *) &ret) == -1)
@ -1541,7 +1541,7 @@ remoteDomainGetMemoryParameters (virDomainPtr domain,
args.nparams = *nparams;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS,
(xdrproc_t) xdr_remote_domain_get_memory_parameters_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, (char *) &ret) == -1)
@ -1589,7 +1589,7 @@ remoteDomainGetNumaParameters (virDomainPtr domain,
args.nparams = *nparams;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS,
(xdrproc_t) xdr_remote_domain_get_numa_parameters_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_numa_parameters_ret, (char *) &ret) == -1)
@ -1637,7 +1637,7 @@ remoteDomainGetBlkioParameters (virDomainPtr domain,
args.nparams = *nparams;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS,
(xdrproc_t) xdr_remote_domain_get_blkio_parameters_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, (char *) &ret) == -1)
@ -1704,7 +1704,7 @@ remoteDomainGetVcpuPinInfo (virDomainPtr domain,
args.maplen = maplen;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO,
(xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_args,
@ -1775,7 +1775,7 @@ remoteDomainGetVcpus (virDomainPtr domain,
args.maxinfo = maxinfo;
args.maplen = maplen;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUS,
(xdrproc_t) xdr_remote_domain_get_vcpus_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret) == -1)
@ -1794,7 +1794,7 @@ remoteDomainGetVcpus (virDomainPtr domain,
goto cleanup;
}
memset (info, 0, sizeof (virVcpuInfo) * maxinfo);
memset (info, 0, sizeof(virVcpuInfo) * maxinfo);
memset (cpumaps, 0, maxinfo * maplen);
for (i = 0; i < ret.info.info_len; ++i) {
@ -1828,8 +1828,8 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel)
remoteDriverLock(priv);
make_nonnull_domain (&args.dom, domain);
memset (&ret, 0, sizeof ret);
memset (seclabel, 0, sizeof (*seclabel));
memset (&ret, 0, sizeof(ret));
memset (seclabel, 0, sizeof(*seclabel));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL,
(xdrproc_t) xdr_remote_domain_get_security_label_args, (char *)&args,
@ -1838,9 +1838,9 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel)
}
if (ret.label.label_val != NULL) {
if (strlen (ret.label.label_val) >= sizeof seclabel->label) {
if (strlen (ret.label.label_val) >= sizeof(seclabel->label)) {
remoteError(VIR_ERR_RPC, _("security label exceeds maximum: %zu"),
sizeof seclabel->label - 1);
sizeof(seclabel->label) - 1);
goto cleanup;
}
strcpy (seclabel->label, ret.label.label_val);
@ -1873,7 +1873,7 @@ remoteDomainGetState(virDomainPtr domain,
make_nonnull_domain(&args.dom, domain);
args.flags = flags;
memset(&ret, 0, sizeof ret);
memset(&ret, 0, sizeof(ret));
if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_STATE,
(xdrproc_t) xdr_remote_domain_get_state_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_state_ret, (char *) &ret) == -1)
@ -1899,8 +1899,8 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)
remoteDriverLock(priv);
memset (&ret, 0, sizeof ret);
memset (secmodel, 0, sizeof (*secmodel));
memset (&ret, 0, sizeof(ret));
memset (secmodel, 0, sizeof(*secmodel));
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_SECURITY_MODEL,
(xdrproc_t) xdr_void, NULL,
@ -1909,18 +1909,18 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)
}
if (ret.model.model_val != NULL) {
if (strlen (ret.model.model_val) >= sizeof secmodel->model) {
if (strlen (ret.model.model_val) >= sizeof(secmodel->model)) {
remoteError(VIR_ERR_RPC, _("security model exceeds maximum: %zu"),
sizeof secmodel->model - 1);
sizeof(secmodel->model) - 1);
goto cleanup;
}
strcpy (secmodel->model, ret.model.model_val);
}
if (ret.doi.doi_val != NULL) {
if (strlen (ret.doi.doi_val) >= sizeof secmodel->doi) {
if (strlen (ret.doi.doi_val) >= sizeof(secmodel->doi)) {
remoteError(VIR_ERR_RPC, _("security doi exceeds maximum: %zu"),
sizeof secmodel->doi - 1);
sizeof(secmodel->doi) - 1);
goto cleanup;
}
strcpy (secmodel->doi, ret.doi.doi_val);
@ -1955,7 +1955,7 @@ remoteDomainMigratePrepare (virConnectPtr dconn,
args.dname = dname == NULL ? NULL : (char **) &dname;
args.resource = resource;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE,
(xdrproc_t) xdr_remote_domain_migrate_prepare_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_migrate_prepare_ret, (char *) &ret) == -1)
@ -1997,7 +1997,7 @@ remoteDomainMigratePrepare2 (virConnectPtr dconn,
args.resource = resource;
args.dom_xml = (char *) dom_xml;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2,
(xdrproc_t) xdr_remote_domain_migrate_prepare2_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_migrate_prepare2_ret, (char *) &ret) == -1)
@ -2058,7 +2058,7 @@ remoteDomainCreate (virDomainPtr domain)
* it returned.
*/
memcpy (args2.uuid, domain->uuid, VIR_UUID_BUFLEN);
memset (&ret2, 0, sizeof ret2);
memset (&ret2, 0, sizeof(ret)2);
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID,
(xdrproc_t) xdr_remote_domain_lookup_by_uuid_args, (char *) &args2,
(xdrproc_t) xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2) == -1)
@ -2086,7 +2086,7 @@ remoteDomainGetSchedulerType (virDomainPtr domain, int *nparams)
make_nonnull_domain (&args.dom, domain);
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE,
(xdrproc_t) xdr_remote_domain_get_scheduler_type_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_scheduler_type_ret, (char *) &ret) == -1)
@ -2125,7 +2125,7 @@ remoteDomainMemoryStats (virDomainPtr domain,
}
args.maxStats = nr_stats;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_STATS,
(xdrproc_t) xdr_remote_domain_memory_stats_args,
@ -2174,7 +2174,7 @@ remoteDomainBlockPeek (virDomainPtr domain,
args.size = size;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_PEEK,
(xdrproc_t) xdr_remote_domain_block_peek_args,
(char *) &args,
@ -2225,7 +2225,7 @@ remoteDomainMemoryPeek (virDomainPtr domain,
args.size = size;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_PEEK,
(xdrproc_t) xdr_remote_domain_memory_peek_args,
(char *) &args,
@ -2569,7 +2569,7 @@ remoteFindStoragePoolSources (virConnectPtr conn,
args.srcSpec = srcSpec ? (char **)&srcSpec : (char **)&emptyString;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_FIND_STORAGE_POOL_SOURCES,
(xdrproc_t) xdr_remote_find_storage_pool_sources_args, (char *) &args,
(xdrproc_t) xdr_remote_find_storage_pool_sources_ret, (char *) &ret) == -1)
@ -2700,7 +2700,7 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv,
struct remote_auth_list_ret ret;
int err, type = REMOTE_AUTH_NONE;
memset(&ret, 0, sizeof ret);
memset(&ret, 0, sizeof(ret));
err = call (conn, priv, 0,
REMOTE_PROC_AUTH_LIST,
(xdrproc_t) xdr_void, (char *) NULL,
@ -3160,7 +3160,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv,
goto cleanup;
/* First call is to inquire about supported mechanisms in the server */
memset (&iret, 0, sizeof iret);
memset (&iret, 0, sizeof(iret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_SASL_INIT,
(xdrproc_t) xdr_void, (char *)NULL,
(xdrproc_t) xdr_remote_auth_sasl_init_ret, (char *) &iret) != 0)
@ -3206,7 +3206,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv,
goto cleanup;
}
/* NB, distinction of NULL vs "" is *critical* in SASL */
memset(&sargs, 0, sizeof sargs);
memset(&sargs, 0, sizeof(sargs));
sargs.nil = clientout ? 0 : 1;
sargs.data.data_val = (char*)clientout;
sargs.data.data_len = clientoutlen;
@ -3215,7 +3215,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv,
mech, clientoutlen, clientout);
/* Now send the initial auth data to the server */
memset (&sret, 0, sizeof sret);
memset (&sret, 0, sizeof(sret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_SASL_START,
(xdrproc_t) xdr_remote_auth_sasl_start_args, (char *) &sargs,
(xdrproc_t) xdr_remote_auth_sasl_start_ret, (char *) &sret) != 0)
@ -3260,14 +3260,14 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv,
/* Not done, prepare to talk with the server for another iteration */
/* NB, distinction of NULL vs "" is *critical* in SASL */
memset(&pargs, 0, sizeof pargs);
memset(&pargs, 0, sizeof(pargs));
pargs.nil = clientout ? 0 : 1;
pargs.data.data_val = (char*)clientout;
pargs.data.data_len = clientoutlen;
VIR_DEBUG("Server step with %zu bytes %p",
clientoutlen, clientout);
memset (&pret, 0, sizeof pret);
memset (&pret, 0, sizeof(pret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_SASL_STEP,
(xdrproc_t) xdr_remote_auth_sasl_step_args, (char *) &pargs,
(xdrproc_t) xdr_remote_auth_sasl_step_ret, (char *) &pret) != 0)
@ -3328,7 +3328,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv,
remote_auth_polkit_ret ret;
VIR_DEBUG("Client initialize PolicyKit-1 authentication");
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_POLKIT,
(xdrproc_t) xdr_void, (char *)NULL,
(xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) {
@ -3358,7 +3358,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv,
VIR_DEBUG("Client initialize PolicyKit-0 authentication");
/* Check auth first and if it succeeds we are done. */
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_POLKIT,
(xdrproc_t) xdr_void, (char *)NULL,
(xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) == 0)
@ -3389,7 +3389,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv,
return -1;
}
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (conn, priv, 0, REMOTE_PROC_AUTH_POLKIT,
(xdrproc_t) xdr_void, (char *)NULL,
(xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) {
@ -3859,7 +3859,7 @@ remoteSecretGetValue (virSecretPtr secret, size_t *value_size,
make_nonnull_secret (&args.secret, secret);
args.flags = flags;
memset (&ret, 0, sizeof (ret));
memset (&ret, 0, sizeof(ret));
if (call (secret->conn, priv, 0, REMOTE_PROC_SECRET_GET_VALUE,
(xdrproc_t) xdr_remote_secret_get_value_args, (char *) &args,
(xdrproc_t) xdr_remote_secret_get_value_ret, (char *) &ret) == -1)
@ -4209,7 +4209,7 @@ remoteQemuDomainMonitorCommand (virDomainPtr domain, const char *cmd,
args.cmd = (char *)cmd;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, REMOTE_CALL_QEMU, QEMU_PROC_MONITOR_COMMAND,
(xdrproc_t) xdr_qemu_monitor_command_args, (char *) &args,
(xdrproc_t) xdr_qemu_monitor_command_ret, (char *) &ret) == -1)
@ -4315,7 +4315,7 @@ remoteDomainMigratePrepare3(virConnectPtr dconn,
args.resource = resource;
args.dom_xml = (char *) dom_xml;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3,
(xdrproc_t) xdr_remote_domain_migrate_prepare3_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_migrate_prepare3_ret, (char *) &ret) == -1)
@ -4673,7 +4673,7 @@ remoteDomainGetDiskErrors(virDomainPtr dom,
args.maxerrors = maxerrors;
args.flags = flags;
memset(&ret, 0, sizeof ret);
memset(&ret, 0, sizeof(ret));
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_DISK_ERRORS,
(xdrproc_t) xdr_remote_domain_get_disk_errors_args,
@ -4773,7 +4773,7 @@ remoteDomainGetInterfaceParameters (virDomainPtr domain,
args.nparams = *nparams;
args.flags = flags;
memset (&ret, 0, sizeof ret);
memset (&ret, 0, sizeof(ret));
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS,
(xdrproc_t) xdr_remote_domain_get_interface_parameters_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_interface_parameters_ret, (char *) &ret) == -1)

View File

@ -518,7 +518,7 @@ elsif ($opt_b) {
die "legacy [u]long hyper arrays aren't supported";
}
push(@ret_list, "memcpy(ret->$3, tmp.$3, sizeof ret->$3);");
push(@ret_list, "memcpy(ret->$3, tmp.$3, sizeof(ret->$3));");
} elsif ($ret_member =~ m/^(unsigned )?(char|short|int|hyper) (\S+);/) {
push(@ret_list, "ret->$3 = tmp.$3;");
} else {
@ -731,7 +731,7 @@ elsif ($opt_b) {
# have a 'Struct' suffix on the actual struct name
# and take the struct size as additional argument
$struct_name .= "Struct";
splice(@args_list, $call->{ret_offset} + 1, 0, ("sizeof tmp"));
splice(@args_list, $call->{ret_offset} + 1, 0, ("sizeof(tmp)"));
}
push(@vars_list, "vir$struct_name tmp");
@ -1213,7 +1213,7 @@ elsif ($opt_k) {
die "legacy [u]long hyper arrays aren't supported";
}
push(@ret_list, "memcpy(result->$3, ret.$3, sizeof result->$3);");
push(@ret_list, "memcpy(result->$3, ret.$3, sizeof(result->$3));");
} elsif ($ret_member =~ m/<\S+>;/ or $ret_member =~ m/\[\S+\];/) {
# just make all other array types fail
die "unhandled type for multi-return-value for " .
@ -1465,7 +1465,7 @@ elsif ($opt_k) {
if ($rettype ne "void") {
print "\n";
print " memset(&ret, 0, sizeof ret);\n";
print " memset(&ret, 0, sizeof(ret));\n";
}
my $callflags = "0";

View File

@ -1469,7 +1469,7 @@ static void virNetClientIOUpdateCallback(virNetClientPtr client,
* which come from the user). It does however free any intermediate
* results, eg. the error structure if there is one.
*
* NB(2). Make sure to memset (&ret, 0, sizeof ret) before calling,
* NB(2). Make sure to memset (&ret, 0, sizeof(ret)) before calling,
* else Bad Things will happen in the XDR code.
*
* NB(3) You must have the client lock before calling this

View File

@ -364,7 +364,7 @@ int virNetSASLSessionSecProps(virNetSASLSessionPtr sasl,
minSSF, maxSSF, allowAnonymous, sasl->maxbufsize);
virMutexLock(&sasl->lock);
memset(&secprops, 0, sizeof secprops);
memset(&secprops, 0, sizeof(secprops));
secprops.min_ssf = minSSF;
secprops.max_ssf = maxSSF;

View File

@ -203,7 +203,7 @@ int virNetSocketNewListenTCP(const char *nodename,
*retsocks = NULL;
*nretsocks = 0;
memset(&hints, 0, sizeof hints);
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
@ -228,7 +228,7 @@ int virNetSocketNewListenTCP(const char *nodename,
}
int opt = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt) < 0) {
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
virReportSystemError(errno, "%s", _("Unable to enable port reuse"));
goto error;
}
@ -244,7 +244,7 @@ int virNetSocketNewListenTCP(const char *nodename,
* we force it to only listen on IPv6
*/
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
(void*)&on, sizeof on) < 0) {
(void*)&on, sizeof(on)) < 0) {
virReportSystemError(errno, "%s",
_("Unable to force bind to IPv6 only"));
goto error;
@ -400,7 +400,7 @@ int virNetSocketNewConnectTCP(const char *nodename,
memset(&localAddr, 0, sizeof(localAddr));
memset(&remoteAddr, 0, sizeof(remoteAddr));
memset(&hints, 0, sizeof hints);
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
@ -422,7 +422,7 @@ int virNetSocketNewConnectTCP(const char *nodename,
goto error;
}
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt);
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
if (connect(fd, runp->ai_addr, runp->ai_addrlen) >= 0)
break;
@ -830,7 +830,7 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
pid_t *pid)
{
struct ucred cr;
socklen_t cr_len = sizeof (cr);
socklen_t cr_len = sizeof(cr);
virMutexLock(&sock->lock);
if (getsockopt(sock->fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_len) < 0) {

View File

@ -577,14 +577,14 @@ valid_path(const char *path, const bool readonly)
}
}
opaths = sizeof(override)/sizeof *(override);
opaths = sizeof(override)/sizeof(*(override));
npaths = sizeof(restricted)/sizeof *(restricted);
npaths = sizeof(restricted)/sizeof(*(restricted));
if (array_starts_with(path, restricted, npaths) == 0 &&
array_starts_with(path, override, opaths) != 0)
return 1;
npaths = sizeof(restricted_rw)/sizeof *(restricted_rw);
npaths = sizeof(restricted_rw)/sizeof(*(restricted_rw));
if (!readonly) {
if (array_starts_with(path, restricted_rw, npaths) == 0)
return 1;

View File

@ -55,7 +55,7 @@ virStorageBackendISCSITargetIP(const char *hostname,
struct addrinfo *result = NULL;
int ret;
memset(&hints, 0, sizeof hints);
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
@ -207,7 +207,7 @@ virStorageBackendIQNFound(const char *initiatoriqn,
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to open stream for file descriptor "
"when reading output from '%s': '%s'"),
ISCSIADM, virStrerror(errno, ebuf, sizeof ebuf));
ISCSIADM, virStrerror(errno, ebuf, sizeof(ebuf)));
ret = IQN_ERROR;
goto out;
}

View File

@ -652,7 +652,7 @@ storagePoolUndefine(virStoragePoolPtr obj) {
if (unlink(pool->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
char ebuf[1024];
VIR_ERROR(_("Failed to delete autostart link '%s': %s"),
pool->autostartLink, virStrerror(errno, ebuf, sizeof ebuf));
pool->autostartLink, virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(pool->configFile);

View File

@ -472,7 +472,7 @@ umlStartup(int privileged)
if (virFileMakePath(uml_driver->monitorDir) < 0) {
char ebuf[1024];
VIR_ERROR(_("Failed to create monitor directory %s: %s"),
uml_driver->monitorDir, virStrerror(errno, ebuf, sizeof ebuf));
uml_driver->monitorDir, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
}
@ -788,7 +788,7 @@ static int umlMonitorAddress(const struct uml_driver *driver,
return -1;
}
memset(addr, 0, sizeof *addr);
memset(addr, 0, sizeof(*addr));
addr->sun_family = AF_UNIX;
if (virStrcpyStatic(addr->sun_path, sockname) == NULL) {
umlReportError(VIR_ERR_INTERNAL_ERROR,
@ -826,11 +826,11 @@ restat:
return -1;
}
memset(addr.sun_path, 0, sizeof addr.sun_path);
memset(addr.sun_path, 0, sizeof(addr.sun_path));
snprintf(addr.sun_path + 1, sizeof(addr.sun_path) - 1,
"libvirt-uml-%u", vm->pid);
VIR_DEBUG("Reply address for monitor is '%s'", addr.sun_path+1);
if (bind(priv->monitor, (struct sockaddr *)&addr, sizeof addr) < 0) {
if (bind(priv->monitor, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
virReportSystemError(errno,
"%s", _("cannot bind socket"));
VIR_FORCE_CLOSE(priv->monitor);
@ -896,8 +896,8 @@ static int umlMonitorCommand(const struct uml_driver *driver,
return -1;
}
if (sendto(priv->monitor, &req, sizeof req, 0,
(struct sockaddr *)&addr, sizeof addr) != (sizeof req)) {
if (sendto(priv->monitor, &req, sizeof(req), 0,
(struct sockaddr *)&addr, sizeof(addr)) != sizeof(req)) {
virReportSystemError(errno,
_("cannot send command %s"),
cmd);
@ -907,7 +907,7 @@ static int umlMonitorCommand(const struct uml_driver *driver,
do {
ssize_t nbytes;
addrlen = sizeof(addr);
nbytes = recvfrom(priv->monitor, &res, sizeof res, 0,
nbytes = recvfrom(priv->monitor, &res, sizeof(res), 0,
(struct sockaddr *)&addr, &addrlen);
if (nbytes < 0) {
if (errno == EAGAIN || errno == EINTR)

View File

@ -59,7 +59,7 @@ void virBufferEscapeShell(virBufferPtr buf, const char *str);
void virBufferURIEncodeString(virBufferPtr buf, const char *str);
# define virBufferAddLit(buf_, literal_string_) \
virBufferAdd(buf_, "" literal_string_ "", sizeof literal_string_ - 1)
virBufferAdd(buf_, "" literal_string_ "", sizeof(literal_string_) - 1)
void virBufferAdjustIndent(virBufferPtr buf, int indent);
int virBufferGetIndent(const virBufferPtr buf, bool dynamic);

View File

@ -1594,7 +1594,7 @@ virCommandWriteArgLog(virCommandPtr cmd, int logfd)
if (ioError) {
char ebuf[1024];
VIR_WARN("Unable to write command %s args to logfile: %s",
cmd->args[0], virStrerror(ioError, ebuf, sizeof ebuf));
cmd->args[0], virStrerror(ioError, ebuf, sizeof(ebuf)));
}
}

View File

@ -114,7 +114,7 @@ ebtRulesRemove(ebtRules *rules,
memmove(&rules->rules[i],
&rules->rules[i+1],
(rules->nrules - i - 1) * sizeof (ebtRule));
(rules->nrules - i - 1) * sizeof(ebtRule));
rules->nrules--;

View File

@ -35,12 +35,12 @@
calculations, so the conservative dividend to use here is
SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.
However, malloc (SIZE_MAX) fails on all known hosts where
sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
sizeof(ptrdiff_t) <= sizeof(size_t), so do not bother to test for
exactly-SIZE_MAX allocations on such hosts; this avoids a test and
branch when S is known to be 1. */
# ifndef xalloc_oversized
# define xalloc_oversized(n, s) \
((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
((size_t) (sizeof(ptrdiff_t) <= sizeof(size_t) ? -1 : -2) / (s) < (n))
# endif

View File

@ -863,7 +863,7 @@ recheck:
virRun(stubprobe, NULL) < 0) {
char ebuf[1024];
VIR_WARN("failed to load pci-stub or pciback drivers: %s",
virStrerror(errno, ebuf, sizeof ebuf));
virStrerror(errno, ebuf, sizeof(ebuf)));
return NULL;
}

View File

@ -57,7 +57,7 @@ linuxDomainInterfaceStats(const char *path,
path_len = strlen (path);
while (fgets (line, sizeof line, fp)) {
while (fgets (line, sizeof(line), fp)) {
long long dummy;
long long rx_bytes;
long long rx_packets;

View File

@ -833,7 +833,7 @@ virStorageFileGetMetadataFromFD(const char *path,
int ret = -1;
struct stat sb;
memset(meta, 0, sizeof (*meta));
memset(meta, 0, sizeof(*meta));
if (fstat(fd, &sb) < 0) {
virReportSystemError(errno,

View File

@ -83,8 +83,8 @@
# define NSIG 32
#endif
verify(sizeof(gid_t) <= sizeof (unsigned int) &&
sizeof(uid_t) <= sizeof (unsigned int));
verify(sizeof(gid_t) <= sizeof(unsigned int) &&
sizeof(uid_t) <= sizeof(unsigned int));
#define VIR_FROM_THIS VIR_FROM_NONE

View File

@ -108,7 +108,7 @@ virUUIDGenerate(unsigned char *uuid)
char ebuf[1024];
VIR_WARN("Falling back to pseudorandom UUID,"
" failed to generate random bytes: %s",
virStrerror(err, ebuf, sizeof ebuf));
virStrerror(err, ebuf, sizeof(ebuf)));
err = virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);
}

View File

@ -129,7 +129,7 @@ void virAuditSend(const char *file ATTRIBUTE_UNUSED, const char *func,
clientaddr, clienttty, success) < 0) {
char ebuf[1024];
VIR_WARN("Failed to send audit message %s: %s",
NULLSTR(str), virStrerror(errno, ebuf, sizeof ebuf));
NULLSTR(str), virStrerror(errno, ebuf, sizeof(ebuf)));
}
VIR_FREE(str);
}

View File

@ -164,7 +164,7 @@ virAuthGetUsername(virConnectPtr conn,
if (ret != NULL)
return ret;
memset(&cred, 0, sizeof (virConnectCredential));
memset(&cred, 0, sizeof(virConnectCredential));
if (defaultUsername != NULL) {
if (virAsprintf(&prompt, _("Enter username for %s [%s]"), hostname,
@ -220,7 +220,7 @@ virAuthGetPassword(virConnectPtr conn,
if (ret != NULL)
return ret;
memset(&cred, 0, sizeof (virConnectCredential));
memset(&cred, 0, sizeof(virConnectCredential));
if (virAsprintf(&prompt, _("Enter %s's password for %s"), username,
hostname) < 0) {

View File

@ -555,11 +555,11 @@ virNetDevMacVLanVPortProfileCallback(unsigned char *msg,
/* DEBUG end */
/* Parse netlink message assume a setlink with vfports */
memcpy(&ifinfo, NLMSG_DATA(hdr), sizeof ifinfo);
memcpy(&ifinfo, NLMSG_DATA(hdr), sizeof(ifinfo));
VIR_DEBUG("family:%#x type:%#x index:%d flags:%#x change:%#x",
ifinfo.ifi_family, ifinfo.ifi_type, ifinfo.ifi_index,
ifinfo.ifi_flags, ifinfo.ifi_change);
if (nlmsg_parse(hdr, sizeof ifinfo,
if (nlmsg_parse(hdr, sizeof(ifinfo),
(struct nlattr **)&tb, IFLA_MAX, NULL)) {
VIR_DEBUG("error parsing request...");
return;

View File

@ -367,7 +367,7 @@ int virPidFileAcquirePath(const char *path,
if (stat(path, &a) < 0) {
char ebuf[1024] ATTRIBUTE_UNUSED;
VIR_DEBUG("Pid file '%s' disappeared: %s",
path, virStrerror(errno, ebuf, sizeof ebuf));
path, virStrerror(errno, ebuf, sizeof(ebuf)));
VIR_FORCE_CLOSE(fd);
/* Someone else must be racing with us, so try agin */
continue;

View File

@ -1355,7 +1355,7 @@ void virReportSystemErrorFull(int domcode,
va_end(args);
size_t len = strlen(errnoDetail);
if (0 <= n && n + 2 + len < sizeof (msgDetailBuf)) {
if (0 <= n && n + 2 + len < sizeof(msgDetailBuf)) {
char *p = msgDetailBuf + n;
stpcpy (stpcpy (p, ": "), errnoDetail);
msgDetail = msgDetailBuf;

View File

@ -621,7 +621,7 @@ vboxComUninitialize(void)
static VBOXXPCOMC_v1 vboxXPCOMC_v1 = {
sizeof (VBOXXPCOMC_v1), /* cb */
sizeof(VBOXXPCOMC_v1), /* cb */
0x00010000U, /* uVersion */
vboxGetVersion, /* pfnGetVersion */
vboxComInitialize_v1, /* pfnComInitialize */
@ -635,7 +635,7 @@ static VBOXXPCOMC_v1 vboxXPCOMC_v1 = {
};
static VBOXXPCOMC_v2 vboxXPCOMC_v2 = {
sizeof (VBOXXPCOMC_v2), /* cb */
sizeof(VBOXXPCOMC_v2), /* cb */
0x00020000U, /* uVersion */
vboxGetVersion, /* pfnGetVersion */
vboxComInitialize_v2, /* pfnComInitialize */

View File

@ -381,7 +381,7 @@ vboxIIDFromUUID_v2_x_WIN32(vboxGlobalData *data, vboxIID_v2_x_WIN32 *iid,
static bool
vboxIIDIsEqual_v2_x_WIN32(vboxIID_v2_x_WIN32 *iid1, vboxIID_v2_x_WIN32 *iid2)
{
return memcmp(&iid1->value, &iid2->value, sizeof (GUID)) == 0;
return memcmp(&iid1->value, &iid2->value, sizeof(GUID)) == 0;
}
static void
@ -392,7 +392,7 @@ vboxIIDFromArrayItem_v2_x_WIN32(vboxGlobalData *data, vboxIID_v2_x_WIN32 *iid,
vboxIIDUnalloc_v2_x_WIN32(data, iid);
memcpy(&iid->value, &items[idx], sizeof (GUID));
memcpy(&iid->value, &items[idx], sizeof(GUID));
}
# define vboxIIDUnalloc(iid) vboxIIDUnalloc_v2_x_WIN32(data, iid)
@ -454,7 +454,7 @@ vboxIIDFromUUID_v2_x(vboxGlobalData *data, vboxIID_v2_x *iid,
static bool
vboxIIDIsEqual_v2_x(vboxIID_v2_x *iid1, vboxIID_v2_x *iid2)
{
return memcmp(iid1->value, iid2->value, sizeof (nsID)) == 0;
return memcmp(iid1->value, iid2->value, sizeof(nsID)) == 0;
}
static void
@ -465,7 +465,7 @@ vboxIIDFromArrayItem_v2_x(vboxGlobalData *data, vboxIID_v2_x *iid,
iid->value = &iid->backing;
memcpy(iid->value, array->items[idx], sizeof (nsID));
memcpy(iid->value, array->items[idx], sizeof(nsID));
}
# define vboxIIDUnalloc(iid) vboxIIDUnalloc_v2_x(data, iid)

View File

@ -76,7 +76,7 @@ read_stat (const char *path)
return -1;
/* read, but don't bail out before closing */
i = fread (str, 1, sizeof str - 1, fp);
i = fread (str, 1, sizeof(str) - 1, fp);
if (VIR_FCLOSE(fp) != 0 /* disk error */
|| i < 1) /* ensure we read at least one byte */
@ -136,9 +136,9 @@ check_bd_connected (xenUnifiedPrivatePtr priv, int device, int domid)
* xenstore, etc.
*/
if (!priv->xshandle) return 1;
snprintf (s, sizeof s, "/local/domain/0/backend/vbd/%d/%d/state",
snprintf (s, sizeof(s), "/local/domain/0/backend/vbd/%d/%d/state",
domid, device);
s[sizeof s - 1] = '\0';
s[sizeof(s) - 1] = '\0';
rs = xs_read (priv->xshandle, 0, s, &len);
if (!rs) return 1;

View File

@ -566,7 +566,7 @@ struct xen_v2s3_getdomaininfolistop {
uint32_t max_domains;
#ifdef __BIG_ENDIAN__
struct {
int __pad[(sizeof (long long) - sizeof (struct xen_v2d5_getdomaininfo *)) / sizeof (int)];
int __pad[(sizeof(long long) - sizeof(struct xen_v2d5_getdomaininfo *)) / sizeof(int)];
struct xen_v2d5_getdomaininfo *v;
} buffer;
#else
@ -681,7 +681,7 @@ typedef struct xen_v2_setvcpumap xen_v2_setvcpumap;
struct xen_v2d5_cpumap {
#ifdef __BIG_ENDIAN__
struct {
int __pad[(sizeof (long long) - sizeof (uint8_t *)) / sizeof (int)];
int __pad[(sizeof(long long) - sizeof(uint8_t *)) / sizeof(int)];
uint8_t *v;
} bitmap;
#else
@ -1996,7 +1996,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
errcode = regcomp (&flags_hvm_rec, flags_hvm_re, REG_EXTENDED);
if (errcode != 0) {
char error[100];
regerror (errcode, &flags_hvm_rec, error, sizeof error);
regerror (errcode, &flags_hvm_rec, error, sizeof(error));
regfree (&flags_hvm_rec);
virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
in_init = 0;
@ -2005,7 +2005,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
errcode = regcomp (&flags_pae_rec, flags_pae_re, REG_EXTENDED);
if (errcode != 0) {
char error[100];
regerror (errcode, &flags_pae_rec, error, sizeof error);
regerror (errcode, &flags_pae_rec, error, sizeof(error));
regfree (&flags_pae_rec);
regfree (&flags_hvm_rec);
virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
@ -2015,7 +2015,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
errcode = regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED);
if (errcode != 0) {
char error[100];
regerror (errcode, &xen_cap_rec, error, sizeof error);
regerror (errcode, &xen_cap_rec, error, sizeof(error));
regfree (&xen_cap_rec);
regfree (&flags_pae_rec);
regfree (&flags_hvm_rec);
@ -2470,7 +2470,7 @@ get_cpu_flags(virConnectPtr conn, const char **hvm, int *pae, int *longmode)
*hvm = "";
if (STREQLEN((const char *)&regs.r_ebx, "AuthcAMDenti", 12)) {
if (pread(fd, &regs, sizeof (regs), 0x80000001) == sizeof (regs)) {
if (pread(fd, &regs, sizeof(regs), 0x80000001) == sizeof(regs)) {
/* Read secure virtual machine bit (bit 2 of ECX feature ID) */
if ((regs.r_ecx >> 2) & 1) {
*hvm = "svm";
@ -2479,7 +2479,7 @@ get_cpu_flags(virConnectPtr conn, const char **hvm, int *pae, int *longmode)
*pae = 1;
}
} else if (STREQLEN((const char *)&regs.r_ebx, "GenuntelineI", 12)) {
if (pread(fd, &regs, sizeof (regs), 0x00000001) == sizeof (regs)) {
if (pread(fd, &regs, sizeof(regs), 0x00000001) == sizeof(regs)) {
/* Read VMXE feature bit (bit 5 of ECX feature ID) */
if ((regs.r_ecx >> 5) & 1)
*hvm = "vmx";
@ -2591,7 +2591,7 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
* architectures and non-Linux. (XXX)
*/
if (cpuinfo) {
while (fgets (line, sizeof line, cpuinfo)) {
while (fgets (line, sizeof(line), cpuinfo)) {
if (regexec (&flags_hvm_rec, line, sizeof(subs)/sizeof(regmatch_t), subs, 0) == 0
&& subs[0].rm_so != -1) {
if (virStrncpy(hvm_type,
@ -2629,16 +2629,16 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
*/
/* Expecting one line in this file - ignore any more. */
if ((capabilities) && (fgets (line, sizeof line, capabilities))) {
if ((capabilities) && (fgets (line, sizeof(line), capabilities))) {
/* Split the line into tokens. strtok_r is OK here because we "own"
* this buffer. Parse out the features from each token.
*/
for (str = line, nr_guest_archs = 0;
nr_guest_archs < sizeof guest_archs / sizeof guest_archs[0]
nr_guest_archs < sizeof(guest_archs) / sizeof(guest_archs[0])
&& (token = strtok_r (str, " ", &saveptr)) != NULL;
str = NULL) {
if (regexec (&xen_cap_rec, token, sizeof subs / sizeof subs[0],
if (regexec (&xen_cap_rec, token, sizeof(subs) / sizeof(subs[0]),
subs, 0) == 0) {
int hvm = STRPREFIX(&token[subs[1].rm_so], "hvm");
const char *model;

View File

@ -671,7 +671,7 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port)
memset(&priv->addr, 0, sizeof(priv->addr));
/* http://people.redhat.com/drepper/userapi-ipv6.html */
memset (&hints, 0, sizeof hints);
memset (&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_ADDRCONFIG;
@ -3249,7 +3249,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
return -1;
}
if (uriptr->port)
snprintf (port, sizeof port, "%d", uriptr->port);
snprintf (port, sizeof(port), "%d", uriptr->port);
virURIFree (uriptr);
}
else if ((p = strrchr (uri, ':')) != NULL) { /* "hostname:port" */
@ -3260,7 +3260,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
"%s", _("xenDaemonDomainMigrate: invalid port number"));
return -1;
}
snprintf (port, sizeof port, "%d", port_nr);
snprintf (port, sizeof(port), "%d", port_nr);
/* Get the hostname. */
n = p - uri; /* n = Length of hostname in bytes. */

View File

@ -60,7 +60,7 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
virConnectCredential cred;
char *prompt;
memset(&cred, 0, sizeof (virConnectCredential));
memset(&cred, 0, sizeof(virConnectCredential));
if (virAsprintf(&prompt, "Enter %s password for %s", username,
hostname) < 0) {

View File

@ -39,7 +39,7 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
if (virtTestLoadFile(sexpr, &sexprData) < 0)
goto fail;
memset(&priv, 0, sizeof priv);
memset(&priv, 0, sizeof(priv));
/* Many puppies died to bring you this code. */
priv.xendConfigVersion = xendConfigVersion;
priv.caps = caps;

View File

@ -54,7 +54,7 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
int i;
int ret = -1;
memset(&hints, 0, sizeof hints);
memset(&hints, 0, sizeof(hints));
*hasIPv4 = *hasIPv6 = false;
*freePort = 0;

View File

@ -1485,7 +1485,7 @@ cmdDomblkstat (vshControl *ctl, const vshCmd *cmd)
last_error = NULL;
if (virDomainBlockStats(dom, device, &stats,
sizeof stats) == -1) {
sizeof(stats)) == -1) {
vshError(ctl, _("Failed to get block stats %s %s"),
name, device);
goto cleanup;
@ -1597,7 +1597,7 @@ cmdDomIfstat (vshControl *ctl, const vshCmd *cmd)
return false;
}
if (virDomainInterfaceStats (dom, device, &stats, sizeof stats) == -1) {
if (virDomainInterfaceStats (dom, device, &stats, sizeof(stats)) == -1) {
vshError(ctl, _("Failed to get interface stats %s %s"), name, device);
virDomainFree(dom);
return false;
@ -4578,7 +4578,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
has_managed_save ? _("yes") : _("no"));
/* Security model and label information */
memset(&secmodel, 0, sizeof secmodel);
memset(&secmodel, 0, sizeof(secmodel));
if (virNodeGetSecurityModel(ctl->conn, &secmodel) == -1) {
if (last_error->code != VIR_ERR_NO_SUPPORT) {
virDomainFree(dom);
@ -13045,7 +13045,7 @@ cmdNodeListDevices (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
virNodeDeviceFree(dev);
}
for (i = 0 ; i < num_devices ; i++) {
memset(indentBuf, '\0', sizeof indentBuf);
memset(indentBuf, '\0', sizeof(indentBuf));
if (parents[i] == NULL)
cmdNodeListDevicesPrint(ctl,
devices,
@ -16501,7 +16501,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
if (tree) {
char indentBuf[INDENT_BUFLEN];
for (i = 0 ; i < actual ; i++) {
memset(indentBuf, '\0', sizeof indentBuf);
memset(indentBuf, '\0', sizeof(indentBuf));
if (ctl->useSnapshotOld ? STREQ(names[i], from) : !parents[i])
cmdNodeListDevicesPrint(ctl,
names,
@ -19615,7 +19615,7 @@ vshReadlineDeinit (vshControl *ctl)
if (mkdir(ctl->historydir, 0755) < 0 && errno != EEXIST) {
char ebuf[1024];
vshError(ctl, _("Failed to create '%s': %s"),
ctl->historydir, virStrerror(errno, ebuf, sizeof ebuf));
ctl->historydir, virStrerror(errno, ebuf, sizeof(ebuf)));
} else
write_history(ctl->historyfile);
}
@ -19653,7 +19653,7 @@ vshReadline (vshControl *ctl, const char *prompt)
int len;
fputs (prompt, stdout);
r = fgets (line, sizeof line, stdin);
r = fgets (line, sizeof(line), stdin);
if (r == NULL) return NULL; /* EOF */
/* Chomp trailing \n */