[PATCH 19/29] util: Add spaces after casts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/util/viralloc.c              | 16 ++++----
 src/util/viralloc.h              |  2 +-
 src/util/virarptable.c           |  2 +-
 src/util/viratomic.h             | 64 +++++++++++++++----------------
 src/util/vircgroup.c             |  4 +-
 src/util/vircommand.c            |  4 +-
 src/util/virconf.c               | 30 +++++++--------
 src/util/virdbus.c               | 66 ++++++++++++++++----------------
 src/util/virdnsmasq.c            |  6 +--
 src/util/virfdstream.c           |  2 +-
 src/util/virfile.c               |  8 ++--
 src/util/virfilecache.c          |  2 +-
 src/util/virfirewall.c           |  2 +-
 src/util/virhash.c               |  2 +-
 src/util/virhostmem.c            | 10 ++---
 src/util/viridentity.c           |  4 +-
 src/util/viriscsi.c              |  2 +-
 src/util/virjson.c               | 22 +++++------
 src/util/virlockspace.c          | 12 +++---
 src/util/virlog.c                | 14 +++----
 src/util/virnetdev.c             | 20 +++++-----
 src/util/virnetdevbridge.c       |  6 +--
 src/util/virnetdevip.c           |  6 +--
 src/util/virnetdevmacvlan.c      | 18 ++++-----
 src/util/virnetdevtap.c          |  4 +-
 src/util/virnetdevvportprofile.c |  4 +-
 src/util/virnetlink.c            | 18 ++++-----
 src/util/virnodesuspend.c        |  4 +-
 src/util/virobject.c             |  2 +-
 src/util/virpidfile.c            |  2 +-
 src/util/virpolkit.c             |  4 +-
 src/util/virprobe.h              |  2 +-
 src/util/virprocess.c            | 22 +++++------
 src/util/virrandom.c             |  2 +-
 src/util/virrotatingfile.c       |  4 +-
 src/util/virstoragefile.c        | 16 ++++----
 src/util/virsystemd.c            |  6 +--
 src/util/virtime.c               |  2 +-
 src/util/viruri.c                |  2 +-
 src/util/virutil.c               |  2 +-
 src/util/virutil.h               |  6 +--
 src/util/virxml.c                | 18 ++++-----
 42 files changed, 222 insertions(+), 222 deletions(-)

