[PATCH v2 03/16] Use K&R style for curly braces in src/util/

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

 



Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/util/vircgroup.c             |  9 ++++++---
 src/util/virconf.c               |  5 +++--
 src/util/virdbus.c               |  8 +++++---
 src/util/virerror.c              |  3 ++-
 src/util/vireventpoll.c          | 29 +++++++++++++++++++----------
 src/util/virhook.c               | 11 +++++++----
 src/util/virnetdevvportprofile.c |  5 +++--
 src/util/virrandom.c             |  5 +++--
 src/util/virsocketaddr.c         | 26 +++++++++++++++++---------
 src/util/virsysinfo.c            | 15 ++++++++++-----
 src/util/virthread.c             |  5 +++--
 src/util/virutil.c               | 20 +++++++++++++-------
 src/util/virutil.h               | 12 ++++++++----
 src/util/viruuid.c               |  5 +++--
 14 files changed, 102 insertions(+), 56 deletions(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index c5925b1..84847b2 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -419,7 +419,8 @@ virCgroupCopyPlacement(virCgroupPtr group,
             /*
              * parent == "/" + path="" => "/"
              * parent == "/libvirt.service" + path == "" => "/libvirt.service"
-             * parent == "/libvirt.service" + path == "foo" => "/libvirt.service/foo"
+             * parent == "/libvirt.service" +
+             *                         path == "foo" => "/libvirt.service/foo"
              */
             if (virAsprintf(&group->controllers[i].placement,
                             "%s%s%s",
@@ -519,8 +520,10 @@ virCgroupDetectPlacement(virCgroupPtr group,

                 /*
                  * selfpath == "/" + path="" -> "/"
-                 * selfpath == "/libvirt.service" + path == "" -> "/libvirt.service"
-                 * selfpath == "/libvirt.service" + path == "foo" -> "/libvirt.service/foo"
+                 * selfpath == "/libvirt.service" +
+                 *                       path == "" -> "/libvirt.service"
+                 * selfpath == "/libvirt.service" +
+                 *                       path == "foo" -> "/libvirt.service/foo"
                  */
                 if (typelen == len && STREQLEN(typestr, tmp, len) &&
                     group->controllers[i].mountPoint != NULL &&
diff --git a/src/util/virconf.c b/src/util/virconf.c
index b965df7..233ad40 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1,7 +1,7 @@
 /*
  * virconf.c: parser for a subset of the Python encoded Xen configuration files
  *
- * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -708,7 +708,8 @@ virConfParseStatement(virConfParserCtxtPtr ctxt)
  */
 static virConfPtr
 virConfParse(const char *filename, const char *content, int len,
-             unsigned int flags) {
+             unsigned int flags)
+{
     virConfParserCtxt ctxt;

     ctxt.filename = filename;
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index e3236d8..9e29ca9 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -1,7 +1,7 @@
 /*
  * virdbus.c: helper for using DBus
  *
- * Copyright (C) 2012-2013 Red Hat, Inc.
+ * Copyright (C) 2012-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -217,7 +217,8 @@ static int virDBusTranslateWatchFlags(int dbus_flags)
 }


-static void virDBusWatchFree(void *data) {
+static void virDBusWatchFree(void *data)
+{
     struct virDBusWatch *info = data;
     VIR_FREE(info);
 }
@@ -296,7 +297,8 @@ static const char virDBusBasicTypes[] = {
     DBUS_TYPE_SIGNATURE,
 };

-static bool virDBusIsBasicType(char c) {
+static bool virDBusIsBasicType(char c)
+{
     return !!memchr(virDBusBasicTypes, c, ARRAY_CARDINALITY(virDBusBasicTypes));
 }

diff --git a/src/util/virerror.c b/src/util/virerror.c
index 1d7fa77..9db2452 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -43,7 +43,8 @@ virErrorFunc virErrorHandler = NULL;     /* global error handler */
 void *virUserData = NULL;        /* associated data */
 virErrorLogPriorityFunc virErrorLogPriorityFilter = NULL;

-static virLogPriority virErrorLevelPriority(virErrorLevel level) {
+static virLogPriority virErrorLevelPriority(virErrorLevel level)
+{
     switch (level) {
         case VIR_ERR_NONE:
             return VIR_LOG_INFO;
diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c
index ea890de..d8a36e9 100644
--- a/src/util/vireventpoll.c
+++ b/src/util/vireventpoll.c
@@ -1,7 +1,7 @@
 /*
  * vireventpoll.c: Poll based event loop for monitoring file handles
  *
- * Copyright (C) 2007, 2010-2013 Red Hat, Inc.
+ * Copyright (C) 2007, 2010-2014 Red Hat, Inc.
  * Copyright (C) 2007 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -106,7 +106,8 @@ static int nextTimer = 1;
 int virEventPollAddHandle(int fd, int events,
                           virEventHandleCallback cb,
                           void *opaque,
-                          virFreeCallback ff) {
+                          virFreeCallback ff)
+{
     int watch;
     virMutexLock(&eventLoop.lock);
     if (eventLoop.handlesCount == eventLoop.handlesAlloc) {
@@ -142,7 +143,8 @@ int virEventPollAddHandle(int fd, int events,
     return watch;
 }

-void virEventPollUpdateHandle(int watch, int events) {
+void virEventPollUpdateHandle(int watch, int events)
+{
     size_t i;
     bool found = false;
     PROBE(EVENT_POLL_UPDATE_HANDLE,
@@ -176,7 +178,8 @@ void virEventPollUpdateHandle(int watch, int events) {
  * For this reason we only ever set a flag in the existing list.
  * Actual deletion will be done out-of-band
  */
-int virEventPollRemoveHandle(int watch) {
+int virEventPollRemoveHandle(int watch)
+{
     size_t i;
     PROBE(EVENT_POLL_REMOVE_HANDLE,
           "watch=%d",
@@ -296,7 +299,8 @@ void virEventPollUpdateTimeout(int timer, int frequency)
  * For this reason we only ever set a flag in the existing list.
  * Actual deletion will be done out-of-band
  */
-int virEventPollRemoveTimeout(int timer) {
+int virEventPollRemoveTimeout(int timer)
+{
     size_t i;
     PROBE(EVENT_POLL_REMOVE_TIMEOUT,
           "timer=%d",
@@ -329,7 +333,8 @@ int virEventPollRemoveTimeout(int timer) {
  *           no timeout is pending
  * returns: 0 on success, -1 on error
  */
-static int virEventPollCalculateTimeout(int *timeout) {
+static int virEventPollCalculateTimeout(int *timeout)
+{
     unsigned long long then = 0;
     size_t i;
     EVENT_DEBUG("Calculate expiry of %zu timers", eventLoop.timeoutsCount);
@@ -469,7 +474,8 @@ static int virEventPollDispatchTimeouts(void)
  *
  * Returns 0 upon success, -1 if an error occurred
  */
-static int virEventPollDispatchHandles(int nfds, struct pollfd *fds) {
+static int virEventPollDispatchHandles(int nfds, struct pollfd *fds)
+{
     size_t i, n;
     VIR_DEBUG("Dispatch %d", nfds);

@@ -514,7 +520,8 @@ static int virEventPollDispatchHandles(int nfds, struct pollfd *fds) {
  * were previously marked as deleted. This asynchronous
  * cleanup is needed to make dispatch re-entrant safe.
  */
-static void virEventPollCleanupTimeouts(void) {
+static void virEventPollCleanupTimeouts(void)
+{
     size_t i;
     size_t gap;
     VIR_DEBUG("Cleanup %zu", eventLoop.timeoutsCount);
@@ -562,7 +569,8 @@ static void virEventPollCleanupTimeouts(void) {
  * were previously marked as deleted. This asynchronous
  * cleanup is needed to make dispatch re-entrant safe.
  */
-static void virEventPollCleanupHandles(void) {
+static void virEventPollCleanupHandles(void)
+{
     size_t i;
     size_t gap;
     VIR_DEBUG("Cleanup %zu", eventLoop.handlesCount);
@@ -610,7 +618,8 @@ static void virEventPollCleanupHandles(void) {
  * Run a single iteration of the event loop, blocking until
  * at least one file handle has an event, or a timer expires
  */
-int virEventPollRunOnce(void) {
+int virEventPollRunOnce(void)
+{
     struct pollfd *fds = NULL;
     int ret, timeout, nfds;

diff --git a/src/util/virhook.c b/src/util/virhook.c
index e3ac4d2..ac7b40f 100644
--- a/src/util/virhook.c
+++ b/src/util/virhook.c
@@ -1,7 +1,7 @@
 /*
  * virhook.c: implementation of the synchronous hooks support
  *
- * Copyright (C) 2010-2013 Red Hat, Inc.
+ * Copyright (C) 2010-2014 Red Hat, Inc.
  * Copyright (C) 2010 Daniel Veillard
  *
  * This library is free software; you can redistribute it and/or
@@ -107,7 +107,8 @@ static int virHooksFound = -1;
  * Returns 1 if found, 0 if not found, and -1 in case of error
  */
 static int
-virHookCheck(int no, const char *driver) {
+virHookCheck(int no, const char *driver)
+{
     char *path;
     int ret;

@@ -149,7 +150,8 @@ virHookCheck(int no, const char *driver) {
  * Returns the number of hooks found or -1 in case of failure
  */
 int
-virHookInitialize(void) {
+virHookInitialize(void)
+{
     size_t i;
     int res, ret = 0;

@@ -177,7 +179,8 @@ virHookInitialize(void) {
  * Returns 1 if present, 0 otherwise
  */
 int
-virHookPresent(int driver) {
+virHookPresent(int driver)
+{
     if ((driver < VIR_HOOK_DRIVER_DAEMON) ||
         (driver >= VIR_HOOK_DRIVER_LAST))
         return 0;
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index 9a294d9..d77c31f 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2013 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -449,7 +449,8 @@ static struct nla_policy ifla_port_policy[IFLA_PORT_MAX + 1] =
 };

 static uint32_t
-virNetDevVPortProfileGetLldpadPid(void) {
+virNetDevVPortProfileGetLldpadPid(void)
+{
     int fd;
     uint32_t pid = 0;

diff --git a/src/util/virrandom.c b/src/util/virrandom.c
index 49181ad..3f17f5e 100644
--- a/src/util/virrandom.c
+++ b/src/util/virrandom.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2013 Red Hat, Inc.
+ * Copyright (C) 2012-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -165,7 +165,8 @@ uint32_t virRandomInt(uint32_t max)

 int
 virRandomGenerateWWN(char **wwn,
-                     const char *virt_type) {
+                     const char *virt_type)
+{
     const char *oui = NULL;

     if (!virt_type) {
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 3f270e2..8ffdf14 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2013 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -116,7 +116,8 @@ virSocketAddrParseInternal(struct addrinfo **res,
  *
  * Returns the length of the network address or -1 in case of error.
  */
-int virSocketAddrParse(virSocketAddrPtr addr, const char *val, int family) {
+int virSocketAddrParse(virSocketAddrPtr addr, const char *val, int family)
+{
     int len;
     struct addrinfo *res;

@@ -150,7 +151,8 @@ int virSocketAddrParse(virSocketAddrPtr addr, const char *val, int family) {
  * Returns the length of the network address or -1 in case of error.
  */
 int
-virSocketAddrParseIPv4(virSocketAddrPtr addr, const char *val) {
+virSocketAddrParseIPv4(virSocketAddrPtr addr, const char *val)
+{
     return virSocketAddrParse(addr, val, AF_INET);
 }

@@ -164,7 +166,8 @@ virSocketAddrParseIPv4(virSocketAddrPtr addr, const char *val) {
  * Returns the length of the network address or -1 in case of error.
  */
 int
-virSocketAddrParseIPv6(virSocketAddrPtr addr, const char *val) {
+virSocketAddrParseIPv6(virSocketAddrPtr addr, const char *val)
+{
     return virSocketAddrParse(addr, val, AF_INET6);
 }

@@ -355,7 +358,8 @@ error:
  * Returns 0 on success, -1 on failure
  */
 int
-virSocketAddrSetPort(virSocketAddrPtr addr, int port) {
+virSocketAddrSetPort(virSocketAddrPtr addr, int port)
+{
     if (addr == NULL)
         return -1;

@@ -380,7 +384,8 @@ virSocketAddrSetPort(virSocketAddrPtr addr, int port) {
  * Returns -1 if @addr is invalid
  */
 int
-virSocketAddrGetPort(virSocketAddrPtr addr) {
+virSocketAddrGetPort(virSocketAddrPtr addr)
+{
     if (addr == NULL)
         return -1;

@@ -401,7 +406,8 @@ virSocketAddrGetPort(virSocketAddrPtr addr) {
  *
  * Returns 0 in case of success and -1 in case of error
  */
-int virSocketAddrIsNetmask(virSocketAddrPtr netmask) {
+int virSocketAddrIsNetmask(virSocketAddrPtr netmask)
+{
     int n = virSocketAddrGetNumNetmaskBits(netmask);
     if (n < 0)
         return -1;
@@ -549,7 +555,8 @@ virSocketAddrBroadcastByPrefix(const virSocketAddr *addr,
  *         -1 in case of error
  */
 int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
-                              virSocketAddrPtr netmask) {
+                              virSocketAddrPtr netmask)
+{
     size_t i;

     if ((addr1 == NULL) || (addr2 == NULL) || (netmask == NULL))
@@ -605,7 +612,8 @@ int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
  *
  * Returns the size of the range or -1 in case of failure
  */
-int virSocketAddrGetRange(virSocketAddrPtr start, virSocketAddrPtr end) {
+int virSocketAddrGetRange(virSocketAddrPtr start, virSocketAddrPtr end)
+{
     int ret = 0;
     size_t i;

diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 609d815..512310f 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -215,7 +215,8 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret)
 /* virSysinfoRead for PowerPC
  * Gathers sysinfo data from /proc/cpuinfo */
 virSysinfoDefPtr
-virSysinfoRead(void) {
+virSysinfoRead(void)
+{
     virSysinfoDefPtr ret = NULL;
     char *outbuf = NULL;

@@ -332,7 +333,8 @@ error:
 /* virSysinfoRead for ARMv7
  * Gathers sysinfo data from /proc/cpuinfo */
 virSysinfoDefPtr
-virSysinfoRead(void) {
+virSysinfoRead(void)
+{
     virSysinfoDefPtr ret = NULL;
     char *outbuf = NULL;

@@ -459,7 +461,8 @@ cleanup:
 /* virSysinfoRead for s390x
  * Gathers sysinfo data from /proc/sysinfo and /proc/cpuinfo */
 virSysinfoDefPtr
-virSysinfoRead(void) {
+virSysinfoRead(void)
+{
     virSysinfoDefPtr ret = NULL;
     char *outbuf = NULL;

@@ -507,7 +510,8 @@ no_memory:
       defined(__aarch64__) || \
       defined(__powerpc__))
 virSysinfoDefPtr
-virSysinfoRead(void) {
+virSysinfoRead(void)
+{
     /*
      * this can probably be extracted from Windows using API or registry
      * http://www.microsoft.com/whdc/system/platform/firmware/SMBIOS.mspx
@@ -818,7 +822,8 @@ virSysinfoParseMemory(const char *base, virSysinfoDefPtr ret)
 }

 virSysinfoDefPtr
-virSysinfoRead(void) {
+virSysinfoRead(void)
+{
     char *path;
     virSysinfoDefPtr ret = NULL;
     char *outbuf = NULL;
diff --git a/src/util/virthread.c b/src/util/virthread.c
index d3dfd16..f0e14fc 100644
--- a/src/util/virthread.c
+++ b/src/util/virthread.c
@@ -1,7 +1,7 @@
 /*
  * virthread.c: basic thread synchronization primitives
  *
- * Copyright (C) 2009-2010 Red Hat, Inc.
+ * Copyright (C) 2009-2010, 2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -83,7 +83,8 @@ void virMutexDestroy(virMutexPtr m)
     pthread_mutex_destroy(&m->lock);
 }

-void virMutexLock(virMutexPtr m){
+void virMutexLock(virMutexPtr m)
+{
     pthread_mutex_lock(&m->lock);
 }

diff --git a/src/util/virutil.c b/src/util/virutil.c
index 121722d..733cdff 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1,7 +1,7 @@
 /*
  * virutil.c: common, generic utility functions
  *
- * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2014 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  * Copyright (C) 2006, 2007 Binary Karma
  * Copyright (C) 2006 Shuveb Hussain
@@ -94,7 +94,8 @@ VIR_LOG_INIT("util.util");

 #ifndef WIN32

-int virSetInherit(int fd, bool inherit) {
+int virSetInherit(int fd, bool inherit)
+{
     int fflags;
     if ((fflags = fcntl(fd, F_GETFD)) < 0)
         return -1;
@@ -120,11 +121,13 @@ int virSetInherit(int fd ATTRIBUTE_UNUSED, bool inherit ATTRIBUTE_UNUSED)

 #endif /* WIN32 */

-int virSetBlocking(int fd, bool blocking) {
+int virSetBlocking(int fd, bool blocking)
+{
     return set_nonblocking_flag(fd, !blocking);
 }

-int virSetNonBlock(int fd) {
+int virSetNonBlock(int fd)
+{
     return virSetBlocking(fd, false);
 }

@@ -502,7 +505,8 @@ const char *virEnumToString(const char *const*types,
  * @param name The name of the device
  * @return name's index, or -1 on failure
  */
-int virDiskNameToIndex(const char *name) {
+int virDiskNameToIndex(const char *name)
+{
     const char *ptr = NULL;
     int idx = 0;
     static char const* const drive_prefix[] = {"fd", "hd", "vd", "sd", "xvd", "ubd"};
@@ -1465,7 +1469,8 @@ void virFileWaitForDevices(void)
     {}
 }
 #else
-void virFileWaitForDevices(void) {}
+void virFileWaitForDevices(void)
+{}
 #endif

 #if HAVE_LIBDEVMAPPER_H
@@ -1489,7 +1494,8 @@ bool virIsDevMapperDevice(const char *dev_name ATTRIBUTE_UNUSED)
 #endif

 bool
-virValidateWWN(const char *wwn) {
+virValidateWWN(const char *wwn)
+{
     size_t i;
     const char *p = wwn;

diff --git a/src/util/virutil.h b/src/util/virutil.h
index cffe1ed..1f2efd5 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -98,19 +98,23 @@ const char *virEnumToString(const char *const*types,

 /* No-op workarounds for functionality missing in mingw.  */
 # ifndef HAVE_GETUID
-static inline int getuid(void) { return 0; }
+static inline int getuid(void)
+{ return 0; }
 # endif

 # ifndef HAVE_GETEUID
-static inline int geteuid(void) { return 0; }
+static inline int geteuid(void)
+{ return 0; }
 # endif

 # ifndef HAVE_GETGID
-static inline int getgid(void) { return 0; }
+static inline int getgid(void)
+{ return 0; }
 # endif

 # ifndef HAVE_GETEGID
-static inline int getegid(void) { return 0; }
+static inline int getegid(void)
+{ return 0; }
 # endif

 # ifdef FUNC_PTHREAD_SIGMASK_BROKEN
diff --git a/src/util/viruuid.c b/src/util/viruuid.c
index eacac44..615d419 100644
--- a/src/util/viruuid.c
+++ b/src/util/viruuid.c
@@ -1,7 +1,7 @@
 /*
  * viruuid.c: helper APIs for dealing with UUIDs
  *
- * Copyright (C) 2007-2013 Red Hat, Inc.
+ * Copyright (C) 2007-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -149,7 +149,8 @@ virUUIDGenerate(unsigned char *uuid)
  * Returns 0 in case of success and -1 in case of error.
  */
 int
-virUUIDParse(const char *uuidstr, unsigned char *uuid) {
+virUUIDParse(const char *uuidstr, unsigned char *uuid)
+{
     const char *cur;
     size_t i;

-- 
1.9.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]