Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/util/iohelper.c | 2 +-
src/util/viralloc.h | 12 +++++-----
src/util/virarptable.c | 2 +-
src/util/viratomic.h | 14 ++++++------
src/util/virbitmap.c | 4 ++--
src/util/virbuffer.c | 2 +-
src/util/vircgroup.c | 10 ++++-----
src/util/vircommand.c | 4 ++--
src/util/virdnsmasq.c | 2 +-
src/util/virfdstream.c | 6 ++---
src/util/virfile.c | 46 +++++++++++++++++++--------------------
src/util/virfirmware.c | 4 ++--
src/util/virhostcpu.c | 2 +-
src/util/virhostmem.c | 8 +++----
src/util/viridentity.c | 2 +-
src/util/virjson.c | 4 ++--
src/util/virlog.c | 8 +++----
src/util/virmacaddr.c | 2 +-
src/util/virmacmap.c | 2 +-
src/util/virnetdev.c | 4 ++--
src/util/virnetdevtap.c | 2 +-
src/util/virobject.c | 2 +-
src/util/virpidfile.c | 6 ++---
src/util/virpolkit.c | 4 ++--
src/util/virprocess.c | 26 +++++++++++-----------
src/util/virresctrl.c | 4 ++--
src/util/virsexpr.c | 8 +++----
src/util/virstoragefile.c | 8 +++----
src/util/virstring.c | 14 ++++++------
src/util/virsysinfo.c | 2 +-
src/util/virsystemd.c | 4 ++--
src/util/virthreadjob.c | 4 ++--
src/util/virthreadpool.c | 4 ++--
src/util/virtime.c | 4 ++--
src/util/virutil.c | 26 +++++++++++-----------
src/util/virutil.h | 6 ++---
src/util/virxml.c | 30 ++++++++++++-------------
37 files changed, 147 insertions(+), 147 deletions(-)
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index bb8a8dde694a..569366a32622 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -67,7 +67,7 @@ runIO(const char *path, int fd, int oflags)
if (VIR_ALLOC_N(buf, buflen + alignMask) < 0)
goto cleanup;
base = buf;
- buf = (char *) (((intptr_t) base + alignMask) & ~alignMask);
+ buf = (char *)(((intptr_t)base + alignMask) & ~alignMask);
#endif
switch (oflags & O_ACCMODE) {
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index 69d0f904f1e4..827cbcf93f93 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -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
@@ -551,7 +551,7 @@ void virDispose(void *ptrptr, size_t count, size_t element_size,
size_t *countpt
* integer type, all while evaluating ptr only once. This gives us
* extra compiler safety when compiling under gcc.
*/
-# define VIR_FREE(ptr) virFree(1 ? (void *) &(ptr) : (ptr))
+# define VIR_FREE(ptr) virFree(1 ? (void *)&(ptr) : (ptr))
/**
@@ -564,7 +564,7 @@ void virDispose(void *ptrptr, size_t count, size_t element_size,
size_t *countpt
*
* This macro is safe to use on arguments with side effects.
*/
-# define VIR_DISPOSE_N(ptr, count) virDispose(1 ? (void *) &(ptr) : (ptr), 0, \
+# define VIR_DISPOSE_N(ptr, count) virDispose(1 ? (void *)&(ptr) : (ptr), 0, \
sizeof(*(ptr)), &(count))
@@ -576,7 +576,7 @@ void virDispose(void *ptrptr, size_t count, size_t element_size,
size_t *countpt
*
* This macro is not safe to be used on arguments with side effects.
*/
-# define VIR_DISPOSE_STRING(ptr) virDispose(1 ? (void *) &(ptr) : (ptr), \
+# define VIR_DISPOSE_STRING(ptr) virDispose(1 ? (void *)&(ptr) : (ptr), \
(ptr) ? strlen((ptr)) : 0, 1, NULL)
@@ -588,7 +588,7 @@ void virDispose(void *ptrptr, size_t count, size_t element_size,
size_t *countpt
*
* This macro is safe to be used on arguments with side effects.
*/
-# define VIR_DISPOSE(ptr) virDispose(1 ? (void *) &(ptr) : (ptr), 1, \
+# define VIR_DISPOSE(ptr) virDispose(1 ? (void *)&(ptr) : (ptr), 1, \
sizeof(*(ptr)), NULL)
diff --git a/src/util/virarptable.c b/src/util/virarptable.c
index c0e90dc4bbf6..8bb7467f6563 100644
--- a/src/util/virarptable.c
+++ b/src/util/virarptable.c
@@ -51,7 +51,7 @@ VIR_LOG_INIT("util.arptable");
static int
parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len)
{
- memset(tb, 0, sizeof(struct rtattr *) * (max + 1));
+ memset(tb, 0, sizeof(struct rtattr *)* (max + 1));
VIR_WARNINGS_NO_CAST_ALIGN
for (; RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
VIR_WARNINGS_RESET
diff --git a/src/util/viratomic.h b/src/util/viratomic.h
index febe401f7704..54fb85e6848e 100644
--- a/src/util/viratomic.h
+++ b/src/util/viratomic.h
@@ -193,25 +193,25 @@ VIR_STATIC unsigned int virAtomicIntXor(volatile unsigned int
*atomic,
(__extension__ ({ \
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
(void)(0 ? *(atomic) ^ (val) : 0); \
- (int) __sync_fetch_and_add((atomic), (val)); \
+ (int)__sync_fetch_and_add((atomic), (val)); \
}))
# define virAtomicIntAnd(atomic, val) \
(__extension__ ({ \
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
- (void) (0 ? *(atomic) ^ (val) : 0); \
- (unsigned int) __sync_fetch_and_and((atomic), (val)); \
+ (void)(0 ? *(atomic) ^ (val) : 0); \
+ (unsigned int)__sync_fetch_and_and((atomic), (val)); \
}))
# define virAtomicIntOr(atomic, val) \
(__extension__ ({ \
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
- (void) (0 ? *(atomic) ^ (val) : 0); \
- (unsigned int) __sync_fetch_and_or((atomic), (val)); \
+ (void)(0 ? *(atomic) ^ (val) : 0); \
+ (unsigned int)__sync_fetch_and_or((atomic), (val)); \
}))
# define virAtomicIntXor(atomic, val) \
(__extension__ ({ \
(void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
- (void) (0 ? *(atomic) ^ (val) : 0); \
- (unsigned int) __sync_fetch_and_xor((atomic), (val)); \
+ (void)(0 ? *(atomic) ^ (val) : 0); \
+ (unsigned int)__sync_fetch_and_xor((atomic), (val)); \
}))
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 0cc5292d8c4e..5aa9a75dcfcf 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -53,7 +53,7 @@ struct _virBitmap {
};
-#define VIR_BITMAP_BITS_PER_UNIT ((int) sizeof(unsigned long) * CHAR_BIT)
+#define VIR_BITMAP_BITS_PER_UNIT ((int)sizeof(unsigned long)* CHAR_BIT)
#define VIR_BITMAP_UNIT_OFFSET(b) ((b) / VIR_BITMAP_BITS_PER_UNIT)
#define VIR_BITMAP_BIT_OFFSET(b) ((b) % VIR_BITMAP_BITS_PER_UNIT)
#define VIR_BITMAP_BIT(b) (1UL << VIR_BITMAP_BIT_OFFSET(b))
@@ -777,7 +777,7 @@ virBitmapNewData(const void *data,
j = 0;
p++;
}
- *p |= (unsigned long) bytes[i] << (j * CHAR_BIT);
+ *p |= (unsigned long)bytes[i] << (j * CHAR_BIT);
}
return bitmap;
diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index 3d6defb73a6f..6cc3f6cc27e6 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -781,7 +781,7 @@ virBufferURIEncodeString(virBufferPtr buf, const char *str)
if (c_isalnum(*p)) {
buf->content[buf->use++] = *p;
} else {
- uc = (unsigned char) *p;
+ uc = (unsigned char)*p;
buf->content[buf->use++] = '%';
buf->content[buf->use++] = hex[uc >> 4];
buf->content[buf->use++] = hex[uc & 0xf];
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 0a31947b0d54..32269993ef6e 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -550,13 +550,13 @@ virCgroupDetectPlacement(virCgroupPtr group,
char *procfile;
VIR_DEBUG("Detecting placement for pid %lld path %s",
- (long long) pid, path);
+ (long long)pid, path);
if (pid == -1) {
if (VIR_STRDUP(procfile, "/proc/self/cgroup") < 0)
goto cleanup;
} else {
if (virAsprintf(&procfile, "/proc/%lld/cgroup",
- (long long) pid) < 0)
+ (long long)pid) < 0)
goto cleanup;
}
@@ -744,7 +744,7 @@ virCgroupDetect(virCgroupPtr group,
virCgroupControllerTypeToString(i),
group->controllers[i].mountPoint,
group->controllers[i].placement,
- (long long) pid);
+ (long long)pid);
}
return 0;
@@ -1155,7 +1155,7 @@ virCgroupNew(pid_t pid,
virCgroupPtr *group)
{
VIR_DEBUG("pid=%lld path=%s parent=%p controllers=%d group=%p",
- (long long) pid, path, parent, controllers, group);
+ (long long)pid, path, parent, controllers, group);
*group = NULL;
if (VIR_ALLOC((*group)) < 0)
@@ -2581,7 +2581,7 @@ virCgroupGetMemoryUsage(virCgroupPtr group, unsigned long *kb)
VIR_CGROUP_CONTROLLER_MEMORY,
"memory.usage_in_bytes", &usage_in_bytes);
if (ret == 0)
- *kb = (unsigned long) usage_in_bytes >> 10;
+ *kb = (unsigned long)usage_in_bytes >> 10;
return ret;
}
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 6dab105f568d..889d578c00bc 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -2320,7 +2320,7 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
ret = -1;
str = (exitstatus ? virProcessTranslateStatus(*exitstatus)
- : (char *) "status 0");
+ : (char *)"status 0");
VIR_DEBUG("Result %s, stdout: '%s' stderr: '%s'",
NULLSTR(str),
cmd->outbuf ? NULLSTR(*cmd->outbuf) : "(null)",
@@ -2428,7 +2428,7 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
if (cmd->pid != -1) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("command is already running as pid %lld"),
- (long long) cmd->pid);
+ (long long)cmd->pid);
goto cleanup;
}
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 492dcadc96a9..5d56bb5feff5 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -700,7 +700,7 @@ dnsmasqCapsSetFromBuffer(dnsmasqCapsPtr caps, const char *buf)
p = strchrnul(buf, '\n');
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse %s version number in '%.*s'"),
- caps->binaryPath, (int) (p - buf), buf);
+ caps->binaryPath, (int)(p - buf), buf);
return -1;
}
diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c
index e4973a2bd015..681b1b61db70 100644
--- a/src/util/virfdstream.c
+++ b/src/util/virfdstream.c
@@ -461,7 +461,7 @@ virFDStreamThreadDoRead(virFDStreamDataPtr fdst,
/* HACK: The message queue is one directional. So caller
* cannot make us skip the hole. Do that for them instead. */
if (sectionLen &&
- lseek(fdin, sectionLen, SEEK_CUR) == (off_t) -1) {
+ lseek(fdin, sectionLen, SEEK_CUR) == (off_t)-1) {
virReportSystemError(errno,
_("unable to seek in %s"),
fdinname);
@@ -541,7 +541,7 @@ virFDStreamThreadDoWrite(virFDStreamDataPtr fdst,
got = msg->stream.hole.len;
off = lseek(fdout, got, SEEK_CUR);
- if (off == (off_t) -1) {
+ if (off == (off_t)-1) {
virReportSystemError(errno,
_("unable to seek in %s"),
fdoutname);
@@ -1001,7 +1001,7 @@ virFDStreamSendHole(virStreamPtr st,
}
} else {
off = lseek(fdst->fd, length, SEEK_CUR);
- if (off == (off_t) -1) {
+ if (off == (off_t)-1) {
virReportSystemError(errno, "%s",
_("unable to seek"));
goto cleanup;
diff --git a/src/util/virfile.c b/src/util/virfile.c
index e12a584ca1c5..fb38c437ce70 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -2153,8 +2153,8 @@ virFileOpenForceOwnerMode(const char *path, int fd, mode_t mode,
ret = -errno;
virReportSystemError(errno,
_("cannot chown '%s' to (%u, %u)"),
- path, (unsigned int) uid,
- (unsigned int) gid);
+ path, (unsigned int)uid,
+ (unsigned int)gid);
return ret;
}
if ((flags & VIR_FILE_OPEN_FORCE_MODE) &&
@@ -2360,9 +2360,9 @@ virFileOpenAs(const char *path, int openflags, mode_t mode,
bool created = false;
/* allow using -1 to mean "current value" */
- if (uid == (uid_t) -1)
+ if (uid == (uid_t)-1)
uid = geteuid();
- if (gid == (gid_t) -1)
+ if (gid == (gid_t)-1)
gid = getegid();
/* treat absence of both flags as presence of both for simpler
@@ -2447,7 +2447,7 @@ virFileRemoveNeedsSetuid(const char *path, uid_t uid, gid_t gid)
return false;
/* uid/gid weren't specified */
- if ((uid == (uid_t) -1) && (gid == (gid_t) -1))
+ if ((uid == (uid_t)-1) && (gid == (gid_t)-1))
return false;
/* already running as proper uid/gid */
@@ -2496,9 +2496,9 @@ virFileRemove(const char *path,
* to run under the uid/gid that created the volume in order to
* perform the unlink of the volume.
*/
- if (uid == (uid_t) -1)
+ if (uid == (uid_t)-1)
uid = geteuid();
- if (gid == (gid_t) -1)
+ if (gid == (gid_t)-1)
gid = getegid();
ngroups = virGetGroupList(uid, gid, &groups);
@@ -2599,15 +2599,15 @@ virDirCreateNoFork(const char *path,
virReportSystemError(errno, _("stat of '%s' failed"), path);
goto error;
}
- if (((uid != (uid_t) -1 && st.st_uid != uid) ||
- (gid != (gid_t) -1 && st.st_gid != gid))
+ if (((uid != (uid_t)-1 && st.st_uid != uid) ||
+ (gid != (gid_t)-1 && st.st_gid != gid))
&& (chown(path, uid, gid) < 0)) {
ret = -errno;
virReportSystemError(errno, _("cannot chown '%s' to (%u,
%u)"),
- path, (unsigned int) uid, (unsigned int) gid);
+ path, (unsigned int)uid, (unsigned int)gid);
goto error;
}
- if (mode != (mode_t) -1 && chmod(path, mode) < 0) {
+ if (mode != (mode_t)-1 && chmod(path, mode) < 0) {
ret = -errno;
virReportSystemError(errno,
_("cannot set mode of '%s' to %04o"),
@@ -2667,14 +2667,14 @@ virDirCreate(const char *path,
*/
if ((!(flags & VIR_DIR_CREATE_AS_UID))
|| (geteuid() != 0)
- || ((uid == (uid_t) -1) && (gid == (gid_t) -1))
+ || ((uid == (uid_t)-1) && (gid == (gid_t)-1))
|| ((flags & VIR_DIR_CREATE_ALLOW_EXIST) && virFileExists(path))) {
return virDirCreateNoFork(path, mode, uid, gid, flags);
}
- if (uid == (uid_t) -1)
+ if (uid == (uid_t)-1)
uid = geteuid();
- if (gid == (gid_t) -1)
+ if (gid == (gid_t)-1)
gid = getegid();
ngroups = virGetGroupList(uid, gid, &groups);
@@ -2748,15 +2748,15 @@ virDirCreate(const char *path,
goto childerror;
}
- if ((st.st_gid != gid) && (chown(path, (uid_t) -1, gid) < 0)) {
+ if ((st.st_gid != gid) && (chown(path, (uid_t)-1, gid) < 0)) {
ret = errno;
virReportSystemError(errno,
_("cannot chown '%s' to group %u"),
- path, (unsigned int) gid);
+ path, (unsigned int)gid);
goto childerror;
}
- if (mode != (mode_t) -1 && chmod(path, mode) < 0) {
+ if (mode != (mode_t)-1 && chmod(path, mode) < 0) {
virReportSystemError(errno,
_("cannot set mode of '%s' to %04o"),
path, mode);
@@ -3869,7 +3869,7 @@ virFileInData(int fd,
/* Get current position */
cur = lseek(fd, 0, SEEK_CUR);
- if (cur == (off_t) -1) {
+ if (cur == (off_t)-1) {
virReportSystemError(errno, "%s",
_("Unable to get current position in file"));
goto cleanup;
@@ -3885,7 +3885,7 @@ virFileInData(int fd,
* 4) data < 0, errno != ENXIO; we learned nothing
*/
- if (data == (off_t) -1) {
+ if (data == (off_t)-1) {
/* cases 3 and 4 */
if (errno != ENXIO) {
virReportSystemError(errno, "%s",
@@ -3898,7 +3898,7 @@ virFileInData(int fd,
* implicit hole at EOF. However, there might be a
* trailing hole just before EOF too. If that's the case
* report it. */
- if ((end = lseek(fd, 0, SEEK_END)) == (off_t) -1) {
+ if ((end = lseek(fd, 0, SEEK_END)) == (off_t)-1) {
virReportSystemError(errno, "%s",
_("Unable to seek to EOF"));
goto cleanup;
@@ -3916,7 +3916,7 @@ virFileInData(int fd,
* find out. Here we get the same 4 possibilities as
* described above.*/
hole = lseek(fd, data, SEEK_HOLE);
- if (hole == (off_t) -1 || hole == data) {
+ if (hole == (off_t)-1 || hole == data) {
/* cases 1, 3 and 4 */
/* Wait a second. The reason why we are here is
* because we are in data. But at the same time we
@@ -3934,8 +3934,8 @@ virFileInData(int fd,
ret = 0;
cleanup:
/* At any rate, reposition back to where we started. */
- if (cur != (off_t) -1 &&
- lseek(fd, cur, SEEK_SET) == (off_t) -1) {
+ if (cur != (off_t)-1 &&
+ lseek(fd, cur, SEEK_SET) == (off_t)-1) {
virReportSystemError(errno, "%s",
_("unable to restore position in file"));
ret = -1;
diff --git a/src/util/virfirmware.c b/src/util/virfirmware.c
index 86f8b684d6c1..804b68895216 100644
--- a/src/util/virfirmware.c
+++ b/src/util/virfirmware.c
@@ -67,9 +67,9 @@ virFirmwareParse(const char *str, virFirmwarePtr firmware)
goto cleanup;
if (token[0]) {
- virSkipSpaces((const char **) &token[0]);
+ virSkipSpaces((const char **)&token[0]);
if (token[1])
- virSkipSpaces((const char **) &token[1]);
+ virSkipSpaces((const char **)&token[1]);
}
/* Exactly two tokens are expected */
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 013c95bb5621..32ae53d17153 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -151,7 +151,7 @@ virHostCPUGetStatsFreeBSD(int cpuNum,
offset = cpu_times_num * CPUSTATES;
}
- cpu_times_size = sizeof(long) * cpu_times_num * CPUSTATES;
+ cpu_times_size = sizeof(long)* cpu_times_num * CPUSTATES;
if (VIR_ALLOC_N(cpu_times, cpu_times_num * CPUSTATES) < 0)
goto cleanup;
diff --git a/src/util/virhostmem.c b/src/util/virhostmem.c
index c923a1edf53d..8d83f5678732 100644
--- a/src/util/virhostmem.c
+++ b/src/util/virhostmem.c
@@ -660,7 +660,7 @@ virHostMemGetInfoFake(unsigned long long *mem,
goto cleanup;
}
- *mem = (unsigned long long) total;
+ *mem = (unsigned long long)total;
}
if (freeMem) {
@@ -672,7 +672,7 @@ virHostMemGetInfoFake(unsigned long long *mem,
goto cleanup;
}
- *freeMem = (unsigned long long) avail;
+ *freeMem = (unsigned long long)avail;
}
ret = 0;
@@ -778,7 +778,7 @@ virHostMemGetFreePages(unsigned int npages,
goto cleanup;
}
- lastCell = MIN(lastCell, startCell + (int) cellCount - 1);
+ lastCell = MIN(lastCell, startCell + (int)cellCount - 1);
for (cell = startCell; cell <= lastCell; cell++) {
for (i = 0; i < npages; i++) {
@@ -825,7 +825,7 @@ virHostMemAllocPages(unsigned int npages,
goto cleanup;
}
- lastCell = MIN(lastCell, startCell + (int) cellCount - 1);
+ lastCell = MIN(lastCell, startCell + (int)cellCount - 1);
for (cell = startCell; cell <= lastCell; cell++) {
for (i = 0; i < npages; i++) {
diff --git a/src/util/viridentity.c b/src/util/viridentity.c
index 2f4307bc8284..c63be3eeecbb 100644
--- a/src/util/viridentity.c
+++ b/src/util/viridentity.c
@@ -502,7 +502,7 @@ int virIdentitySetUNIXProcessID(virIdentityPtr ident,
{
char *val;
int ret;
- if (virAsprintf(&val, "%lld", (long long) pid) < 0)
+ if (virAsprintf(&val, "%lld", (long long)pid) < 0)
return -1;
ret = virIdentitySetAttr(ident,
VIR_IDENTITY_ATTR_UNIX_PROCESS_ID,
diff --git a/src/util/virjson.c b/src/util/virjson.c
index dfe00d9280da..5db235ab6ad9 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -398,7 +398,7 @@ virJSONValueFree(virJSONValuePtr value)
if (!value || value->protect)
return;
- switch ((virJSONType) value->type) {
+ switch ((virJSONType)value->type) {
case VIR_JSON_TYPE_OBJECT:
for (i = 0; i < value->data.object.npairs; i++) {
VIR_FREE(value->data.object.pairs[i].key);
@@ -1463,7 +1463,7 @@ virJSONValueCopy(const virJSONValue *in)
if (!in)
return NULL;
- switch ((virJSONType) in->type) {
+ switch ((virJSONType)in->type) {
case VIR_JSON_TYPE_OBJECT:
out = virJSONValueNewObject();
if (!out)
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 81a9dc4395c2..1195d0479d82 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -752,7 +752,7 @@ virLogOutputToFd(virLogSourcePtr source ATTRIBUTE_UNUSED,
const char *str,
void *data)
{
- int fd = (intptr_t) data;
+ int fd = (intptr_t)data;
char *msg;
if (fd < 0)
@@ -772,7 +772,7 @@ virLogOutputToFd(virLogSourcePtr source ATTRIBUTE_UNUSED,
static void
virLogCloseFd(void *data)
{
- int fd = (intptr_t) data;
+ int fd = (intptr_t)data;
VIR_LOG_CLOSE(fd);
}
@@ -1008,7 +1008,7 @@ virLogOutputToJournald(virLogSourcePtr source,
{
virCheckFlags(VIR_LOG_STACK_TRACE,);
int buffd = -1;
- int journalfd = (intptr_t) data;
+ int journalfd = (intptr_t)data;
struct msghdr mh;
struct sockaddr_un sa;
union {
@@ -1129,7 +1129,7 @@ virLogNewOutputToJournald(int priority)
}
if (!(ret = virLogOutputNew(virLogOutputToJournald, virLogCloseFd,
- (void *)(intptr_t) journalfd, priority,
+ (void *)(intptr_t)journalfd, priority,
VIR_LOG_TO_JOURNALD, NULL))) {
VIR_LOG_CLOSE(journalfd);
return NULL;
diff --git a/src/util/virmacaddr.c b/src/util/virmacaddr.c
index 7afe032b9c83..2c3101c8a00e 100644
--- a/src/util/virmacaddr.c
+++ b/src/util/virmacaddr.c
@@ -167,7 +167,7 @@ virMacAddrParse(const char* str, virMacAddrPtr addr)
(0xFF < result))
break;
- addr->addr[i] = (unsigned char) result;
+ addr->addr[i] = (unsigned char)result;
if ((i == 5) && (*end_ptr <= ' '))
return 0;
diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c
index 88ca9b3f36ae..9f1c7d6811c5 100644
--- a/src/util/virmacmap.c
+++ b/src/util/virmacmap.c
@@ -98,7 +98,7 @@ virMacMapAddLocked(virMacMapPtr mgr,
goto cleanup;
}
- if (!(newMacsList = virStringListAdd((const char **) macsList, mac)) ||
+ if (!(newMacsList = virStringListAdd((const char **)macsList, mac)) ||
virHashUpdateEntry(mgr->macs, domain, newMacsList) < 0)
goto cleanup;
newMacsList = NULL;
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index b250af9e2c10..1c1f625aeb75 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -534,7 +534,7 @@ int virNetDevSetNamespace(const char *ifname, pid_t pidInNs)
char *phy_path = NULL;
int len;
- if (virAsprintf(&pid, "%lld", (long long) pidInNs) == -1)
+ if (virAsprintf(&pid, "%lld", (long long)pidInNs) == -1)
return -1;
/* The 802.11 wireless devices only move together with their PHY. */
@@ -3448,7 +3448,7 @@ int virNetDevSetCoalesce(const char *ifname,
if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
return -1;
- ifr.ifr_data = (void *) &coal;
+ ifr.ifr_data = (void *)&coal;
if (virNetDevSendEthtoolIoctl(fd, &ifr) < 0) {
virReportSystemError(errno,
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index bd0710ad2e45..215e07b4191c 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -198,7 +198,7 @@ virNetDevProbeVnetHdr(int tapfd)
return 1;
# else
- (void) tapfd;
+ (void)tapfd;
VIR_INFO("Not enabling IFF_VNET_HDR; disabled at build time");
return 0;
# endif
diff --git a/src/util/virobject.c b/src/util/virobject.c
index 9fb0328d5879..ebfe753843d9 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -606,7 +606,7 @@ virObjectListFree(void *list)
if (!list)
return;
- for (next = (void **) list; *next; next++)
+ for (next = (void **)list; *next; next++)
virObjectUnref(*next);
VIR_FREE(list);
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 58ab29f77f2c..6ac2bfd08bdd 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -75,7 +75,7 @@ int virPidFileWritePath(const char *pidfile,
goto cleanup;
}
- snprintf(pidstr, sizeof(pidstr), "%lld", (long long) pid);
+ snprintf(pidstr, sizeof(pidstr), "%lld", (long long)pid);
if (safewrite(fd, pidstr, strlen(pidstr)) < 0) {
rc = -errno;
@@ -150,7 +150,7 @@ int virPidFileReadPath(const char *path,
if (virStrToLong_ll(pidstr, &endptr, 10, &pid_value) < 0 ||
!(*endptr == '\0' || c_isspace(*endptr)) ||
- (pid_t) pid_value != pid_value) {
+ (pid_t)pid_value != pid_value) {
rc = -1;
goto cleanup;
}
@@ -444,7 +444,7 @@ int virPidFileAcquirePath(const char *path,
/* Someone else must be racing with us, so try again */
}
- snprintf(pidstr, sizeof(pidstr), "%lld", (long long) pid);
+ snprintf(pidstr, sizeof(pidstr), "%lld", (long long)pid);
if (safewrite(fd, pidstr, strlen(pidstr)) < 0) {
virReportSystemError(errno,
diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c
index 198439cea291..717de12bc90a 100644
--- a/src/util/virpolkit.c
+++ b/src/util/virpolkit.c
@@ -75,7 +75,7 @@ int virPolkitCheckAuth(const char *actionid,
goto cleanup;
VIR_INFO("Checking PID %lld running as %d",
- (long long) pid, uid);
+ (long long)pid, uid);
if (virDBusCallMethod(sysbus,
&reply,
@@ -179,7 +179,7 @@ virPolkitAgentCreate(void)
agent->cmd = virCommandNewArgList(PKTTYAGENT, "--process", NULL);
- virCommandAddArgFormat(agent->cmd, "%lld", (long long int) getpid());
+ virCommandAddArgFormat(agent->cmd, "%lld", (long long int)getpid());
virCommandAddArg(agent->cmd, "--notify-fd");
virCommandAddArgFormat(agent->cmd, "%d", pipe_fd[1]);
virCommandAddArg(agent->cmd, "--fallback");
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 1fbbbb3a279f..899c39d97b76 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -196,7 +196,7 @@ virProcessAbort(pid_t pid)
}
}
}
- VIR_DEBUG("failed to reap child %lld, abandoning it", (long long) pid);
+ VIR_DEBUG("failed to reap child %lld, abandoning it", (long long)pid);
cleanup:
VIR_FREE(tmp);
@@ -242,7 +242,7 @@ virProcessWait(pid_t pid, int *exitstatus, bool raw)
if (pid <= 0) {
if (pid != -1)
virReportSystemError(EINVAL, _("unable to wait for process %lld"),
- (long long) pid);
+ (long long)pid);
return -1;
}
@@ -252,7 +252,7 @@ virProcessWait(pid_t pid, int *exitstatus, bool raw)
if (ret == -1) {
virReportSystemError(errno, _("unable to wait for process %lld"),
- (long long) pid);
+ (long long)pid);
return -1;
}
@@ -274,7 +274,7 @@ virProcessWait(pid_t pid, int *exitstatus, bool raw)
char *st = virProcessTranslateStatus(status);
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Child process (%lld) unexpected %s"),
- (long long) pid, NULLSTR(st));
+ (long long)pid, NULLSTR(st));
VIR_FREE(st);
}
return -1;
@@ -611,7 +611,7 @@ int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids)
*npids = 0;
*pids = NULL;
- if (virAsprintf(&taskPath, "/proc/%llu/task", (long long) pid) < 0)
+ if (virAsprintf(&taskPath, "/proc/%llu/task", (long long)pid) < 0)
goto cleanup;
if (virDirOpen(&dir, taskPath) < 0)
@@ -659,7 +659,7 @@ int virProcessGetNamespaces(pid_t pid,
int fd;
if (virAsprintf(&nsfile, "/proc/%llu/ns/%s",
- (long long) pid,
+ (long long)pid,
ns[i]) < 0)
goto cleanup;
@@ -774,7 +774,7 @@ virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes)
}
VIR_DEBUG("Locked memory for process %lld limited to %llu bytes",
- (long long int) pid, bytes);
+ (long long int)pid, bytes);
return 0;
}
@@ -812,7 +812,7 @@ virProcessGetMaxMemLock(pid_t pid,
virReportSystemError(errno,
_("cannot get locked memory limit "
"of process %lld"),
- (long long int) pid);
+ (long long int)pid);
return -1;
}
}
@@ -984,7 +984,7 @@ int virProcessGetStartTime(pid_t pid,
int len;
char **tokens = NULL;
- if (virAsprintf(&filename, "/proc/%llu/stat", (long long) pid) < 0)
+ if (virAsprintf(&filename, "/proc/%llu/stat", (long long)pid) < 0)
return -1;
if ((len = virFileReadAll(filename, 1024, &buf)) < 0)
@@ -1067,7 +1067,7 @@ int virProcessGetStartTime(pid_t pid,
static int warned;
if (virAtomicIntInc(&warned) == 1) {
VIR_WARN("Process start time of pid %lld not available on this
platform",
- (long long) pid);
+ (long long)pid);
}
*timestamp = 0;
return 0;
@@ -1084,7 +1084,7 @@ static int virProcessNamespaceHelper(int errfd,
int fd = -1;
int ret = -1;
- if (virAsprintf(&path, "/proc/%lld/ns/mnt", (long long) pid) < 0)
+ if (virAsprintf(&path, "/proc/%lld/ns/mnt", (long long)pid) < 0)
goto cleanup;
if ((fd = open(path, O_RDONLY)) < 0) {
@@ -1359,7 +1359,7 @@ virProcessSetScheduler(pid_t pid,
int pol = virProcessSchedTranslatePolicy(policy);
VIR_DEBUG("pid=%lld, policy=%d, priority=%u",
- (long long) pid, policy, priority);
+ (long long)pid, policy, priority);
if (!policy)
return 0;
@@ -1402,7 +1402,7 @@ virProcessSetScheduler(pid_t pid,
if (sched_setscheduler(pid, pol, ¶m) < 0) {
virReportSystemError(errno,
_("Cannot set scheduler parameters for pid
%lld"),
- (long long) pid);
+ (long long)pid);
return -1;
}
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index fc1163508ac1..16d6eadf46bb 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -972,7 +972,7 @@ virResctrlAllocParseProcessLine(virResctrlInfoPtr resctrl,
int ret = -1;
/* For no reason there can be spaces */
- virSkipSpaces((const char **) &line);
+ virSkipSpaces((const char **)&line);
/* Skip lines that don't concern caches, e.g. MB: etc. */
if (line[0] != 'L')
@@ -1612,7 +1612,7 @@ virResctrlAllocAddPID(virResctrlAllocPtr alloc,
if (virAsprintf(&tasks, "%s/tasks", alloc->path) < 0)
return -1;
- if (virAsprintf(&pidstr, "%lld", (long long int) pid) < 0)
+ if (virAsprintf(&pidstr, "%lld", (long long int)pid) < 0)
goto cleanup;
if (virFileWriteStr(tasks, pidstr, 0) < 0) {
diff --git a/src/util/virsexpr.c b/src/util/virsexpr.c
index 885c382a5f3f..18c0787d2734 100644
--- a/src/util/virsexpr.c
+++ b/src/util/virsexpr.c
@@ -141,8 +141,8 @@ sexpr_cons(const struct sexpr *car, const struct sexpr *cdr)
if (ret == NULL)
return ret;
ret->kind = SEXPR_CONS;
- ret->u.s.car = (struct sexpr *) car;
- ret->u.s.cdr = (struct sexpr *) cdr;
+ ret->u.s.car = (struct sexpr *)car;
+ ret->u.s.cdr = (struct sexpr *)cdr;
return ret;
}
@@ -166,7 +166,7 @@ append(struct sexpr *lst, const struct sexpr *value)
lst = lst->u.s.cdr;
lst->kind = SEXPR_CONS;
- lst->u.s.car = (struct sexpr *) value;
+ lst->u.s.car = (struct sexpr *)value;
lst->u.s.cdr = nil;
return 0;
@@ -421,7 +421,7 @@ sexpr_lookup_key(const struct sexpr *sexpr, const char *node)
if (token != NULL)
goto cleanup;
- result = (struct sexpr *) sexpr;
+ result = (struct sexpr *)sexpr;
cleanup:
VIR_FREE(buffer);
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 531540ac9184..8a623fd47e8e 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -3462,7 +3462,7 @@ virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
break;
case VIR_STORAGE_TYPE_BLOCK:
- if ((end = lseek(fd, 0, SEEK_END)) == (off_t) -1) {
+ if ((end = lseek(fd, 0, SEEK_END)) == (off_t)-1) {
virReportSystemError(errno, _("failed to seek to end of
'%s'"),
src->path);
return -1;
@@ -3768,7 +3768,7 @@ virStorageFileCanonicalizePath(const char *path,
goto cleanup;
}
- if (virHashAddEntry(cycle, currentpath, (void *) 1) < 0)
+ if (virHashAddEntry(cycle, currentpath, (void *)1) < 0)
goto cleanup;
if (linkpath[0] == '/') {
@@ -4204,12 +4204,12 @@ virStorageFileInitAs(virStorageSourcePtr src,
if (VIR_ALLOC(src->drv) < 0)
return -1;
- if (uid == (uid_t) -1)
+ if (uid == (uid_t)-1)
src->drv->uid = geteuid();
else
src->drv->uid = uid;
- if (gid == (gid_t) -1)
+ if (gid == (gid_t)-1)
src->drv->gid = getegid();
else
src->drv->gid = gid;
diff --git a/src/util/virstring.c b/src/util/virstring.c
index 15f367af7c18..7c6ab0ac93af 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -259,8 +259,8 @@ virStringListMerge(char ***dst,
if (!src || !*src)
return 0;
- dst_len = virStringListLength((const char **) *dst);
- src_len = virStringListLength((const char **) *src);
+ dst_len = virStringListLength((const char **)*dst);
+ src_len = virStringListLength((const char **)*src);
if (VIR_REALLOC_N(*dst, dst_len + src_len + 1) < 0)
return -1;
@@ -405,7 +405,7 @@ virStrToLong_i(char const *s, char **end_ptr, int base, int *result)
errno = 0;
val = strtol(s, &p, base); /* exempt from syntax-check */
- err = (errno || (!end_ptr && *p) || p == s || (int) val != val);
+ err = (errno || (!end_ptr && *p) || p == s || (int)val != val);
if (end_ptr)
*end_ptr = p;
if (err)
@@ -431,14 +431,14 @@ virStrToLong_ui(char const *s, char **end_ptr, int base, unsigned
int *result)
* UINT_MAX regardless of whether long is 32-bit or 64-bit. But
* strtoul treats "-1" as ULONG_MAX, and going from ulong back
* to uint differs depending on the size of long. */
- if (sizeof(long) > sizeof(int) && memchr(s, '-', p - s)) {
+ if (sizeof(long)> sizeof(int)&& memchr(s, '-', p - s)) {
if (-val > UINT_MAX)
err = true;
else
val &= 0xffffffff;
}
- err |= (errno || (!end_ptr && *p) || p == s || (unsigned int) val != val);
+ err |= (errno || (!end_ptr && *p) || p == s || (unsigned int)val != val);
if (end_ptr)
*end_ptr = p;
if (err)
@@ -459,7 +459,7 @@ virStrToLong_uip(char const *s, char **end_ptr, int base, unsigned int
*result)
errno = 0;
val = strtoul(s, &p, base); /* exempt from syntax-check */
err = (memchr(s, '-', p - s) ||
- errno || (!end_ptr && *p) || p == s || (unsigned int) val != val);
+ errno || (!end_ptr && *p) || p == s || (unsigned int)val != val);
if (end_ptr)
*end_ptr = p;
if (err)
@@ -1436,7 +1436,7 @@ virStringEncodeBase64(const uint8_t *buf, size_t buflen)
{
char *ret;
- base64_encode_alloc((const char *) buf, buflen, &ret);
+ base64_encode_alloc((const char *)buf, buflen, &ret);
if (!ret) {
virReportOOMError();
return NULL;
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 5795d90c7bfa..9524f84f3b2e 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -562,7 +562,7 @@ virSysinfoParseS390Processor(const char *base, virSysinfoDefPtr ret)
}
/* now, for each processor found, extract the frequency information */
- tmp_base = (char *) base;
+ tmp_base = (char *)base;
while ((tmp_base = strstr(tmp_base, "cpu number")) &&
(tmp_base = virSysinfoParseS390Line(tmp_base, "cpu number",
&ncpu))) {
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 3be963d704ea..deacdb0a58fb 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -189,7 +189,7 @@ virSystemdGetMachineNameByPID(pid_t pid)
reply = NULL;
VIR_DEBUG("Domain with pid %lld has object path '%s'",
- (long long) pid, object);
+ (long long)pid, object);
if (virDBusCallMethod(conn, &reply, NULL,
"org.freedesktop.machine1",
@@ -205,7 +205,7 @@ virSystemdGetMachineNameByPID(pid_t pid)
goto cleanup;
VIR_DEBUG("Domain with pid %lld has machine name '%s'",
- (long long) pid, name);
+ (long long)pid, name);
cleanup:
VIR_FREE(object);
diff --git a/src/util/virthreadjob.c b/src/util/virthreadjob.c
index 2f483f9d2626..d10ae260dc3c 100644
--- a/src/util/virthreadjob.c
+++ b/src/util/virthreadjob.c
@@ -69,7 +69,7 @@ virThreadJobSetWorker(const char *worker)
if (!worker || virThreadJobInitialize() < 0)
return;
- if (virThreadLocalSet(&virThreadJobWorker, (void *) worker) < 0)
+ if (virThreadLocalSet(&virThreadJobWorker, (void *)worker) < 0)
virReportSystemError(errno,
_("cannot set worker name to %s"),
worker);
@@ -86,7 +86,7 @@ virThreadJobSet(const char *caller)
if (!caller || virThreadJobInitialize() < 0)
return;
- if (virThreadLocalSet(&virThreadJobName, (void *) caller) < 0)
+ if (virThreadLocalSet(&virThreadJobName, (void *)caller) < 0)
virReportSystemError(errno,
_("cannot set current job to %s"),
caller);
diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index 10f2bd2c3a03..d92bb399b8df 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -443,7 +443,7 @@ virThreadPoolSetParameters(virThreadPoolPtr pool,
}
if (minWorkers >= 0) {
- if ((size_t) minWorkers > pool->nWorkers &&
+ if ((size_t)minWorkers > pool->nWorkers &&
virThreadPoolExpand(pool, minWorkers - pool->nWorkers,
false) < 0)
goto error;
@@ -458,7 +458,7 @@ virThreadPoolSetParameters(virThreadPoolPtr pool,
if (prioWorkers >= 0) {
if (prioWorkers < pool->nPrioWorkers) {
virCondBroadcast(&pool->prioCond);
- } else if ((size_t) prioWorkers > pool->nPrioWorkers &&
+ } else if ((size_t)prioWorkers > pool->nPrioWorkers &&
virThreadPoolExpand(pool, prioWorkers - pool->nPrioWorkers,
true) < 0) {
goto error;
diff --git a/src/util/virtime.c b/src/util/virtime.c
index 640eb5a1d12c..ad78858ed964 100644
--- a/src/util/virtime.c
+++ b/src/util/virtime.c
@@ -165,7 +165,7 @@ void virTimeFieldsThen(unsigned long long when, struct tm *fields)
fields->tm_yday = days;
ip = mon_yday[is_leap_year(y)];
- for (y = 11; days < (long int) ip[y]; --y)
+ for (y = 11; days < (long int)ip[y]; --y)
continue;
days -= ip[y];
fields->tm_mon = y;
@@ -216,7 +216,7 @@ int virTimeStringThenRaw(unsigned long long when, char *buf)
"%4d-%02d-%02d %02d:%02d:%02d.%03d+0000",
fields.tm_year, fields.tm_mon, fields.tm_mday,
fields.tm_hour, fields.tm_min, fields.tm_sec,
- (int) (when % 1000)) >= VIR_TIME_STRING_BUFLEN) {
+ (int)(when % 1000)) >= VIR_TIME_STRING_BUFLEN) {
errno = ERANGE;
return -1;
}
diff --git a/src/util/virutil.c b/src/util/virutil.c
index cd6fbf2f306a..ed6faef3f9b0 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -86,8 +86,8 @@
#include "virstring.h"
#include "virutil.h"
-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
@@ -463,7 +463,7 @@ int virEnumFromString(const char *const*types,
/**
* Format @val as a base-10 decimal number, in the
* buffer @buf of size @buflen. To allocate a suitable
- * sized buffer, the INT_BUFLEN(int) macro should be
+ * sized buffer, the INT_BUFLEN(int)macro should be
* used
*
* Returns pointer to start of the number in @buf
@@ -814,7 +814,7 @@ virGetUserEnt(uid_t uid, char **name, gid_t *group, char **dir, char
**shell, bo
virReportSystemError(rc,
_("Failed to find user record for uid
'%u'"),
- (unsigned int) uid);
+ (unsigned int)uid);
goto cleanup;
} else if (pw == NULL) {
if (quiet)
@@ -822,7 +822,7 @@ virGetUserEnt(uid_t uid, char **name, gid_t *group, char **dir, char
**shell, bo
virReportError(VIR_ERR_SYSTEM_ERROR,
_("Failed to find user record for uid '%u'"),
- (unsigned int) uid);
+ (unsigned int)uid);
goto cleanup;
}
@@ -883,11 +883,11 @@ static char *virGetGroupEnt(gid_t gid)
if (rc != 0) {
virReportSystemError(rc,
_("Failed to find group record for gid
'%u'"),
- (unsigned int) gid);
+ (unsigned int)gid);
} else {
virReportError(VIR_ERR_SYSTEM_ERROR,
_("Failed to find group record for gid
'%u'"),
- (unsigned int) gid);
+ (unsigned int)gid);
}
VIR_FREE(strbuf);
@@ -1040,7 +1040,7 @@ virGetUserID(const char *user, uid_t *uid)
}
if (virStrToLong_ui(user, NULL, 10, &uint_uid) < 0 ||
- ((uid_t) uint_uid) != uint_uid) {
+ ((uid_t)uint_uid) != uint_uid) {
virReportError(VIR_ERR_INVALID_ARG, _("Failed to parse user
'%s'"),
user);
return -1;
@@ -1120,7 +1120,7 @@ virGetGroupID(const char *group, gid_t *gid)
}
if (virStrToLong_ui(group, NULL, 10, &uint_gid) < 0 ||
- ((gid_t) uint_gid) != uint_gid) {
+ ((gid_t)uint_gid) != uint_gid) {
virReportError(VIR_ERR_INVALID_ARG, _("Failed to parse group
'%s'"),
group);
return -1;
@@ -1194,7 +1194,7 @@ virSetUIDGID(uid_t uid, gid_t gid, gid_t *groups ATTRIBUTE_UNUSED,
if (gid != (gid_t)-1 && setregid(gid, gid) < 0) {
virReportSystemError(errno,
_("cannot change to '%u' group"),
- (unsigned int) gid);
+ (unsigned int)gid);
return -1;
}
@@ -1209,7 +1209,7 @@ virSetUIDGID(uid_t uid, gid_t gid, gid_t *groups ATTRIBUTE_UNUSED,
if (uid != (uid_t)-1 && setreuid(uid, uid) < 0) {
virReportSystemError(errno,
_("cannot change to uid to '%u'"),
- (unsigned int) uid);
+ (unsigned int)uid);
return -1;
}
@@ -1941,7 +1941,7 @@ virGetListenFDs(void)
if ((pid_t)procid != getpid()) {
VIR_DEBUG("LISTEN_PID %s is not for us %lld",
- pidstr, (long long) getpid());
+ pidstr, (long long)getpid());
return 0;
}
@@ -2087,7 +2087,7 @@ virMemoryMaxValue(bool capped)
{
/* On 32-bit machines, our bound is 0xffffffff * KiB. On 64-bit
* machines, our bound is off_t (2^63). */
- if (capped && sizeof(unsigned long) < sizeof(long long))
+ if (capped && sizeof(unsigned long)< sizeof(long long))
return 1024ull * ULONG_MAX;
else
return LLONG_MAX;
diff --git a/src/util/virutil.h b/src/util/virutil.h
index be0f6b0ea855..c2136b1cf145 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -127,9 +127,9 @@ static inline int pthread_sigmask(int how,
const void *set,
void *old)
{
- (void) how;
- (void) set;
- (void) old;
+ (void)how;
+ (void)set;
+ (void)old;
return 0;
}
# endif
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 6e87605ea5e4..6590d9a9f31a 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -81,7 +81,7 @@ virXPathString(const char *xpath,
xmlXPathFreeObject(obj);
return NULL;
}
- ignore_value(VIR_STRDUP(ret, (char *) obj->stringval));
+ ignore_value(VIR_STRDUP(ret, (char *)obj->stringval));
xmlXPathFreeObject(obj);
return ret;
}
@@ -184,11 +184,11 @@ virXPathLongBase(const char *xpath,
ctxt->node = relnode;
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
- if (virStrToLong_l((char *) obj->stringval, NULL, base, value) < 0)
+ if (virStrToLong_l((char *)obj->stringval, NULL, base, value) < 0)
ret = -2;
} else if ((obj != NULL) && (obj->type == XPATH_NUMBER) &&
(!(isnan(obj->floatval)))) {
- *value = (long) obj->floatval;
+ *value = (long)obj->floatval;
if (*value != obj->floatval)
ret = -2;
} else {
@@ -222,7 +222,7 @@ virXPathInt(const char *xpath,
ret = virXPathLongBase(xpath, ctxt, 10, &tmp);
if (ret < 0)
return ret;
- if ((int) tmp != tmp)
+ if ((int)tmp != tmp)
return -2;
*value = tmp;
return 0;
@@ -289,11 +289,11 @@ virXPathULongBase(const char *xpath,
ctxt->node = relnode;
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
- if (virStrToLong_ul((char *) obj->stringval, NULL, base, value) < 0)
+ if (virStrToLong_ul((char *)obj->stringval, NULL, base, value) < 0)
ret = -2;
} else if ((obj != NULL) && (obj->type == XPATH_NUMBER) &&
(!(isnan(obj->floatval)))) {
- *value = (unsigned long) obj->floatval;
+ *value = (unsigned long)obj->floatval;
if (*value != obj->floatval)
ret = -2;
} else {
@@ -327,7 +327,7 @@ virXPathUInt(const char *xpath,
ret = virXPathULongBase(xpath, ctxt, 10, &tmp);
if (ret < 0)
return ret;
- if ((unsigned int) tmp != tmp)
+ if ((unsigned int)tmp != tmp)
return -2;
*value = tmp;
return 0;
@@ -405,11 +405,11 @@ virXPathULongLong(const char *xpath,
ctxt->node = relnode;
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
- if (virStrToLong_ull((char *) obj->stringval, NULL, 10, value) < 0)
+ if (virStrToLong_ull((char *)obj->stringval, NULL, 10, value) < 0)
ret = -2;
} else if ((obj != NULL) && (obj->type == XPATH_NUMBER) &&
(!(isnan(obj->floatval)))) {
- *value = (unsigned long long) obj->floatval;
+ *value = (unsigned long long)obj->floatval;
if (*value != obj->floatval)
ret = -2;
} else {
@@ -451,11 +451,11 @@ virXPathLongLong(const char *xpath,
ctxt->node = relnode;
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
- if (virStrToLong_ll((char *) obj->stringval, NULL, 10, value) < 0)
+ if (virStrToLong_ll((char *)obj->stringval, NULL, 10, value) < 0)
ret = -2;
} else if ((obj != NULL) && (obj->type == XPATH_NUMBER) &&
(!(isnan(obj->floatval)))) {
- *value = (long long) obj->floatval;
+ *value = (long long)obj->floatval;
if (*value != obj->floatval)
ret = -2;
} else {
@@ -715,7 +715,7 @@ catchXMLError(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
return;
if (ctxt->_private)
- domcode = ((struct virParserData *) ctxt->_private)->domcode;
+ domcode = ((struct virParserData *)ctxt->_private)->domcode;
cur = ctxt->input->cur;
@@ -1060,7 +1060,7 @@ virXMLFindChildNodeByNs(xmlNodePtr root,
for (next = root->children; next; next = next->next) {
if (next->ns &&
- STREQ_NULLABLE((const char *) next->ns->href, uri))
+ STREQ_NULLABLE((const char *)next->ns->href, uri))
return next;
}
@@ -1207,8 +1207,8 @@ virXMLNodeSanitizeNamespaces(xmlNodePtr node)
dupl = NULL;
if (child->ns && next->ns &&
- STREQ_NULLABLE((const char *) child->ns->href,
- (const char *) next->ns->href))
+ STREQ_NULLABLE((const char *)child->ns->href,
+ (const char *)next->ns->href))
dupl = next;
next = next->next;
--
2.17.0