diff --git a/src/util/viralloc.c b/src/util/viralloc.c
index 81f99d9e1ff4..03b532226da7 100644
--- a/src/util/viralloc.c
+++ b/src/util/viralloc.c
@@ -133,7 +133,7 @@ int virAlloc(void *ptrptr,
 {
 #if TEST_OOM
     if (virAllocTestFail()) {
-        *(void **)ptrptr = NULL;
+        *(void **) ptrptr = NULL;
         if (report)
             virReportOOMErrorFull(domcode, filename, funcname, linenr);
         errno = ENOMEM;
@@ -141,8 +141,8 @@ int virAlloc(void *ptrptr,
     }
 #endif
 
-    *(void **)ptrptr = calloc(1, size);
-    if (*(void **)ptrptr == NULL) {
+    *(void **) ptrptr = calloc(1, size);
+    if (*(void **) ptrptr == NULL) {
         if (report)
             virReportOOMErrorFull(domcode, filename, funcname, linenr);
         return -1;
@@ -180,7 +180,7 @@ int virAllocN(void *ptrptr,
 {
 #if TEST_OOM
     if (virAllocTestFail()) {
-        *(void **)ptrptr = NULL;
+        *(void **) ptrptr = NULL;
         if (report)
             virReportOOMErrorFull(domcode, filename, funcname, linenr);
         errno = ENOMEM;
@@ -294,7 +294,7 @@ int virExpandN(void *ptrptr,
     ret = virReallocN(ptrptr, size, *countptr + add, report,
                       domcode, filename, funcname, linenr);
     if (ret == 0) {
-        memset(*(char **)ptrptr + (size * *countptr), 0, size * add);
+        memset(*(char **) ptrptr + (size * *countptr), 0, size * add);
         *countptr += add;
     }
     return ret;
@@ -557,8 +557,8 @@ int virAllocVar(void *ptrptr,
     }
 
     alloc_size = struct_size + (element_size * count);
-    *(void **)ptrptr = calloc(1, alloc_size);
-    if (*(void **)ptrptr == NULL) {
+    *(void **) ptrptr = calloc(1, alloc_size);
+    if (*(void **) ptrptr == NULL) {
         if (report)
             virReportOOMErrorFull(domcode, filename, funcname, linenr);
         return -1;
@@ -610,7 +610,7 @@ void virDispose(void *ptrptr,
         count = *countptr;
 
     if (*(void**)ptrptr && count > 0)
-        memset(*(void **)ptrptr, 0, count * element_size);
+        memset(*(void **) ptrptr, 0, count * element_size);
 
     free(*(void**)ptrptr);
     *(void**)ptrptr = NULL;
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index 69d0f904f1e4..69045ecd846b 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -491,7 +491,7 @@ void virDispose(void *ptrptr, size_t count, size_t element_size, size_t *countpt
  * arithmetic overflow in the allocation size.  The check is
  * essentially the same as that in gnulib's xalloc_oversized.
  */
-# define VIR_ALLOC_VAR_OVERSIZED(M, N, S) ((((size_t)-1) - (M)) / (S) < (N))
+# define VIR_ALLOC_VAR_OVERSIZED(M, N, S) ((((size_t) -1) - (M)) / (S) < (N))
 
 /**
  * VIR_ALLOC_VAR:
diff --git a/src/util/virarptable.c b/src/util/virarptable.c
index c0e90dc4bbf6..6ea5b8c733f8 100644
--- a/src/util/virarptable.c
+++ b/src/util/virarptable.c
@@ -129,7 +129,7 @@ virArpTableGet(void)
             bzero(&virAddr, sizeof(virAddr));
             virAddr.len = sizeof(virAddr.data.inet4);
             virAddr.data.inet4.sin_family = AF_INET;
-            virAddr.data.inet4.sin_addr = *(struct in_addr *)addr;
+            virAddr.data.inet4.sin_addr = *(struct in_addr *) addr;
             ipstr = virSocketAddrFormat(&virAddr);
 
             if (VIR_STRDUP(table->t[num].ipaddr, ipstr) < 0)
diff --git a/src/util/viratomic.h b/src/util/viratomic.h
index febe401f7704..509852565428 100644
--- a/src/util/viratomic.h
+++ b/src/util/viratomic.h
@@ -158,58 +158,58 @@ VIR_STATIC unsigned int virAtomicIntXor(volatile unsigned int *atomic,
 
 #  define virAtomicIntGet(atomic) \
     (__extension__ ({ \
-            (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
-            (void)(0 ? *(atomic) ^ *(atomic) : 0); \
+            (void) verify_true(sizeof(*(atomic)) == sizeof(int)); \
+            (void) (0 ? *(atomic) ^ *(atomic) : 0); \
             __sync_synchronize(); \
-            (int)*(atomic); \
+            (int) *(atomic); \
         }))
 #  define virAtomicIntSet(atomic, newval) \
     (__extension__ ({ \
-            (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
-            (void)(0 ? *(atomic) ^ (newval) : 0); \
+            (void) verify_true(sizeof(*(atomic)) == sizeof(int)); \
+            (void) (0 ? *(atomic) ^ (newval) : 0); \
             *(atomic) = (newval); \
             __sync_synchronize(); \
         }))
 #  define virAtomicIntInc(atomic) \
     (__extension__ ({ \
-            (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
-            (void)(0 ? *(atomic) ^ *(atomic) : 0); \
+            (void) verify_true(sizeof(*(atomic)) == sizeof(int)); \
+            (void) (0 ? *(atomic) ^ *(atomic) : 0); \
             __sync_add_and_fetch((atomic), 1); \
         }))
 #  define virAtomicIntDecAndTest(atomic) \
     (__extension__ ({ \
-            (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
-            (void)(0 ? *(atomic) ^ *(atomic) : 0); \
+            (void) verify_true(sizeof(*(atomic)) == sizeof(int)); \
+            (void) (0 ? *(atomic) ^ *(atomic) : 0); \
             __sync_fetch_and_sub((atomic), 1) == 1; \
         }))
 #  define virAtomicIntCompareExchange(atomic, oldval, newval) \
     (__extension__ ({ \
-            (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
-            (void)(0 ? *(atomic) ^ (newval) ^ (oldval) : 0); \
+            (void) verify_true(sizeof(*(atomic)) == sizeof(int)); \
+            (void) (0 ? *(atomic) ^ (newval) ^ (oldval) : 0); \
             (bool)__sync_bool_compare_and_swap((atomic), \
                                                (oldval), (newval)); \
         }))
 #  define virAtomicIntAdd(atomic, val) \
     (__extension__ ({ \
-            (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
-            (void)(0 ? *(atomic) ^ (val) : 0); \
+            (void) verify_true(sizeof(*(atomic)) == sizeof(int)); \
+            (void) (0 ? *(atomic) ^ (val) : 0); \
             (int) __sync_fetch_and_add((atomic), (val)); \
         }))
 #  define virAtomicIntAnd(atomic, val) \
     (__extension__ ({ \
-            (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+            (void) verify_true(sizeof(*(atomic)) == sizeof(int)); \
             (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) verify_true(sizeof(*(atomic)) == sizeof(int)); \
             (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) verify_true(sizeof(*(atomic)) == sizeof(int)); \
             (void) (0 ? *(atomic) ^ (val) : 0); \
             (unsigned int) __sync_fetch_and_xor((atomic), (val)); \
         }))
@@ -249,13 +249,13 @@ virAtomicIntSet(volatile int *atomic,
 static inline int
 virAtomicIntInc(volatile int *atomic)
 {
-    return InterlockedIncrement((volatile LONG *)atomic);
+    return InterlockedIncrement((volatile LONG *) atomic);
 }
 
 static inline bool
 virAtomicIntDecAndTest(volatile int *atomic)
 {
-    return InterlockedDecrement((volatile LONG *)atomic) == 0;
+    return InterlockedDecrement((volatile LONG *) atomic) == 0;
 }
 
 static inline bool
@@ -263,35 +263,35 @@ virAtomicIntCompareExchange(volatile int *atomic,
                             int oldval,
                             int newval)
 {
-    return InterlockedCompareExchange((volatile LONG *)atomic, newval, oldval) == oldval;
+    return InterlockedCompareExchange((volatile LONG *) atomic, newval, oldval) == oldval;
 }
 
 static inline int
 virAtomicIntAdd(volatile int *atomic,
                 int val)
 {
-    return InterlockedExchangeAdd((volatile LONG *)atomic, val);
+    return InterlockedExchangeAdd((volatile LONG *) atomic, val);
 }
 
 static inline unsigned int
 virAtomicIntAnd(volatile unsigned int *atomic,
                 unsigned int val)
 {
-    return InterlockedAnd((volatile LONG *)atomic, val);
+    return InterlockedAnd((volatile LONG *) atomic, val);
 }
 
 static inline unsigned int
 virAtomicIntOr(volatile unsigned int *atomic,
                unsigned int val)
 {
-    return InterlockedOr((volatile LONG *)atomic, val);
+    return InterlockedOr((volatile LONG *) atomic, val);
 }
 
 static inline unsigned int
 virAtomicIntXor(volatile unsigned int *atomic,
                 unsigned int val)
 {
-    return InterlockedXor((volatile LONG *)atomic, val);
+    return InterlockedXor((volatile LONG *) atomic, val);
 }
 
 
@@ -431,23 +431,23 @@ virAtomicIntXor(volatile unsigned int *atomic,
  * atomic op helpers.
  */
 #  define virAtomicIntGet(atomic) \
-    virAtomicIntGet((int *)atomic)
+    virAtomicIntGet((int *) atomic)
 #  define virAtomicIntSet(atomic, val) \
-    virAtomicIntSet((int *)atomic, val)
+    virAtomicIntSet((int *) atomic, val)
 #  define virAtomicIntInc(atomic) \
-    virAtomicIntInc((int *)atomic)
+    virAtomicIntInc((int *) atomic)
 #  define virAtomicIntDecAndTest(atomic) \
-    virAtomicIntDecAndTest((int *)atomic)
+    virAtomicIntDecAndTest((int *) atomic)
 #  define virAtomicIntCompareExchange(atomic, oldval, newval) \
-    virAtomicIntCompareExchange((int *)atomic, oldval, newval)
+    virAtomicIntCompareExchange((int *) atomic, oldval, newval)
 #  define virAtomicIntAdd(atomic, val) \
-    virAtomicIntAdd((int *)atomic, val)
+    virAtomicIntAdd((int *) atomic, val)
 #  define virAtomicIntAnd(atomic, val) \
-    virAtomicIntAnd((unsigned int *)atomic, val)
+    virAtomicIntAnd((unsigned int *) atomic, val)
 #  define virAtomicIntOr(atomic, val) \
-    virAtomicIntOr((unsigned int *)atomic, val)
+    virAtomicIntOr((unsigned int *) atomic, val)
 #  define virAtomicIntXor(atomic, val) \
-    virAtomicIntXor((unsigned int *)atomic, val)
+    virAtomicIntXor((unsigned int *) atomic, val)
 
 # endif
 
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 0a31947b0d54..dc4080b93f65 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1310,7 +1310,7 @@ virCgroupSetPartitionSuffix(const char *path, char **res)
             goto cleanup;
     }
 
-    if (!(*res = virStringListJoin((const char **)tokens, "/")))
+    if (!(*res = virStringListJoin((const char **) tokens, "/")))
         goto cleanup;
 
     ret = 0;
@@ -3623,7 +3623,7 @@ virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr pids)
 static uint32_t
 virCgroupPidCode(const void *name, uint32_t seed)
 {
-    long pid_value = (long)(intptr_t)name;
+    long pid_value = (long) (intptr_t)name;
     return virHashCodeGen(&pid_value, sizeof(pid_value), seed);
 }
 
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 6dab105f568d..b8f915e3991b 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -471,7 +471,7 @@ virExecCommon(virCommandPtr cmd, gid_t *groups, int ngroups)
     if (cmd->uid != (uid_t)-1 || cmd->gid != (gid_t)-1 ||
         cmd->capabilities || (cmd->flags & VIR_EXEC_CLEAR_CAPS)) {
         VIR_DEBUG("Setting child uid:gid to %d:%d with caps %llx",
-                  (int)cmd->uid, (int)cmd->gid, cmd->capabilities);
+                  (int) cmd->uid, (int) cmd->gid, cmd->capabilities);
         if (virSetUIDGIDWithCaps(cmd->uid, cmd->gid, groups, ngroups,
                                  cmd->capabilities,
                                  !!(cmd->flags & VIR_EXEC_CLEAR_CAPS)) < 0)
@@ -2476,7 +2476,7 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
     VIR_DEBUG("About to run %s", str ? str : cmd->args[0]);
     ret = virExec(cmd);
     VIR_DEBUG("Command result %d, with PID %d",
-              ret, (int)cmd->pid);
+              ret, (int) cmd->pid);
 
     for (i = 0; i < cmd->npassfd; i++) {
         if (cmd->passfd[i].flags & VIR_COMMAND_PASS_FD_CLOSE_PARENT)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index e0a3fd12c04f..d811957241d7 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1042,7 +1042,7 @@ int virConfGetValueBool(virConfPtr conf,
         return -1;
     }
 
-    if (((unsigned long long)cval->l) > 1) {
+    if (((unsigned long long) cval->l) > 1) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("%s: value for '%s' parameter must be 0 or 1"),
                        conf->filename, setting);
@@ -1098,7 +1098,7 @@ int virConfGetValueInt(virConfPtr conf,
         return -1;
     }
 
-    *value = (int)cval->l;
+    *value = (int) cval->l;
 
     return 1;
 }
@@ -1139,14 +1139,14 @@ int virConfGetValueUInt(virConfPtr conf,
         return -1;
     }
 
-    if (((unsigned long long)cval->l) > UINT_MAX) {
+    if (((unsigned long long) cval->l) > UINT_MAX) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("%s: value for '%s' parameter must be in range 0:%u"),
                        conf->filename, setting, UINT_MAX);
         return -1;
     }
 
-    *value = (unsigned int)cval->l;
+    *value = (unsigned int) cval->l;
 
     return 1;
 }
@@ -1188,7 +1188,7 @@ int virConfGetValueSizeT(virConfPtr conf,
     }
 
 #if ULLONG_MAX > SIZE_MAX
-    if (((unsigned long long)cval->l) > SIZE_MAX) {
+    if (((unsigned long long) cval->l) > SIZE_MAX) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("%s: value for '%s' parameter must be in range 0:%zu"),
                        conf->filename, setting, SIZE_MAX);
@@ -1196,7 +1196,7 @@ int virConfGetValueSizeT(virConfPtr conf,
     }
 #endif
 
-    *value = (size_t)cval->l;
+    *value = (size_t) cval->l;
 
     return 1;
 }
@@ -1231,10 +1231,10 @@ int virConfGetValueSSizeT(virConfPtr conf,
         return 0;
 
     if (cval->type == VIR_CONF_ULLONG) {
-        if (((unsigned long long)cval->l) > SSIZE_MAX) {
+        if (((unsigned long long) cval->l) > SSIZE_MAX) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("%s: value for '%s' parameter must be in range %zd:%zd"),
-                           conf->filename, setting, (ssize_t)-SSIZE_MAX - 1, (ssize_t)SSIZE_MAX);
+                           conf->filename, setting, (ssize_t) -SSIZE_MAX - 1, (ssize_t) SSIZE_MAX);
             return -1;
         }
     } else if (cval->type == VIR_CONF_LLONG) {
@@ -1242,7 +1242,7 @@ int virConfGetValueSSizeT(virConfPtr conf,
         if (cval->l < (-SSIZE_MAX - 1) || cval->l > SSIZE_MAX) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("%s: value for '%s' parameter must be in range %zd:%zd"),
-                           conf->filename, setting, (ssize_t)-SSIZE_MAX - 1, (ssize_t)SSIZE_MAX);
+                           conf->filename, setting, (ssize_t) -SSIZE_MAX - 1, (ssize_t) SSIZE_MAX);
             return -1;
         }
 #endif
@@ -1253,7 +1253,7 @@ int virConfGetValueSSizeT(virConfPtr conf,
         return -1;
     }
 
-    *value = (ssize_t)cval->l;
+    *value = (ssize_t) cval->l;
 
     return 1;
 }
@@ -1288,7 +1288,7 @@ int virConfGetValueLLong(virConfPtr conf,
         return 0;
 
     if (cval->type == VIR_CONF_ULLONG) {
-        if (((unsigned long long)cval->l) > LLONG_MAX) {
+        if (((unsigned long long) cval->l) > LLONG_MAX) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("%s: value for '%s' parameter must be in range %lld:%lld"),
                            conf->filename, setting, LLONG_MIN, LLONG_MAX);
@@ -1341,7 +1341,7 @@ int virConfGetValueULLong(virConfPtr conf,
         return -1;
     }
 
-    *value = (unsigned long long)cval->l;
+    *value = (unsigned long long) cval->l;
 
     return 1;
 }
@@ -1478,7 +1478,7 @@ virConfWriteFile(const char *filename, virConfPtr conf)
     ret = safewrite(fd, content, use);
     VIR_FREE(content);
     VIR_FORCE_CLOSE(fd);
-    if (ret != (int)use) {
+    if (ret != (int) use) {
         virConfError(NULL, VIR_ERR_WRITE_FAILED, _("failed to save content"));
         return -1;
     }
@@ -1522,8 +1522,8 @@ virConfWriteMem(char *memory, int *len, virConfPtr conf)
     use = virBufferUse(&buf);
     content = virBufferContentAndReset(&buf);
 
-    if ((int)use >= *len) {
-        *len = (int)use;
+    if ((int) use >= *len) {
+        *len = (int) use;
         VIR_FREE(content);
         return -1;
     }
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index ba8b684f17f1..a04559170fe9 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -196,7 +196,7 @@ static void virDBusWatchCallback(int fdatch ATTRIBUTE_UNUSED,
     if (events & VIR_EVENT_HANDLE_HANGUP)
         dbus_flags |= DBUS_WATCH_HANGUP;
 
-    (void)dbus_watch_handle(watch, dbus_flags);
+    (void) dbus_watch_handle(watch, dbus_flags);
 
     while (dbus_connection_dispatch(info->bus) == DBUS_DISPATCH_DATA_REMAINS)
         /* keep dispatching while data remains */;
@@ -243,7 +243,7 @@ static dbus_bool_t virDBusAddWatch(DBusWatch *watch,
     fd = dbus_watch_get_fd(watch);
 # endif
     dbus_watch_set_data(watch, info, virDBusWatchFree);
-    info->bus = (DBusConnection *)data;
+    info->bus = (DBusConnection *) data;
     info->watch = virEventAddHandle(fd, flags,
                                     virDBusWatchCallback,
                                     watch, NULL);
@@ -263,7 +263,7 @@ static void virDBusRemoveWatch(DBusWatch *watch,
 
     info = dbus_watch_get_data(watch);
 
-    (void)virEventRemoveHandle(info->watch);
+    (void) virEventRemoveHandle(info->watch);
 }
 
 
@@ -278,7 +278,7 @@ static void virDBusToggleWatch(DBusWatch *watch,
 
     info = dbus_watch_get_data(watch);
 
-    (void)virEventUpdateHandle(info->watch, flags);
+    (void) virEventUpdateHandle(info->watch, flags);
 }
 
 # define VIR_DBUS_TYPE_STACK_MAX_DEPTH 32
@@ -510,7 +510,7 @@ static int virDBusTypeStackPush(virDBusTypeStack **stack,
     (*stack)[(*nstack) - 1].nstruct = nstruct;
     (*stack)[(*nstack) - 1].narray = narray;
     VIR_DEBUG("Pushed types='%s' nstruct=%zu narray=%zd",
-              types, nstruct, (ssize_t)narray);
+              types, nstruct, (ssize_t) narray);
     return 0;
 }
 
@@ -533,7 +533,7 @@ static int virDBusTypeStackPop(virDBusTypeStack **stack,
     *nstruct = (*stack)[(*nstack) - 1].nstruct;
     *narray = (*stack)[(*nstack) - 1].narray;
     VIR_DEBUG("Popped types='%s' nstruct=%zu narray=%zd",
-              *types, *nstruct, (ssize_t)*narray);
+              *types, *nstruct, (ssize_t) *narray);
     VIR_SHRINK_N(*stack, *nstack, 1);
 
     return 0;
@@ -624,16 +624,16 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
     if (!types)
         return 0;
 
-    narray = (size_t)-1;
+    narray = (size_t) -1;
     nstruct = strlen(types);
 
     for (;;) {
         const char *t;
 
         VIR_DEBUG("Loop nstack=%zu narray=%zd nstruct=%zu types='%s'",
-                  nstack, (ssize_t)narray, nstruct, types);
+                  nstack, (ssize_t) narray, nstruct, types);
         if (narray == 0 ||
-            (narray == (size_t)-1 &&
+            (narray == (size_t) -1 &&
              nstruct == 0)) {
             DBusMessageIter *thisiter = iter;
             if (*types != '}') {
@@ -662,7 +662,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
         }
 
         t = types;
-        if (narray != (size_t)-1) {
+        if (narray != (size_t) -1) {
             narray--;
         } else {
             types++;
@@ -739,7 +739,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
                 goto cleanup;
             }
 
-            if (narray == (size_t)-1) {
+            if (narray == (size_t) -1) {
                 types += skiplen;
                 nstruct -= skiplen;
             }
@@ -761,7 +761,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
             newiter = NULL;
             types = t + 1;
             nstruct = skiplen;
-            narray = (size_t)va_arg(args, int);
+            narray = (size_t) va_arg(args, int);
             if (arrayref)
                 arrayptr = va_arg(args, void *);
             break;
@@ -788,7 +788,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
             newiter = NULL;
             types = vsig;
             nstruct = strlen(types);
-            narray = (size_t)-1;
+            narray = (size_t) -1;
             break;
 
         case DBUS_STRUCT_BEGIN_CHAR:
@@ -804,7 +804,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
                                                   DBUS_TYPE_STRUCT : DBUS_TYPE_DICT_ENTRY,
                                                   NULL, newiter))
                 goto cleanup;
-            if (narray == (size_t)-1) {
+            if (narray == (size_t) -1) {
                 types += skiplen - 1;
                 nstruct -= skiplen - 1;
             }
@@ -820,14 +820,14 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
             newiter = NULL;
             types = t + 1;
             nstruct = skiplen - 2;
-            narray = (size_t)-1;
+            narray = (size_t) -1;
 
             break;
 
         default:
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unknown type '%x' in signature '%s'"),
-                           (int)*t, types);
+                           (int) *t, types);
             goto cleanup;
         }
     }
@@ -857,7 +857,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
 # define GET_NEXT_VAL(dbustype, member, vargtype, fmt) \
     do { \
         DBusBasicValue v; \
-        dbustype *x = (dbustype *)&v.member; \
+        dbustype *x = (dbustype *) &v.member; \
         vargtype *y; \
         if (arrayref) { \
             VIR_DEBUG("Use arrayref"); \
@@ -901,7 +901,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
     if (!types)
         return 0;
 
-    narray = (size_t)-1;
+    narray = (size_t) -1;
     nstruct = strlen(types);
 
     for (;;) {
@@ -909,9 +909,9 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
         bool advanceiter = true;
 
         VIR_DEBUG("Loop nstack=%zu narray=%zd nstruct=%zu type='%s'",
-                  nstack, (ssize_t)narray, nstruct, types);
+                  nstack, (ssize_t) narray, nstruct, types);
         if (narray == 0 ||
-            (narray == (size_t)-1 &&
+            (narray == (size_t) -1 &&
              nstruct == 0)) {
             DBusMessageIter *thisiter = iter;
             VIR_DEBUG("Popping iter=%p", iter);
@@ -933,10 +933,10 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
                     narray = 0;
                 else
                     narray = 1;
-                VIR_DEBUG("Pop set narray=%zd", (ssize_t)narray);
+                VIR_DEBUG("Pop set narray=%zd", (ssize_t) narray);
             }
             if (!(narray == 0 ||
-                  (narray == (size_t)-1 &&
+                  (narray == (size_t) -1 &&
                    nstruct == 0)) &&
                 !dbus_message_iter_next(iter)) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -947,7 +947,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
         }
 
         t = types;
-        if (narray != (size_t)-1) {
+        if (narray != (size_t) -1) {
             if (!arrayref)
                 narray--;
         } else {
@@ -1001,10 +1001,10 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
                     char ***xptrptr = arrayptr;
                     if (VIR_EXPAND_N(*xptrptr, *narrayptr, 1) < 0)
                         goto cleanup;
-                    x = (char **)(*xptrptr + (*narrayptr - 1));
+                    x = (char **) (*xptrptr + (*narrayptr - 1));
                     VIR_DEBUG("Expanded to %zu", *narrayptr);
                 } else {
-                    x = (char **)va_arg(args, char **);
+                    x = (char **) va_arg(args, char **);
                 }
                 char *s;
                 dbus_message_iter_get_basic(iter, &s);
@@ -1039,7 +1039,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
                 goto cleanup;
             }
 
-            if (narray == (size_t)-1) {
+            if (narray == (size_t) -1) {
                 types += skiplen;
                 nstruct -= skiplen;
             }
@@ -1062,7 +1062,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
                 narrayptr = va_arg(args, size_t *);
                 arrayptr = va_arg(args, void *);
                 *narrayptr = 0;
-                *(char **)arrayptr = NULL;
+                *(char **) arrayptr = NULL;
             } else {
                 narray = va_arg(args, int);
             }
@@ -1089,7 +1089,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
             newiter = NULL;
             types = vsig;
             nstruct = strlen(types);
-            narray = (size_t)-1;
+            narray = (size_t) -1;
             break;
 
         case DBUS_STRUCT_BEGIN_CHAR:
@@ -1103,7 +1103,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
             VIR_DEBUG("Dict/struct contsig='%s' skip='%zu' len='%zu' types='%s'",
                       contsig, skiplen, siglen, types);
             dbus_message_iter_recurse(iter, newiter);
-            if (narray == (size_t)-1) {
+            if (narray == (size_t) -1) {
                 types += skiplen - 1;
                 nstruct -= skiplen - 1;
             }
@@ -1117,7 +1117,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
             newiter = NULL;
             types = t + 1;
             nstruct = skiplen - 2;
-            narray = (size_t)-1;
+            narray = (size_t) -1;
 
             break;
 
@@ -1129,7 +1129,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
         }
 
         VIR_DEBUG("After nstack=%zu narray=%zd nstruct=%zu types='%s'",
-                  nstack, (ssize_t)narray, nstruct, types);
+                  nstack, (ssize_t) narray, nstruct, types);
 
         if (arrayref) {
             if (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_INVALID) {
@@ -1143,11 +1143,11 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
                     narray = 1;
                 }
             }
-            VIR_DEBUG("Set narray=%zd", (ssize_t)narray);
+            VIR_DEBUG("Set narray=%zd", (ssize_t) narray);
         } else {
             if (advanceiter &&
                 !(narray == 0 ||
-                  (narray == (size_t)-1 &&
+                  (narray == (size_t) -1 &&
                    nstruct == 0)) &&
                 !dbus_message_iter_next(iter)) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 492dcadc96a9..8bb6290b2d5b 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -103,7 +103,7 @@ addnhostsAdd(dnsmasqAddnHostsfile *addnhostsfile,
         return -1;
 
     for (i = 0; i < addnhostsfile->nhosts; i++) {
-        if (STREQ((const char *)addnhostsfile->hosts[i].ip, (const char *)ipstr)) {
+        if (STREQ((const char *) addnhostsfile->hosts[i].ip, (const char *) ipstr)) {
             idx = i;
             break;
         }
@@ -689,8 +689,8 @@ dnsmasqCapsSetFromBuffer(dnsmasqCapsPtr caps, const char *buf)
 
     VIR_INFO("dnsmasq version is %d.%d, --bind-dynamic is %spresent, "
              "SO_BINDTODEVICE is %sin use, --ra-param is %spresent",
-             (int)caps->version / 1000000,
-             (int)(caps->version % 1000000) / 1000,
+             (int) caps->version / 1000000,
+             (int) (caps->version % 1000000) / 1000,
              dnsmasqCapsGet(caps, DNSMASQ_CAPS_BIND_DYNAMIC) ? "" : "NOT ",
              dnsmasqCapsGet(caps, DNSMASQ_CAPS_BINDTODEVICE) ? "" : "NOT ",
              dnsmasqCapsGet(caps, DNSMASQ_CAPS_RA_PARAM) ? "" : "NOT ");
diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c
index e4973a2bd015..8ac794796ee6 100644
--- a/src/util/virfdstream.c
+++ b/src/util/virfdstream.c
@@ -1176,7 +1176,7 @@ int virFDStreamConnectUNIX(virStreamPtr st,
     if (virTimeBackOffStart(&timeout, 1, 3*1000 /* ms */) < 0)
         goto error;
     while (virTimeBackOffWait(&timeout)) {
-        ret = connect(fd, (struct sockaddr *)&sa, sizeof(sa));
+        ret = connect(fd, (struct sockaddr *) &sa, sizeof(sa));
         if (ret == 0)
             break;
 
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 5e9bd2007a52..1feea06cc44a 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -1048,7 +1048,7 @@ saferead(int fd, void *buf, size_t count)
             return r;
         if (r == 0)
             return nread;
-        buf = (char *)buf + r;
+        buf = (char *) buf + r;
         count -= r;
         nread += r;
     }
@@ -1073,7 +1073,7 @@ safewrite(int fd, const void *buf, size_t count)
             return r;
         if (r == 0)
             return nwritten;
-        buf = (const char *)buf + r;
+        buf = (const char *) buf + r;
         count -= r;
         nwritten += r;
     }
@@ -1401,7 +1401,7 @@ virFileReadLimFD(int fd, int maxlen, char **buf)
     s = saferead_lim(fd, maxlen+1, &len);
     if (s == NULL)
         return -1;
-    if (len > maxlen || (int)len != len) {
+    if (len > maxlen || (int) len != len) {
         VIR_FREE(s);
         /* There was at least one byte more than MAXLEN.
            Set errno accordingly. */
@@ -3418,7 +3418,7 @@ virFileIsSharedFSType(const char *path,
     }
 
     VIR_DEBUG("Check if path %s with FS magic %lld is shared",
-              path, (long long int)sb.f_type);
+              path, (long long int) sb.f_type);
 
     if ((fstypes & VIR_FILE_SHFS_NFS) &&
         (sb.f_type == NFS_SUPER_MAGIC))
diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c
index dab72163ddb4..a5e8011779dd 100644
--- a/src/util/virfilecache.c
+++ b/src/util/virfilecache.c
@@ -351,7 +351,7 @@ virFileCacheLookupByFunc(virFileCachePtr cache,
 
     virObjectLock(cache);
 
-    data = virHashSearch(cache->table, iter, iterData, (void **)&name);
+    data = virHashSearch(cache->table, iter, iterData, (void **) &name);
     virFileCacheValidate(cache, name, &data);
 
     virObjectRef(data);
diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index 10c370a2aec0..c0c1dc3b4fd6 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -753,7 +753,7 @@ virFirewallApplyRuleFirewallD(virFirewallRulePtr rule,
                           "passthrough",
                           "sa&s",
                           ipv,
-                          (int)rule->argsLen,
+                          (int) rule->argsLen,
                           rule->args) < 0)
         goto cleanup;
 
diff --git a/src/util/virhash.c b/src/util/virhash.c
index ecda55dba514..84c591874465 100644
--- a/src/util/virhash.c
+++ b/src/util/virhash.c
@@ -758,7 +758,7 @@ struct virHashEqualData
 static int virHashEqualSearcher(const void *payload, const void *name,
                                 const void *data)
 {
-    struct virHashEqualData *vhed = (void *)data;
+    struct virHashEqualData *vhed = (void *) data;
     const void *value;
 
     value = virHashLookup(vhed->table2, name);
diff --git a/src/util/virhostmem.c b/src/util/virhostmem.c
index 11efe8c5029f..a88a9cb7a819 100644
--- a/src/util/virhostmem.c
+++ b/src/util/virhostmem.c
@@ -110,7 +110,7 @@ virHostMemGetStatsFreeBSD(virNodeMemoryStatsPtr params,
                            sysctl_map[i].field);
             return -1;
         }
-        param->value = (unsigned long long)value * pagesize;
+        param->value = (unsigned long long) value * pagesize;
     }
 
     {
@@ -128,7 +128,7 @@ virHostMemGetStatsFreeBSD(virNodeMemoryStatsPtr params,
                            VIR_NODE_MEMORY_STATS_BUFFERS);
             return -1;
         }
-        param->value = (unsigned long long)bufpages >> 10;
+        param->value = (unsigned long long) bufpages >> 10;
     }
 
     return 0;
@@ -454,13 +454,13 @@ virHostMemGetParameterValue(const char *field,
     if (STREQ(field, "pages_to_scan")   ||
         STREQ(field, "sleep_millisecs") ||
         STREQ(field, "merge_across_nodes"))
-        rc = virStrToLong_ui(buf, NULL, 10, (unsigned int *)value);
+        rc = virStrToLong_ui(buf, NULL, 10, (unsigned int *) value);
     else if (STREQ(field, "pages_shared")    ||
              STREQ(field, "pages_sharing")   ||
              STREQ(field, "pages_unshared")  ||
              STREQ(field, "pages_volatile")  ||
              STREQ(field, "full_scans"))
-        rc = virStrToLong_ull(buf, NULL, 10, (unsigned long long *)value);
+        rc = virStrToLong_ull(buf, NULL, 10, (unsigned long long *) value);
 
     if (rc < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -635,7 +635,7 @@ virHostMemGetCellsFreeFake(unsigned long long *freeMems,
         return -1;
     }
 
-    freeMems[0] = (unsigned long long)avail;
+    freeMems[0] = (unsigned long long) avail;
 
     if (!freeMems[0]) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/util/viridentity.c b/src/util/viridentity.c
index 2f4307bc8284..6116c205e32f 100644
--- a/src/util/viridentity.c
+++ b/src/util/viridentity.c
@@ -463,7 +463,7 @@ int virIdentitySetUNIXUserID(virIdentityPtr ident,
 {
     char *val;
     int ret;
-    if (virAsprintf(&val, "%d", (int)uid) < 0)
+    if (virAsprintf(&val, "%d", (int) uid) < 0)
         return -1;
     ret = virIdentitySetAttr(ident,
                              VIR_IDENTITY_ATTR_UNIX_USER_ID,
@@ -487,7 +487,7 @@ int virIdentitySetUNIXGroupID(virIdentityPtr ident,
 {
     char *val;
     int ret;
-    if (virAsprintf(&val, "%d", (int)gid) < 0)
+    if (virAsprintf(&val, "%d", (int) gid) < 0)
         return -1;
     ret = virIdentitySetAttr(ident,
                              VIR_IDENTITY_ATTR_UNIX_GROUP_ID,
diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c
index d4c745a1afac..991a66583608 100644
--- a/src/util/viriscsi.c
+++ b/src/util/viriscsi.c
@@ -211,7 +211,7 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriqn,
 
     if (virAsprintf(&temp_ifacename,
                     "libvirt-iface-%08llx",
-                    (unsigned long long)virRandomBits(30)) < 0)
+                    (unsigned long long) virRandomBits(30)) < 0)
         return -1;
 
     VIR_DEBUG("Attempting to create interface '%s' with IQN '%s'",
diff --git a/src/util/virjson.c b/src/util/virjson.c
index dfe00d9280da..2cfcc5ecff6d 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -1644,10 +1644,10 @@ virJSONParserHandleString(void *ctx,
                           yajl_size_t stringLen)
 {
     virJSONParserPtr parser = ctx;
-    virJSONValuePtr value = virJSONValueNewStringLen((const char *)stringVal,
+    virJSONValuePtr value = virJSONValueNewStringLen((const char *) stringVal,
                                                      stringLen);
 
-    VIR_DEBUG("parser=%p str=%p", parser, (const char *)stringVal);
+    VIR_DEBUG("parser=%p str=%p", parser, (const char *) stringVal);
 
     if (!value)
         return 0;
@@ -1669,7 +1669,7 @@ virJSONParserHandleMapKey(void *ctx,
     virJSONParserPtr parser = ctx;
     virJSONParserStatePtr state;
 
-    VIR_DEBUG("parser=%p key=%p", parser, (const char *)stringVal);
+    VIR_DEBUG("parser=%p key=%p", parser, (const char *) stringVal);
 
     if (!parser->nstate)
         return 0;
@@ -1677,7 +1677,7 @@ virJSONParserHandleMapKey(void *ctx,
     state = &parser->state[parser->nstate-1];
     if (state->key)
         return 0;
-    if (VIR_STRNDUP(state->key, (const char *)stringVal, stringLen) < 0)
+    if (VIR_STRNDUP(state->key, (const char *) stringVal, stringLen) < 0)
         return 0;
     return 1;
 }
@@ -1835,15 +1835,15 @@ virJSONValueFromString(const char *jsonstring)
      * with no visibility into how much more input remains.  Wrapping
      * things in an array forces yajl to confess the truth.  */
 # ifdef WITH_YAJL2
-    rc = yajl_parse(hand, (const unsigned char *)jsonstring, len);
+    rc = yajl_parse(hand, (const unsigned char *) jsonstring, len);
 # else
-    rc = yajl_parse(hand, (const unsigned char *)"[", 1);
+    rc = yajl_parse(hand, (const unsigned char *) "[", 1);
     parser.wrap = 1;
     if (VIR_YAJL_STATUS_OK(rc))
-        rc = yajl_parse(hand, (const unsigned char *)jsonstring, len);
+        rc = yajl_parse(hand, (const unsigned char *) jsonstring, len);
     parser.wrap = 0;
     if (VIR_YAJL_STATUS_OK(rc))
-        rc = yajl_parse(hand, (const unsigned char *)"]", 1);
+        rc = yajl_parse(hand, (const unsigned char *) "]", 1);
 # endif
     if (!VIR_YAJL_STATUS_OK(rc) ||
         yajl_complete_parse(hand) != yajl_status_ok) {
@@ -1910,7 +1910,7 @@ virJSONValueToStringOne(virJSONValuePtr object,
             return -1;
         for (i = 0; i < object->data.object.npairs; i++) {
             if (yajl_gen_string(g,
-                                (unsigned char *)object->data.object.pairs[i].key,
+                                (unsigned char *) object->data.object.pairs[i].key,
                                 strlen(object->data.object.pairs[i].key))
                                 != yajl_gen_status_ok)
                 return -1;
@@ -1932,7 +1932,7 @@ virJSONValueToStringOne(virJSONValuePtr object,
         break;
 
     case VIR_JSON_TYPE_STRING:
-        if (yajl_gen_string(g, (unsigned char *)object->data.string,
+        if (yajl_gen_string(g, (unsigned char *) object->data.string,
                             strlen(object->data.string)) != yajl_gen_status_ok)
             return -1;
         break;
@@ -2001,7 +2001,7 @@ virJSONValueToString(virJSONValuePtr object,
         goto cleanup;
     }
 
-    ignore_value(VIR_STRDUP(ret, (const char *)str));
+    ignore_value(VIR_STRDUP(ret, (const char *) str));
 
  cleanup:
     yajl_gen_free(g);
diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c
index 41af0cdb6d28..b6d2d5b98604 100644
--- a/src/util/virlockspace.c
+++ b/src/util/virlockspace.c
@@ -618,7 +618,7 @@ int virLockSpaceAcquireResource(virLockSpacePtr lockspace,
     virLockSpaceResourcePtr res;
 
     VIR_DEBUG("lockspace=%p resname=%s flags=0x%x owner=%lld",
-              lockspace, resname, flags, (unsigned long long)owner);
+              lockspace, resname, flags, (unsigned long long) owner);
 
     virCheckFlags(VIR_LOCK_SPACE_ACQUIRE_SHARED |
                   VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE, -1);
@@ -667,7 +667,7 @@ int virLockSpaceReleaseResource(virLockSpacePtr lockspace,
     size_t i;
 
     VIR_DEBUG("lockspace=%p resname=%s owner=%lld",
-              lockspace, resname, (unsigned long long)owner);
+              lockspace, resname, (unsigned long long) owner);
 
     virMutexLock(&lockspace->lock);
 
@@ -686,7 +686,7 @@ int virLockSpaceReleaseResource(virLockSpacePtr lockspace,
     if (i == res->nOwners) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("owner %lld does not hold the resource lock"),
-                       (unsigned long long)owner);
+                       (unsigned long long) owner);
         goto cleanup;
     }
 
@@ -716,10 +716,10 @@ virLockSpaceRemoveResourcesForOwner(const void *payload,
                                     const void *opaque)
 {
     virLockSpaceResourcePtr res = (virLockSpaceResourcePtr)payload;
-    struct virLockSpaceRemoveData *data = (struct virLockSpaceRemoveData *)opaque;
+    struct virLockSpaceRemoveData *data = (struct virLockSpaceRemoveData *) opaque;
     size_t i;
 
-    VIR_DEBUG("res %s owner %lld", res->name, (unsigned long long)data->owner);
+    VIR_DEBUG("res %s owner %lld", res->name, (unsigned long long) data->owner);
 
     for (i = 0; i < res->nOwners; i++) {
         if (res->owners[i] == data->owner)
@@ -751,7 +751,7 @@ int virLockSpaceReleaseResourcesForOwner(virLockSpacePtr lockspace,
         owner, 0
     };
 
-    VIR_DEBUG("lockspace=%p owner=%lld", lockspace, (unsigned long long)owner);
+    VIR_DEBUG("lockspace=%p owner=%lld", lockspace, (unsigned long long) owner);
 
     virMutexLock(&lockspace->lock);
 
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 81a9dc4395c2..3bb542f3936f 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -781,7 +781,7 @@ virLogCloseFd(void *data)
 static virLogOutputPtr
 virLogNewOutputToStderr(virLogPriority priority)
 {
-    return virLogOutputNew(virLogOutputToFd, NULL, (void *)STDERR_FILENO,
+    return virLogOutputNew(virLogOutputToFd, NULL, (void *) STDERR_FILENO,
                            priority, VIR_LOG_TO_STDERR, NULL);
 }
 
@@ -800,7 +800,7 @@ virLogNewOutputToFile(virLogPriority priority,
     }
 
     if (!(ret = virLogOutputNew(virLogOutputToFd, virLogCloseFd,
-                                (void *)(intptr_t)fd,
+                                (void *) (intptr_t)fd,
                                 priority, VIR_LOG_TO_FILE, file))) {
         VIR_LOG_CLOSE(fd);
         return NULL;
@@ -965,11 +965,11 @@ journalAddString(struct journalState *state, const char *field,
         if (state->iov_end - state->iov < 4)
             return; /* Silently drop */
         IOVEC_SET_STRING(state->iov[0], field);
-        IOVEC_SET(state->iov[1], (void *)&equals, sizeof(equals));
+        IOVEC_SET(state->iov[1], (void *) &equals, sizeof(equals));
         state->iov += 2;
     }
     IOVEC_SET_STRING(state->iov[0], value);
-    IOVEC_SET(state->iov[1], (void *)&newline, sizeof(newline));
+    IOVEC_SET(state->iov[1], (void *) &newline, sizeof(newline));
     state->iov += 2;
 }
 
@@ -986,9 +986,9 @@ journalAddInt(struct journalState *state, const char *field, int value)
     num = virFormatIntDecimal(state->bufs[0], sizeof(state->bufs[0]), value);
 
     IOVEC_SET_STRING(state->iov[0], field);
-    IOVEC_SET(state->iov[1], (void *)&equals, sizeof(equals));
+    IOVEC_SET(state->iov[1], (void *) &equals, sizeof(equals));
     IOVEC_SET_STRING(state->iov[2], num);
-    IOVEC_SET(state->iov[3], (void *)&newline, sizeof(newline));
+    IOVEC_SET(state->iov[3], (void *) &newline, sizeof(newline));
     state->bufs++;
     state->iov += 4;
 }
@@ -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/virnetdev.c b/src/util/virnetdev.c
index b250af9e2c10..6ee5833d6f3e 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -260,7 +260,7 @@ virNetDevSetMACInternal(const char *ifname,
         goto cleanup;
     }
 
-    virMacAddrGetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data);
+    virMacAddrGetRaw(macaddr, (unsigned char *) ifr.ifr_hwaddr.sa_data);
 
     if (ioctl(fd, SIOCSIFHWADDR, &ifr) < 0) {
 
@@ -386,7 +386,7 @@ int virNetDevGetMAC(const char *ifname,
         goto cleanup;
     }
 
-    virMacAddrSetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data);
+    virMacAddrSetRaw(macaddr, (unsigned char *) ifr.ifr_hwaddr.sa_data);
 
     ret = 0;
 
@@ -973,7 +973,7 @@ virNetDevGetMaster(const char *ifname, char **master)
         goto cleanup;
 
     if (tb[IFLA_MASTER]) {
-        if (!(*master = virNetDevGetName(*(int *)RTA_DATA(tb[IFLA_MASTER]))))
+        if (!(*master = virNetDevGetName(*(int *) RTA_DATA(tb[IFLA_MASTER]))))
             goto cleanup;
     }
 
@@ -1092,7 +1092,7 @@ int virNetDevValidateConfig(const char *ifname,
         }
 
         if (virMacAddrCmpRaw(macaddr,
-                             (unsigned char *)ifr.ifr_hwaddr.sa_data) != 0) {
+                             (unsigned char *) ifr.ifr_hwaddr.sa_data) != 0) {
             ret = 0;
             goto cleanup;
         }
@@ -1720,7 +1720,7 @@ virNetDevSetVfConfig(const char *ifname, int vf,
 
     switch (resp->nlmsg_type) {
     case NLMSG_ERROR:
-        err = (struct nlmsgerr *)NLMSG_DATA(resp);
+        err = (struct nlmsgerr *) NLMSG_DATA(resp);
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
 
@@ -2656,7 +2656,7 @@ int virNetDevAddMulti(const char *ifname,
         return -1;
 
     ifr.ifr_hwaddr.sa_family = AF_UNSPEC;
-    virMacAddrGetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data);
+    virMacAddrGetRaw(macaddr, (unsigned char *) ifr.ifr_hwaddr.sa_data);
 
     if (ioctl(fd, SIOCADDMULTI, &ifr) < 0) {
         char macstr[VIR_MAC_STRING_BUFLEN];
@@ -2705,7 +2705,7 @@ int virNetDevDelMulti(const char *ifname,
         return -1;
 
     ifr.ifr_hwaddr.sa_family = AF_UNSPEC;
-    virMacAddrGetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data);
+    virMacAddrGetRaw(macaddr, (unsigned char *) ifr.ifr_hwaddr.sa_data);
 
     if (ioctl(fd, SIOCDELMULTI, &ifr) < 0) {
         char macstr[VIR_MAC_STRING_BUFLEN];
@@ -2751,7 +2751,7 @@ static int virNetDevParseMcast(char *buf, virNetDevMcastEntryPtr mcast)
             return -1;
         }
 
-        switch ((virMCastType)ifindex) {
+        switch ((virMCastType) ifindex) {
             case VIR_MCAST_TYPE_INDEX_TOKEN:
                 if (virStrToLong_i(token, &endptr, 10, &num) < 0) {
                     virReportSystemError(EINVAL,
@@ -3180,7 +3180,7 @@ static void *
 virNetDevPutExtraHeader(struct nlmsghdr *nlh,
                         size_t size)
 {
-    char *ptr = (char *)nlh + nlh->nlmsg_len;
+    char *ptr = (char *) nlh + nlh->nlmsg_len;
     size_t len = NLMSG_ALIGN(size);
     nlh->nlmsg_len += len;
     return ptr;
@@ -3318,7 +3318,7 @@ virNetDevSwitchdevFeature(const char *ifname,
     }
 
     if (tb[DEVLINK_ATTR_ESWITCH_MODE] &&
-        *(int *)RTA_DATA(tb[DEVLINK_ATTR_ESWITCH_MODE]) == DEVLINK_ESWITCH_MODE_SWITCHDEV) {
+        *(int *) RTA_DATA(tb[DEVLINK_ATTR_ESWITCH_MODE]) == DEVLINK_ESWITCH_MODE_SWITCHDEV) {
         ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_SWITCHDEV));
     }
 
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index cfb7ebae99c7..d40f5335bc03 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -195,7 +195,7 @@ static int virNetDevBridgeGet(const char *brname,
         VIR_FREE(valuestr);
     } else {
         struct __bridge_info info;
-        unsigned long args[] = { BRCTL_GET_BRIDGE_INFO, (unsigned long)&info, 0, 0 };
+        unsigned long args[] = { BRCTL_GET_BRIDGE_INFO, (unsigned long) &info, 0, 0 };
 
         if ((fd = virNetDevSetupControl(brname, &ifr)) < 0)
             goto cleanup;
@@ -464,7 +464,7 @@ virNetDevBridgeCreate(const char *brname)
 
     switch (resp->nlmsg_type) {
     case NLMSG_ERROR:
-        err = (struct nlmsgerr *)NLMSG_DATA(resp);
+        err = (struct nlmsgerr *) NLMSG_DATA(resp);
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
 
@@ -1123,7 +1123,7 @@ virNetDevBridgeFDBAddDel(const virMacAddr *mac, const char *ifname,
 
     switch (resp->nlmsg_type) {
     case NLMSG_ERROR:
-        err = (struct nlmsgerr *)NLMSG_DATA(resp);
+        err = (struct nlmsgerr *) NLMSG_DATA(resp);
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
         if (err->error) {
diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c
index bf98ed8a59e0..b98a582b4ad7 100644
--- a/src/util/virnetdevip.c
+++ b/src/util/virnetdevip.c
@@ -415,7 +415,7 @@ virNetDevIPParseDadStatus(struct nlmsghdr *nlh, int len,
             break;
         }
 
-        ifaddrmsg_ptr = (struct ifaddrmsg *)NLMSG_DATA(nlh);
+        ifaddrmsg_ptr = (struct ifaddrmsg *) NLMSG_DATA(nlh);
         if (!(ifaddrmsg_ptr->ifa_flags & IFA_F_TENTATIVE)) {
             /* Not tentative: we are not interested in this entry. */
             continue;
@@ -563,7 +563,7 @@ virNetDevIPCheckIPv6ForwardingCallback(const struct nlmsghdr *resp,
     for (rta = RTM_RTA(rtmsg); RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
         VIR_WARNINGS_RESET
         if (rta->rta_type == RTA_OIF) {
-            oif = *(int *)RTA_DATA(rta);
+            oif = *(int *) RTA_DATA(rta);
 
             /* Should never happen: netlink message would be broken */
             if (ifname) {
@@ -856,7 +856,7 @@ virNetDevGetIPv4AddressIoctl(const char *ifname,
     if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
         return -1;
 
-    if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) {
+    if (ioctl(fd, SIOCGIFADDR, (char *) &ifr) < 0) {
         virReportSystemError(errno,
                              _("Unable to get IPv4 address for interface %s via ioctl"),
                              ifname);
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index fb41bf934cf9..0d6c0d0abe12 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -371,7 +371,7 @@ virNetDevMacVLanCreate(const char *ifname,
 
     switch (resp->nlmsg_type) {
     case NLMSG_ERROR:
-        err = (struct nlmsgerr *)NLMSG_DATA(resp);
+        err = (struct nlmsgerr *) NLMSG_DATA(resp);
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
 
@@ -685,15 +685,15 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
     case RTM_GETLINK:
         VIR_DEBUG(" IFINFOMSG");
         VIR_DEBUG("        ifi_family = 0x%02x",
-            ((struct ifinfomsg *)data)->ifi_family);
+            ((struct ifinfomsg *) data)->ifi_family);
         VIR_DEBUG("        ifi_type   = 0x%x",
-            ((struct ifinfomsg *)data)->ifi_type);
+            ((struct ifinfomsg *) data)->ifi_type);
         VIR_DEBUG("        ifi_index  = %i",
-            ((struct ifinfomsg *)data)->ifi_index);
+            ((struct ifinfomsg *) data)->ifi_index);
         VIR_DEBUG("        ifi_flags  = 0x%04x",
-            ((struct ifinfomsg *)data)->ifi_flags);
+            ((struct ifinfomsg *) data)->ifi_flags);
         VIR_DEBUG("        ifi_change = 0x%04x",
-            ((struct ifinfomsg *)data)->ifi_change);
+            ((struct ifinfomsg *) data)->ifi_change);
     }
     /* DEBUG end */
 
@@ -703,7 +703,7 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
         ifinfo.ifi_family, ifinfo.ifi_type, ifinfo.ifi_index,
         ifinfo.ifi_flags, ifinfo.ifi_change);
     if (nlmsg_parse(hdr, sizeof(ifinfo),
-        (struct nlattr **)&tb, IFLA_MAX, NULL)) {
+        (struct nlattr **) &tb, IFLA_MAX, NULL)) {
         VIR_DEBUG("error parsing request...");
         return;
     }
@@ -753,12 +753,12 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
     }
 
     if (tb[IFLA_IFNAME]) {
-        ifname = (char *)RTA_DATA(tb[IFLA_IFNAME]);
+        ifname = (char *) RTA_DATA(tb[IFLA_IFNAME]);
         VIR_DEBUG("IFLA_IFNAME = %s", ifname);
     }
 
     if (tb[IFLA_OPERSTATE]) {
-        rem = *(unsigned short *)RTA_DATA(tb[IFLA_OPERSTATE]);
+        rem = *(unsigned short *) RTA_DATA(tb[IFLA_OPERSTATE]);
         VIR_DEBUG("IFLA_OPERSTATE = %d", rem);
     }
 
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index a3ed59da8502..0a1011694773 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -126,7 +126,7 @@ virNetDevTapGetRealDeviceName(char *ifname ATTRIBUTE_UNUSED)
                 goto cleanup;
             }
 
-            if (ioctl(fd, TAPGIFNAME, (void *)&ifr) < 0) {
+            if (ioctl(fd, TAPGIFNAME, (void *) &ifr) < 0) {
                 virReportSystemError(errno, "%s",
                                      _("Unable to query tap interface name"));
                 goto cleanup;
@@ -793,7 +793,7 @@ virNetDevTapInterfaceStats(const char *ifname,
             continue;
 
         if (STREQ(ifa->ifa_name, ifname)) {
-            ifd = (struct if_data *)ifa->ifa_data;
+            ifd = (struct if_data *) ifa->ifa_data;
             if (swapped) {
                 stats->tx_bytes = ifd->ifi_ibytes;
                 stats->tx_packets = ifd->ifi_ipackets;
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index 133d962db6b2..491a9cd74526 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -807,7 +807,7 @@ virNetDevVPortProfileOpSetLink(const char *ifname, int ifindex,
 
     switch (resp->nlmsg_type) {
     case NLMSG_ERROR:
-        err = (struct nlmsgerr *)NLMSG_DATA(resp);
+        err = (struct nlmsgerr *) NLMSG_DATA(resp);
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
 
@@ -896,7 +896,7 @@ virNetDevVPortProfileGetNthParent(const char *ifname, int ifindex, unsigned int
         }
 
         if (tb[IFLA_LINK]) {
-            ifindex = *(int *)RTA_DATA(tb[IFLA_LINK]);
+            ifindex = *(int *) RTA_DATA(tb[IFLA_LINK]);
             ifname = NULL;
         } else {
             end = true;
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index fa1ba3e2a166..f8f520b306cc 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -312,7 +312,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
                                            protocol, groups)))
         goto cleanup;
 
-    len = nl_recv(nlhandle, &nladdr, (unsigned char **)resp, NULL);
+    len = nl_recv(nlhandle, &nladdr, (unsigned char **) resp, NULL);
     if (len == 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("nl_recv failed - returned 0 bytes"));
@@ -360,7 +360,7 @@ virNetlinkDumpCommand(struct nl_msg *nl_msg,
         goto cleanup;
 
     while (!end) {
-        len = nl_recv(nlhandle, &nladdr, (unsigned char **)&resp, NULL);
+        len = nl_recv(nlhandle, &nladdr, (unsigned char **) &resp, NULL);
         VIR_WARNINGS_NO_CAST_ALIGN
         for (msg = resp; NLMSG_OK(msg, len); msg = NLMSG_NEXT(msg, len)) {
             VIR_WARNINGS_RESET
@@ -461,7 +461,7 @@ virNetlinkDumpLink(const char *ifname, int ifindex,
 
     switch (resp->nlmsg_type) {
     case NLMSG_ERROR:
-        err = (struct nlmsgerr *)NLMSG_DATA(resp);
+        err = (struct nlmsgerr *) NLMSG_DATA(resp);
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
 
@@ -552,7 +552,7 @@ virNetlinkDelLink(const char *ifname, virNetlinkDelLinkFallback fallback)
 
     switch (resp->nlmsg_type) {
     case NLMSG_ERROR:
-        err = (struct nlmsgerr *)NLMSG_DATA(resp);
+        err = (struct nlmsgerr *) NLMSG_DATA(resp);
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
 
@@ -638,7 +638,7 @@ virNetlinkGetNeighbor(void **nlData, uint32_t src_pid, uint32_t dst_pid)
 
     switch (resp->nlmsg_type) {
     case NLMSG_ERROR:
-        err = (struct nlmsgerr *)NLMSG_DATA(resp);
+        err = (struct nlmsgerr *) NLMSG_DATA(resp);
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
 
@@ -686,7 +686,7 @@ virNetlinkGetErrorCode(struct nlmsghdr *resp, unsigned int recvbuflen)
 
     switch (resp->nlmsg_type) {
     case NLMSG_ERROR:
-        err = (struct nlmsgerr *)NLMSG_DATA(resp);
+        err = (struct nlmsgerr *) NLMSG_DATA(resp);
         if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
             goto malformed_resp;
 
@@ -775,7 +775,7 @@ virNetlinkEventCallback(int watch,
     bool handled = false;
 
     length = nl_recv(srv->netlinknh, &peer,
-                     (unsigned char **)&msg, &creds);
+                     (unsigned char **) &msg, &creds);
 
     if (length == 0)
         return;
@@ -788,7 +788,7 @@ virNetlinkEventCallback(int watch,
     virNetlinkEventServerLock(srv);
 
     VIR_DEBUG("dispatching to max %d clients, called from event watch %d",
-            (int)srv->handlesCount, watch);
+            (int) srv->handlesCount, watch);
 
     for (i = 0; i < srv->handlesCount; i++) {
         if (srv->handles[i].deleted != VIR_NETLINK_HANDLE_VALID)
@@ -910,7 +910,7 @@ int virNetlinkEventServiceLocalPid(unsigned int protocol)
                        _("netlink event service not running"));
         return -1;
     }
-    return (int)nl_socket_get_local_port(server[protocol]->netlinknh);
+    return (int) nl_socket_get_local_port(server[protocol]->netlinknh);
 }
 
 
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 0af0908e4ae1..c2340cb9b0f9 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -109,7 +109,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime)
  */
 static void virNodeSuspendHelper(void *cmdString)
 {
-    virCommandPtr suspendCmd = virCommandNew((const char *)cmdString);
+    virCommandPtr suspendCmd = virCommandNew((const char *) cmdString);
 
     /*
      * Delay for sometime so that the function virNodeSuspend()
@@ -221,7 +221,7 @@ int virNodeSuspend(unsigned int target,
 
     if (virThreadCreate(&thread, false,
                         virNodeSuspendHelper,
-                        (void *)cmdString) < 0) {
+                        (void *) cmdString) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Failed to create thread to suspend the host"));
         goto cleanup;
diff --git a/src/util/virobject.c b/src/util/virobject.c
index 9fb0328d5879..6a2ab967a094 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -630,7 +630,7 @@ virObjectListFreeCount(void *list,
         return;
 
     for (i = 0; i < count; i++)
-        virObjectUnref(((void **)list)[i]);
+        virObjectUnref(((void **) list)[i]);
 
     VIR_FREE(list);
 }
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 58ab29f77f2c..9253d2c4ce88 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -252,7 +252,7 @@ int virPidFileReadPathIfAlive(const char *path,
         goto cleanup;
     }
 
-    if (virAsprintf(&procPath, "/proc/%lld/exe", (long long)retPid) < 0) {
+    if (virAsprintf(&procPath, "/proc/%lld/exe", (long long) retPid) < 0) {
         ret = -ENOMEM;
         goto cleanup;
     }
diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c
index 198439cea291..d937a1f7faf2 100644
--- a/src/util/virpolkit.c
+++ b/src/util/virpolkit.c
@@ -87,9 +87,9 @@ int virPolkitCheckAuth(const char *actionid,
                           "(sa{sv})sa&{ss}us",
                           "unix-process",
                           3,
-                          "pid", "u", (unsigned int)pid,
+                          "pid", "u", (unsigned int) pid,
                           "start-time", "t", startTime,
-                          "uid", "i", (int)uid,
+                          "uid", "i", (int) uid,
                           actionid,
                           virStringListLength(details) / 2,
                           details,
diff --git a/src/util/virprobe.h b/src/util/virprobe.h
index 88cda2104f08..afc966d06a07 100644
--- a/src/util/virprobe.h
+++ b/src/util/virprobe.h
@@ -48,7 +48,7 @@
  * can safely go to intptr_t and back to void *, which collapses
  * arrays into pointers; while any integer can be widened to intptr_t
  * then cast to void *.  */
-#  define VIR_ADD_CAST(a) ((void *)(intptr_t)(a))
+#  define VIR_ADD_CAST(a) ((void *) (intptr_t)(a))
 #  define VIR_ADD_CAST1(a) \
     VIR_ADD_CAST(a)
 #  define VIR_ADD_CAST2(a, b) \
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 1fbbbb3a279f..43ef0fc16c7d 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -207,7 +207,7 @@ void
 virProcessAbort(pid_t pid)
 {
     /* Not yet ported to mingw.  Any volunteers?  */
-    VIR_DEBUG("failed to reap child %lld, abandoning it", (long long)pid);
+    VIR_DEBUG("failed to reap child %lld, abandoning it", (long long) pid);
 }
 #endif
 
@@ -352,7 +352,7 @@ virProcessKillPainfully(pid_t pid, bool force)
     int ret = -1;
     const char *signame = "TERM";
 
-    VIR_DEBUG("vpid=%lld force=%d", (long long)pid, force);
+    VIR_DEBUG("vpid=%lld force=%d", (long long) pid, force);
 
     /* This loop sends SIGTERM, then waits a few iterations (10 seconds)
      * to see if it dies. If the process still hasn't exited, and
@@ -368,7 +368,7 @@ virProcessKillPainfully(pid_t pid, bool force)
             signum = SIGTERM; /* kindly suggest it should exit */
         } else if (i == 50 && force) {
             VIR_DEBUG("Timed out waiting after SIGTERM to process %lld, "
-                      "sending SIGKILL", (long long)pid);
+                      "sending SIGKILL", (long long) pid);
             /* No SIGKILL kill on Win32 ! Use SIGABRT instead which our
              * virProcessKill proc will handle more or less like SIGKILL */
 #ifdef WIN32
@@ -386,7 +386,7 @@ virProcessKillPainfully(pid_t pid, bool force)
             if (errno != ESRCH) {
                 virReportSystemError(errno,
                                      _("Failed to terminate process %lld with SIG%s"),
-                                     (long long)pid, signame);
+                                     (long long) pid, signame);
                 goto cleanup;
             }
             ret = signum == SIGTERM ? 0 : 1;
@@ -398,7 +398,7 @@ virProcessKillPainfully(pid_t pid, bool force)
 
     virReportSystemError(EBUSY,
                          _("Failed to terminate process %lld with SIG%s"),
-                         (long long)pid, signame);
+                         (long long) pid, signame);
 
  cleanup:
     return ret;
@@ -410,7 +410,7 @@ virProcessKillPainfully(pid_t pid, bool force)
 int virProcessSetAffinity(pid_t pid, virBitmapPtr map)
 {
     size_t i;
-    VIR_DEBUG("Set process affinity on %lld", (long long)pid);
+    VIR_DEBUG("Set process affinity on %lld", (long long) pid);
 # ifdef CPU_ALLOC
     /* New method dynamically allocates cpu mask, allowing unlimted cpus */
     int numcpus = 1024;
@@ -768,7 +768,7 @@ virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes)
             virReportSystemError(errno,
                                  _("cannot limit locked memory "
                                    "of process %lld to %llu"),
-                                 (long long int)pid, bytes);
+                                 (long long int) pid, bytes);
             return -1;
         }
     }
@@ -864,7 +864,7 @@ virProcessSetMaxProcesses(pid_t pid, unsigned int procs)
             virReportSystemError(errno,
                                  _("cannot limit number of subprocesses "
                                    "of process %lld to %u"),
-                                 (long long int)pid, procs);
+                                 (long long int) pid, procs);
             return -1;
         }
     }
@@ -912,7 +912,7 @@ virProcessSetMaxFiles(pid_t pid, unsigned int files)
             virReportSystemError(errno,
                                  _("cannot limit number of open files "
                                    "of process %lld to %u"),
-                                 (long long int)pid, files);
+                                 (long long int) pid, files);
             return -1;
         }
     }
@@ -949,7 +949,7 @@ virProcessSetMaxCoreSize(pid_t pid, unsigned long long bytes)
             virReportSystemError(errno,
                                  _("cannot limit core file size "
                                    "of process %lld to %llu"),
-                                 (long long int)pid, bytes);
+                                 (long long int) pid, bytes);
             return -1;
         }
     }
@@ -1055,7 +1055,7 @@ int virProcessGetStartTime(pid_t pid,
         return -1;
     }
 
-    *timestamp = (unsigned long long)p.ki_start.tv_sec;
+    *timestamp = (unsigned long long) p.ki_start.tv_sec;
 
     return 0;
 
diff --git a/src/util/virrandom.c b/src/util/virrandom.c
index 41daa404b273..817c8d9968e2 100644
--- a/src/util/virrandom.c
+++ b/src/util/virrandom.c
@@ -235,7 +235,7 @@ virRandomGenerateWWN(char **wwn,
     }
 
     if (virAsprintf(wwn, "5" "%s%09llx", oui,
-                    (unsigned long long)virRandomBits(36)) < 0)
+                    (unsigned long long) virRandomBits(36)) < 0)
         return -1;
     return 0;
 }
diff --git a/src/util/virrotatingfile.c b/src/util/virrotatingfile.c
index ca62a8e02641..096c9ef92f36 100644
--- a/src/util/virrotatingfile.c
+++ b/src/util/virrotatingfile.c
@@ -533,7 +533,7 @@ virRotatingFileReaderSeek(virRotatingFileReaderPtr file,
         if (ret == (off_t)-1) {
             virReportSystemError(errno,
                                  _("Unable to seek to inode %llu offset %llu"),
-                                 (unsigned long long)inode, (unsigned long long)offset);
+                                 (unsigned long long) inode, (unsigned long long) offset);
             return -1;
         }
 
@@ -546,7 +546,7 @@ virRotatingFileReaderSeek(virRotatingFileReaderPtr file,
     if (ret == (off_t)-1) {
         virReportSystemError(errno,
                              _("Unable to seek to inode %llu offset %llu"),
-                             (unsigned long long)inode, (unsigned long long)offset);
+                             (unsigned long long) inode, (unsigned long long) offset);
         return -1;
     }
     return 0;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 531540ac9184..bfedaf8fa87b 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -460,7 +460,7 @@ qcow2GetBackingStoreFormat(int *format,
             if (buf[offset+len] != '\0')
                 break;
             *format = virStorageFileFormatTypeFromString(
-                ((const char *)buf)+offset);
+                ((const char *) buf)+offset);
             if (*format <= VIR_STORAGE_FILE_NONE)
                 return -1;
         }
@@ -2475,7 +2475,7 @@ virStorageSourceRBDAddHost(virStorageSourcePtr src,
     parts = virStringSplit(hostport, "\\:", 0);
     if (!parts)
         goto error;
-    src->hosts[src->nhosts-1].name = virStringListJoin((const char **)parts, ":");
+    src->hosts[src->nhosts-1].name = virStringListJoin((const char **) parts, ":");
     virStringListFree(parts);
     if (!src->hosts[src->nhosts-1].name)
         goto error;
@@ -3510,8 +3510,8 @@ virStorageSourceUpdateBackingSizes(virStorageSourcePtr src,
     /* Get info for normal formats */
     if (S_ISREG(sb->st_mode) || fd == -1) {
 #ifndef WIN32
-        src->allocation = (unsigned long long)sb->st_blocks *
-            (unsigned long long)DEV_BSIZE;
+        src->allocation = (unsigned long long) sb->st_blocks *
+            (unsigned long long) DEV_BSIZE;
 #else
         src->allocation = sb->st_size;
 #endif
@@ -4452,7 +4452,7 @@ virStorageFileChown(const virStorageSource *src,
     }
 
     VIR_DEBUG("chown of storage file %p to %u:%u",
-              src, (unsigned int)uid, (unsigned int)gid);
+              src, (unsigned int) uid, (unsigned int) gid);
 
     return src->drv->backend->storageFileChown(src, uid, gid);
 }
@@ -4523,7 +4523,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
 
     VIR_DEBUG("path=%s format=%d uid=%u gid=%u probe=%d",
               src->path, src->format,
-              (unsigned int)uid, (unsigned int)gid, allow_probe);
+              (unsigned int) uid, (unsigned int) gid, allow_probe);
 
     /* exit if we can't load information about the current image */
     if (!virStorageFileSupportsBackingChainTraversal(src))
@@ -4547,7 +4547,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
         goto cleanup;
     }
 
-    if (virHashAddEntry(cycle, uniqueName, (void *)1) < 0)
+    if (virHashAddEntry(cycle, uniqueName, (void *) 1) < 0)
         goto cleanup;
 
     if ((headerLen = virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER,
@@ -4628,7 +4628,7 @@ virStorageFileGetMetadata(virStorageSourcePtr src,
                           bool report_broken)
 {
     VIR_DEBUG("path=%s format=%d uid=%u gid=%u probe=%d, report_broken=%d",
-              src->path, src->format, (unsigned int)uid, (unsigned int)gid,
+              src->path, src->format, (unsigned int) uid, (unsigned int) gid,
               allow_probe, report_broken);
 
     virHashTablePtr cycle = NULL;
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 3be963d704ea..28af95066d1e 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -338,7 +338,7 @@ int virSystemdCreateMachine(const char *name,
                               uuid[12], uuid[13], uuid[14], uuid[15],
                               creatorname,
                               iscontainer ? "container" : "vm",
-                              (unsigned int)pidleader,
+                              (unsigned int) pidleader,
                               rootdir ? rootdir : "",
                               nnicindexes, nicindexes,
                               3,
@@ -380,7 +380,7 @@ int virSystemdCreateMachine(const char *name,
                               uuid[12], uuid[13], uuid[14], uuid[15],
                               creatorname,
                               iscontainer ? "container" : "vm",
-                              (unsigned int)pidleader,
+                              (unsigned int) pidleader,
                               rootdir ? rootdir : "",
                               3,
                               "Slice", "s", slicename,
@@ -464,7 +464,7 @@ virSystemdNotifyStartup(void)
         .sun_family = AF_UNIX,
     };
     struct iovec iov = {
-        .iov_base = (char *)msg,
+        .iov_base = (char *) msg,
         .iov_len = strlen(msg),
     };
     struct msghdr mh = {
diff --git a/src/util/virtime.c b/src/util/virtime.c
index 640eb5a1d12c..84879bf19502 100644
--- a/src/util/virtime.c
+++ b/src/util/virtime.c
@@ -395,7 +395,7 @@ virTimeBackOffStart(virTimeBackOffVar *var,
 
 /**
  * virTimeBackOffWait
- * @var: Timeout variable (with type virTimeBackOffVar *).
+ * @var: Timeout variable (with type virTimeBackOffVar *) .
  *
  * You must initialize @var first by calling the following function,
  * which also starts the timer:
diff --git a/src/util/viruri.c b/src/util/viruri.c
index b80d9249e638..595a696a78dd 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -253,7 +253,7 @@ virURIFormat(virURIPtr uri)
     if (!xmluri.server && !xmluri.port)
         xmluri.port = -1;
 
-    ret = (char *)xmlSaveUri(&xmluri);
+    ret = (char *) xmlSaveUri(&xmluri);
     if (!ret) {
         virReportOOMError();
         goto cleanup;
diff --git a/src/util/virutil.c b/src/util/virutil.c
index cd6fbf2f306a..2a65b73230bd 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1904,7 +1904,7 @@ void virUpdateSelfLastChanged(const char *path)
 
     if (sb.st_ctime > selfLastChanged) {
         VIR_DEBUG("Setting self last changed to %lld for '%s'",
-                  (long long)sb.st_ctime, path);
+                  (long long) sb.st_ctime, path);
         selfLastChanged = sb.st_ctime;
     }
 }
diff --git a/src/util/virutil.h b/src/util/virutil.h
index be0f6b0ea855..08d65136b647 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -202,9 +202,9 @@ virTristateSwitch virTristateSwitchFromBool(bool val);
 
 /* the two enums must be in sync to be able to use helpers interchangeably in
  * some special cases */
-verify((int)VIR_TRISTATE_BOOL_YES == (int)VIR_TRISTATE_SWITCH_ON);
-verify((int)VIR_TRISTATE_BOOL_NO == (int)VIR_TRISTATE_SWITCH_OFF);
-verify((int)VIR_TRISTATE_BOOL_ABSENT == (int)VIR_TRISTATE_SWITCH_ABSENT);
+verify((int) VIR_TRISTATE_BOOL_YES == (int) VIR_TRISTATE_SWITCH_ON);
+verify((int) VIR_TRISTATE_BOOL_NO == (int) VIR_TRISTATE_SWITCH_OFF);
+verify((int) VIR_TRISTATE_BOOL_ABSENT == (int) VIR_TRISTATE_SWITCH_ABSENT);
 
 unsigned int virGetListenFDs(void);
 char *virGetUNIXSocketPath(int fd);
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 6e87605ea5e4..9d35e8073228 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -507,7 +507,7 @@ char *
 virXMLPropString(xmlNodePtr node,
                  const char *name)
 {
-    return (char *)xmlGetProp(node, BAD_CAST name);
+    return (char *) xmlGetProp(node, BAD_CAST name);
 }
 
 
@@ -528,7 +528,7 @@ virXMLPropStringLimit(xmlNodePtr node,
                       const char *name,
                       size_t maxlen)
 {
-    char *tmp = (char *)xmlGetProp(node, BAD_CAST name);
+    char *tmp = (char *) xmlGetProp(node, BAD_CAST name);
 
     return virXMLStringLimitInternal(tmp, maxlen, name);
 }
@@ -546,7 +546,7 @@ virXMLPropStringLimit(xmlNodePtr node,
 char *
 virXMLNodeContentString(xmlNodePtr node)
 {
-    return (char *)xmlNodeGetContent(node);
+    return (char *) xmlNodeGetContent(node);
 }
 
 
@@ -986,7 +986,7 @@ virXMLNodeToString(xmlDocPtr doc,
         goto cleanup;
     }
 
-    ignore_value(VIR_STRDUP(ret, (const char *)xmlBufferContent(xmlbuf)));
+    ignore_value(VIR_STRDUP(ret, (const char *) xmlBufferContent(xmlbuf)));
 
  cleanup:
     xmlBufferFree(xmlbuf);
@@ -1043,7 +1043,7 @@ virXMLRemoveElementNamespace(xmlNodePtr node,
     const char *uri = opaque;
 
     if (node->ns &&
-        STREQ_NULLABLE((const char *)node->ns->href, uri))
+        STREQ_NULLABLE((const char *) node->ns->href, uri))
         xmlSetNs(node, NULL);
     return 0;
 }
@@ -1097,12 +1097,12 @@ virXMLExtractNamespaceXML(xmlNodePtr root,
     }
 
     virXMLForeachNode(nodeCopy, virXMLRemoveElementNamespace,
-                      (void *)uri);
+                      (void *) uri);
 
     /* remove the namespace declaration
      *  - it's only a single linked list ... doh */
     for (actualNs = nodeCopy->nsDef; actualNs; actualNs = actualNs->next) {
-        if (STREQ_NULLABLE((const char *)actualNs->href, uri)) {
+        if (STREQ_NULLABLE((const char *) actualNs->href, uri)) {
 
             /* unlink */
             if (prevNs)
@@ -1153,13 +1153,13 @@ virXMLInjectNamespace(xmlNodePtr node,
 {
     xmlNsPtr ns;
 
-    if (xmlValidateNCName((const unsigned char *)key, 1) != 0) {
+    if (xmlValidateNCName((const unsigned char *) key, 1) != 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("failed to validate prefix for a new XML namespace"));
         return -1;
     }
 
-    if (!(ns = xmlNewNs(node, (const unsigned char *)uri, (const unsigned char *)key))) {
+    if (!(ns = xmlNewNs(node, (const unsigned char *) uri, (const unsigned char *) key))) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("failed to create a new XML namespace"));
         return -1;
-- 
2.17.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux